aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/mac-libs.sh16
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