rpath_subversion.sh [plain text]
#!/bin/sh
set -e
[ -n "$DSTROOT" ] || exit 1
[ -n "$SVN_INSTALL_DIR" ] || exit 1
for dylib in "$DSTROOT""$SVN_INSTALL_DIR"/lib/*.dylib; do
if [ ! -L "$dylib" ]; then
old_name=`otool -D "$dylib" | sed "1d"`
new_name=`echo "$old_name" | sed "s|$SVN_INSTALL_DIR|@rpath|"`
install_name_tool -id "$new_name" "$dylib"
for file in "$DSTROOT""$SVN_INSTALL_DIR"/bin/* "$DSTROOT""$SVN_INSTALL_DIR"/lib/*.dylib; do
if [ ! -L "$file" ]; then
install_name_tool -change "$old_name" "$new_name" "$file"
fi
done
fi
done
for bin in "$DSTROOT""$SVN_INSTALL_DIR"/bin/*; do
install_name_tool -add_rpath @executable_path/.. "$bin"
done