2023-01-21 03:08:20 +00:00
|
|
|
#!/bin/sh
|
2022-12-04 00:41:38 +00:00
|
|
|
|
|
|
|
PLATFORM=$(uname)
|
|
|
|
|
2023-01-21 03:08:20 +00:00
|
|
|
if [ "$PLATFORM" = 'Linux' ]; then
|
|
|
|
echo "[patch-rpath] patching Linux .so files..."
|
2022-12-04 00:41:38 +00:00
|
|
|
|
2022-12-23 07:19:14 +00:00
|
|
|
chmod -x ./bin/lib/*
|
|
|
|
chmod -x ./bin/plugins/*
|
|
|
|
chmod -x ./bin/*.so
|
|
|
|
|
2022-12-04 00:41:38 +00:00
|
|
|
# update the RPATH so libraries in libs/ can discover each other,
|
|
|
|
# and plugins can discover themselves, and libs/ (but not the
|
|
|
|
# other way around)
|
|
|
|
|
|
|
|
FILES="./bin/lib/*"
|
|
|
|
for f in $FILES
|
|
|
|
do
|
|
|
|
patchelf --set-rpath "\$ORIGIN" "$f"
|
|
|
|
done
|
|
|
|
|
|
|
|
FILES="./bin/plugins/*.so"
|
|
|
|
for f in $FILES
|
|
|
|
do
|
|
|
|
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/../lib" "$f"
|
|
|
|
done
|
|
|
|
|
2022-12-23 07:19:14 +00:00
|
|
|
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib" bin/musikcube
|
|
|
|
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib" bin/musikcubed
|
2022-12-04 00:41:38 +00:00
|
|
|
fi
|
2022-12-14 05:07:07 +00:00
|
|
|
|
2023-01-21 03:08:20 +00:00
|
|
|
if [ "$PLATFORM" = 'Darwin' ]; then
|
|
|
|
echo "[patch-rpath] patching macOS binaries..."
|
2023-03-23 03:19:56 +00:00
|
|
|
SOURCE_DIR=$1
|
|
|
|
install_name_tool -add_rpath "@executable_path/" $SOURCE_DIR/bin/musikcube
|
|
|
|
install_name_tool -add_rpath "@executable_path/lib" $SOURCE_DIR/bin/musikcube
|
|
|
|
install_name_tool -add_rpath "@executable_path/" $SOURCE_DIR/bin/musikcubed
|
|
|
|
install_name_tool -add_rpath "@executable_path/lib" $SOURCE_DIR/bin/musikcubed
|
2022-12-14 05:07:07 +00:00
|
|
|
fi
|
|
|
|
|
2023-01-21 03:08:20 +00:00
|
|
|
exit 0
|