openclonk/tools/osx_bundle_libs.sh

21 lines
698 B
Bash

#!/bin/sh
# Removed, I think those should exist on every Mac Os system: z|png[0-9]*|iconv
LIBS_TO_BUNDLE=".*?/lib(jpeg|GLEW|llvm|SDL|SDL_mixer|freetype|ogg|vorbis|vorbisfile)\.[^ ]+\.dylib"
cd $TARGET_BUILD_DIR
echo "Bundling libraries..."
for lib in `otool -L $EXECUTABLE_PATH | grep -Eo "$LIBS_TO_BUNDLE" | grep -v "@executable_path.*"`; do
echo "Bundling $lib"
base=`basename $lib`
mkdir -p $FRAMEWORKS_FOLDER_PATH
bundle_path=$FRAMEWORKS_FOLDER_PATH/$base
id=@executable_path/../Frameworks/$base
echo Bundling $base... cp $lib $bundle_path
cp $lib $bundle_path
chmod u+w $bundle_path
install_name_tool -id $id $bundle_path
install_name_tool -change $lib $id $EXECUTABLE_PATH
done