diff options
author | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2021-04-23 14:15:47 +0200 |
---|---|---|
committer | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2021-04-23 14:15:47 +0200 |
commit | 68f52dcc4ea77334168e5f794753d4c06b08dd8d (patch) | |
tree | aeb2654bad7ef85224d76b1d34bf84ea3c08cead /tools | |
parent | 9e20aa8a3e75cd34b5a36a7b41b5481c4a0711a8 (diff) |
Fix various issues in mac-libs.sh
* pre-11.0 sed doesn't seem to understand \t so use a literal tab
* don't fail if we run the script on a package with libs already bundled
* delete header files in the bundled frameworks to save space
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/mac-libs.sh | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/mac-libs.sh b/tools/mac-libs.sh index c748890..5b7d031 100755 --- a/tools/mac-libs.sh +++ b/tools/mac-libs.sh @@ -39,12 +39,9 @@ if [[ ! -d "$plugindir" ]]; then cp "$qt_plugins/platforms/libqcocoa.dylib" "$plugindir/platforms/" fi -mkdir "$app/Contents/Frameworks" -install_name_tool -add_rpath "@executable_path/../Frameworks" "$app/Contents/MacOS/melonDS" - fixup_libs() { - local libs=($(otool -L "$1" | grep -vE "/System|/usr/lib|:$" | sed -E 's/\t(.*) \(.*$/\1/')) - + local libs=($(otool -L "$1" | grep -vE "/System|/usr/lib|:$|@rpath" | sed -E 's/'$'\t''(.*) \(.*$/\1/')) + for lib in "${libs[@]}"; do # Dereference symlinks to get the actual .dylib as binaries' load # commands can contain paths to symlinked libraries. @@ -60,6 +57,7 @@ fixup_libs() { if [[ ! -d "$install_path" ]]; then cp -a "$fwpath" "$install_path" + find -H "$install_path" "(" -type d -or -type l ")" -name Headers -exec rm -rf "{}" + chown -R $UID "$install_path" chmod -R u+w "$install_path" strip -SNTx "$install_path/$fwlib" @@ -80,19 +78,23 @@ fixup_libs() { done } +if [[ ! -d "$app/Contents/Frameworks" ]]; then + mkdir -p "$app/Contents/Frameworks" + install_name_tool -add_rpath "@executable_path/../Frameworks" "$app/Contents/MacOS/melonDS" +fi fixup_libs "$app/Contents/MacOS/melonDS" find "$app/Contents/PlugIns" -name '*.dylib' | while read lib; do fixup_libs "$lib" done -bad_rpaths=($(otool -l "$app/Contents/MacOS/melonDS" | grep -E "^ *path (/usr/local|/opt)" | sed -E 's/^ *path (.*) \(.*/\1/')) +bad_rpaths=($(otool -l "$app/Contents/MacOS/melonDS" | grep -E "^ *path (/usr/local|/opt)" | sed -E 's/^ *path (.*) \(.*/\1/' || true)) for path in "${bad_rpaths[@]}"; do install_name_tool -delete_rpath "$path" "$app/Contents/MacOS/melonDS" done -codesign -s - --deep "$app" +codesign -s - --deep -f "$app" if [[ $build_dmg == 1 ]]; then mkdir dmg |