Sometimes we need to @rpathify libraries from more than one directory.
authorGerald Combs <gerald@wireshark.org>
Wed, 9 Oct 2013 20:49:12 +0000 (20:49 -0000)
committerGerald Combs <gerald@wireshark.org>
Wed, 9 Oct 2013 20:49:12 +0000 (20:49 -0000)
Instead of trying to match libraries from $LIBPREFIX, exclude libraries
that aren't in well-known system paths and which haven't previously been
@rpathified.

svn path=/trunk/; revision=52479

packaging/macosx/osx-app.sh

index 9b58ff5fb43ebb8f0daebd0559b6815d534a0421..8af092c340b7208f69c8323a27531534c3130799 100755 (executable)
@@ -43,6 +43,8 @@ plist="./Info.plist"
 util_dir="./Utilities"
 cli_dir="$util_dir/Command Line"
 chmodbpf_dir="$util_dir/ChmodBPF"
+exclude_prefixes="/System/|/Library/|/usr/lib/|/usr/X11/|/opt/X11/|@rpath|@executable_path"
+
 
 # "qt" or "gtk"
 ui_toolkit="gtk"
@@ -413,7 +415,14 @@ fi
 
 while $endl; do
        echo -e "Looking for dependencies. Round" $a
-       libs="`otool -L $lib_dep_search_list 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $LIBPREFIX | sort | uniq`"
+       libs="`\
+               otool -L $lib_dep_search_list 2>/dev/null \
+               | fgrep compatibility \
+               | cut -d\( -f1 \
+               | egrep -v "$exclude_prefixes" \
+               | sort \
+               | uniq \
+               `"
        cp -vn $libs "$pkglib"
        let "a+=1"
        nnfiles=`ls "$pkglib" | wc -l`
@@ -482,7 +491,15 @@ rpathify_file () {
                        # system on which the bundle will be installed,
                        # and should be referred to by their full pathnames.
                        #
-                       libs="`otool -L $1 | egrep "$LIBPREFIX.* \(compatibility" | cut -d\( -f1`"
+                       libs="`\
+                               otool -L $1 \
+                               | fgrep compatibility \
+                               | cut -d\( -f1 \
+                               | egrep -v "$exclude_prefixes" \
+                               | sort \
+                               | uniq \
+                               `"
+
                        for lib in $libs; do
                                #
                                # Get the file name of the library.
@@ -541,6 +558,10 @@ rpathify_files () {
        rpathify_dir "$pkgbin" "*"
 }
 
+if [ "$ui_toolkit" = "qt" ] ; then
+       macdeployqt "$package" -verbose=2
+fi
+
 PATHLENGTH=`echo $LIBPREFIX | wc -c`
 if [ "$PATHLENGTH" -ge "6" ]; then
        # If the LIBPREFIX path is long enough to allow 
@@ -558,8 +579,4 @@ else
 
 fi
 
-if [ "$ui_toolkit" = "qt" ] ; then
-       macdeployqt "$package" -verbose=2
-fi
-
 exit 0