mac-libs.sh: support macports

This commit is contained in:
Nadia Holmquist Pedersen 2021-04-24 10:41:00 +02:00
parent d1178a7514
commit 19a0eb4e56
1 changed files with 10 additions and 2 deletions

View File

@ -24,8 +24,8 @@ abspath() {
perl -MCwd -le 'print Cwd::abs_path shift' "$1"
}
cmake_qtdir=$(grep -E "Qt._DIR" CMakeCache.txt | cut -d= -f2)
qtdir="$(abspath "$cmake_qtdir"/../../..)"
cmake_qtdir=$(grep -E "Qt._DIR" CMakeCache.txt)
qtdir="$(abspath "$(echo "$cmake_qtdir/../../.." | cut -d= -f2)")"
plugindir="$app/Contents/PlugIns"
if [[ ! -d "$plugindir" ]]; then
@ -33,6 +33,10 @@ if [[ ! -d "$plugindir" ]]; then
if [[ ! -d "$qt_plugins" ]]; then
qt_plugins="$qtdir/share/qt/plugins"
fi
if [[ ! -d "$qt_plugins" ]]; then
qt_major="$(echo "$cmake_qtdir" | sed -E 's/Qt(.)_DIR.*/\1/')"
qt_plugins="$qtdir/libexec/qt$qt_major/plugins"
fi
mkdir -p "$plugindir/styles" "$plugindir/platforms"
cp "$qt_plugins/styles/libqmacstyle.dylib" "$plugindir/styles/"
@ -43,6 +47,10 @@ fixup_libs() {
local libs=($(otool -L "$1" | grep -vE "/System|/usr/lib|:$|@rpath" | sed -E 's/'$'\t''(.*) \(.*$/\1/'))
for lib in "${libs[@]}"; do
if [[ "$lib" != *"/"* ]]; then
continue
fi
# Dereference symlinks to get the actual .dylib as binaries' load
# commands can contain paths to symlinked libraries.
local abslib="$(abspath "$lib")"