aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-12-31 15:33:49 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-12-31 15:33:49 +0000
commit59eabc4c7f04473efcfd305b213d78c57a2de26b (patch)
tree4d2625e70de3ab01252fe40c5e38780ed4e122a8
parent029e5d6964e16ec6c136b3fd3a68fd624232bcba (diff)
on Mac OS X, script to embed all the dylibs that are needed
svn path=/trunk/externals/pix_opencv/; revision=16796
-rwxr-xr-xembed-MacOSX-dependencies.sh88
1 files changed, 88 insertions, 0 deletions
diff --git a/embed-MacOSX-dependencies.sh b/embed-MacOSX-dependencies.sh
new file mode 100755
index 0000000..09dba4c
--- /dev/null
+++ b/embed-MacOSX-dependencies.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# This script finds all of the dependecies from Fink and included them into
+# current folder so that it becomes a libdir to be installed into /Library/Pd.
+# <hans@at.or.at>
+
+if [ $# -ne 1 ]; then
+ echo "Usage: $0 dir-to-copy-to"
+ exit
+fi
+
+PD_APP_LIB=$1
+
+echo " "
+
+for pd_darwin in `find . -name '*.pd_darwin'`; do
+ LIBS=`otool -L $pd_darwin | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p'`
+ if [ "x$LIBS" != "x" ]; then
+ echo "`echo $pd_darwin | sed 's|.*/\(.*\.pd_darwin$\)|\1|'` is using:"
+ for lib in $LIBS; do
+ echo " $lib"
+ install -vp /sw/lib/$lib $PD_APP_LIB
+ new_lib=`echo $lib | sed 's|.*/\(.*\.dylib\)|\1|'`
+ install_name_tool -id @loader_path/$new_lib $PD_APP_LIB/$new_lib
+ install_name_tool -change /sw/lib/$lib @loader_path/$new_lib $pd_darwin
+ done
+ echo " "
+ fi
+done
+
+for dylib in $PD_APP_LIB/*.dylib; do
+ LIBS=`otool -L $dylib | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p'`
+ if [ "x$LIBS" != "x" ]; then
+ echo "`echo $dylib | sed 's|.*/\(.*\.dylib\)|\1|'` is using:"
+ for lib in $LIBS; do
+ echo " $lib"
+ new_lib=`echo $lib | sed 's|.*/\(.*\.dylib\)|\1|'`
+ if [ -e $PD_APP_LIB/$new_lib ]; then
+ echo "$PD_APP_LIB/$new_lib already exists, skipping copy."
+ else
+ install -vp /sw/lib/$lib $PD_APP_LIB
+ fi
+ install_name_tool -id @loader_path/$new_lib $PD_APP_LIB/$new_lib
+ install_name_tool -change /sw/lib/$lib @loader_path/$new_lib $dylib
+ done
+ echo " "
+ fi
+done
+
+# run it one more time to catch dylibs that depend on dylibs
+for dylib in $PD_APP_LIB/*.dylib; do
+ LIBS=`otool -L $dylib | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p'`
+ if [ "x$LIBS" != "x" ]; then
+ echo "`echo $dylib | sed 's|.*/\(.*\.dylib\)|\1|'` is using:"
+ for lib in $LIBS; do
+ echo " $lib"
+ new_lib=`echo $lib | sed 's|.*/\(.*\.dylib\)|\1|'`
+ if [ -e $PD_APP_LIB/$new_lib ]; then
+ echo "$PD_APP_LIB/$new_lib already exists, skipping copy."
+ else
+ install -vp /sw/lib/$lib $PD_APP_LIB
+ fi
+ install_name_tool -id @loader_path/$new_lib $PD_APP_LIB/$new_lib
+ install_name_tool -change /sw/lib/$lib @loader_path/$new_lib $dylib
+ done
+ echo " "
+ fi
+done
+
+# seems like we need it one last time! phew...
+for dylib in $PD_APP_LIB/*.dylib; do
+ LIBS=`otool -L $dylib | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p'`
+ if [ "x$LIBS" != "x" ]; then
+ echo "`echo $dylib | sed 's|.*/\(.*\.dylib\)|\1|'` is using:"
+ for lib in $LIBS; do
+ echo " $lib"
+ new_lib=`echo $lib | sed 's|.*/\(.*\.dylib\)|\1|'`
+ if [ -e $PD_APP_LIB/$new_lib ]; then
+ echo "$PD_APP_LIB/$new_lib already exists, skipping copy."
+ else
+ install -vp /sw/lib/$lib $PD_APP_LIB
+ fi
+ install_name_tool -id @loader_path/$new_lib $PD_APP_LIB/$new_lib
+ install_name_tool -change /sw/lib/$lib @loader_path/$new_lib $dylib
+ done
+ echo " "
+ fi
+done