mirror of
https://github.com/mroi/apple-internals.git
synced 2026-02-12 17:12:44 +00:00
Makefile: de-duplicate dylibs and strings
to save space
This commit is contained in:
8
Makefile
8
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 "/^<stdin>: 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user