From 50ba2072da278fab56329c00eb06a6d565a3118f Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Tue, 13 May 2025 11:50:25 +0200 Subject: [PATCH] Makefile: de-duplicate dylibs and strings to save space --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 939d2d9..c923371 100644 --- a/Makefile +++ b/Makefile @@ -126,19 +126,19 @@ db_binaries:: dyld echo 'DROP TABLE IF EXISTS linkages;' echo 'DROP TABLE IF EXISTS entitlements;' echo 'DROP TABLE IF EXISTS strings;' - echo 'CREATE TABLE linkages (id INTEGER REFERENCES files, dylib TEXT);' + echo 'CREATE TABLE linkages (id INTEGER REFERENCES files, dylib TEXT, UNIQUE (id, dylib));' echo 'CREATE TABLE entitlements (id INTEGER REFERENCES files, plist JSON);' - echo 'CREATE TABLE strings (id INTEGER REFERENCES files, string TEXT);' + echo 'CREATE TABLE strings (id INTEGER REFERENCES files, string TEXT, UNIQUE (id, string));' $(call find,-follow -type f -perm +111) | while read -r os path ; do \ echo "UPDATE files SET executable = true WHERE os = '$$os' AND path = '$$(echo "$$path" | sed "s/'/''/g")';" ; \ if test -r "$(call prefix,$$os)$$path" && file --no-dereference --brief --mime-type "$(call prefix,$$os)$$path" | grep -Fq application/x-mach-binary ; then \ objdump --macho --dylibs-used "$(call prefix,$$os)$$path" | \ - sed "1d;s/^.//;s/ ([^)]*)$$//;s/'/''/g;s|.*|INSERT INTO linkages $(call file,'&');|" ; \ + sed "1d;s/^.//;s/ ([^)]*)$$//;s/'/''/g;s|.*|INSERT OR IGNORE INTO linkages $(call file,'&');|" ; \ codesign --display --xml --entitlements - "$(call prefix,$$os)$$path" 2> /dev/null | \ plutil -convert json - -o - | \ sed "/^: Property List error/d;/^{}/d;s/'/''/g;s|.*|INSERT INTO entitlements $(call file,json('&'));\n|" ; \ strings -n 8 "$(call prefix,$$os)$$path" | \ - LANG=C sed "s/'/''/g;s|.*|INSERT INTO strings $(call file,'&');|" ; \ + LANG=C sed "s/'/''/g;s|.*|INSERT OR IGNORE INTO strings $(call file,'&');|" ; \ fi ; \ done