package: use @rpath based library loading for MacOSX
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 1 Jun 2016 06:57:34 +0000 (15:57 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 2 Jun 2016 08:08:43 +0000 (17:08 +0900)
Change-Id: I9b46d17b2e976c10009e8274f1fb5ffc918420a0
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
package/build.macos

index 8caf6d6..1968f31 100755 (executable)
@@ -24,36 +24,12 @@ build()
 # install
 install()
 {
+       # add @rpath into binaries
+       for file in $(find "$SRCDIR/tizen/emulator/bin" -type f -exec file -F ' ' {} \; | grep "Mach-O" | grep "executable" | awk '{print $1}')
+       do
+               install_name_tool -add_rpath "@executable_path" "$file"
+       done
+
        . $SRCDIR/package/build.common
        install_common
-
-       EMULATOR_BIN_DIR=$EMULATOR_X86_DIR/emulator/bin
-
-       # change loading path of dynamic shared libraries on MAC OS X
-       if [ "${TARGET_OS}" = "macos-64" ]; then
-               LIB_LIST="libgthread-2.0.0.dylib libglib-2.0.0.dylib libintl.8.dylib libx264.142.dylib libpixman-1.0.dylib libpng16.16.dylib QtOpenGL QtWidgets QtGui QtCore QtPrintSupport"
-               BIN_ARR=( emulator-x86_64 qt5_msgbox )
-               for bin in ${BIN_ARR[@]}; do
-                       LIB_ARR=( $(otool -L ${EMULATOR_BIN_DIR}/$bin | awk '/\opt\/local\/lib/ { split($1, lib, "/"); print lib[5]}') )
-                       for lib in ${LIB_ARR[@]}; do
-                       [[ $LIB_LIST =~ $lib ]] && IS_LIB=true || IS_LIB=false
-                       if [ "$IS_LIB" == "true" ] ; then
-                               install_name_tool -change /opt/local/lib/$lib @loader_path/$lib ${EMULATOR_BIN_DIR}/$bin
-                               echo "$bin: the loading path of $lib is changed."
-                       else
-                               echo "$bin: $lib does not exist in the loading path."
-                       fi
-                       done
-                       LIB_ARR=( $(otool -L ${EMULATOR_BIN_DIR}/$bin | awk '/\opt\/local\/Library/ { split($1, lib, "/"); print lib[9]}') )
-                       for lib in ${LIB_ARR[@]}; do
-                               [[ $LIB_LIST =~ $lib ]] && IS_LIB=true || IS_LIB=false
-                               if [ "$IS_LIB" == "true" ] ; then
-                                       install_name_tool -change /opt/local/Library/Frameworks/$lib.framework/Versions/5/$lib @loader_path/$lib ${EMULATOR_BIN_DIR}/$bin
-                                       echo "$bin: the loading path of $lib is changed."
-                               else
-                                       echo "$bin: $lib does not exist in the loading path."
-                               fi
-                       done
-               done
-       fi
 }