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
This commit is contained in:
parent
9e20aa8a3e
commit
68f52dcc4e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue