File indexing completed on 2024-04-28 03:48:32

0001 #!/bin/sh
0002 #set -x
0003 # Copy Qt frameworks to marble bundle
0004 # and make search paths for them relative to bundle
0005 
0006 #
0007 # Change the next two lines to match your system
0008 #
0009 
0010 UNIVERSAL_LIBS_PREFIX=/usr/local/qgis_universal_deps
0011 APP_PREFIX=/Applications/Marble.app
0012 
0013 # Note: that if you are debugging you may want to disable the 
0014 # strip section at the end of this file.
0015 
0016 #------ You should not need to edit anything after this -----
0017 
0018 MACOS_PREFIX=${APP_PREFIX}/Contents/MacOS
0019 FRAMEWORKPREFIX=${APP_PREFIX}/Contents/Frameworks
0020 QTPREFIX=${UNIVERSAL_LIBS_PREFIX}/lib
0021 mkdir -p $MACOS_PREFIX
0022 mkdir -p $FRAMEWORKPREFIX
0023 pushd $PWD
0024 cd $FRAMEWORKPREFIX
0025 
0026 QTFRAMEWORKS="QtCore QtGui QtNetwork QtSvg QtXml"
0027 
0028 #
0029 # Copy supporting frameworks to application bundle
0030 #
0031 cd $FRAMEWORKPREFIX
0032 for FRAMEWORK in $QTFRAMEWORKS
0033 do
0034         LIBFRAMEWORK=$FRAMEWORK.framework/Versions/4/$FRAMEWORK
0035         if test ! -f $LIBFRAMEWORK; then
0036                 mkdir -p $FRAMEWORK.framework/Versions/4
0037                 cp $QTPREFIX/$LIBFRAMEWORK $LIBFRAMEWORK
0038                 install_name_tool -id @executable_path/../Frameworks/$LIBFRAMEWORK $LIBFRAMEWORK
0039         fi
0040 done
0041 
0042 # Update path to supporting frameworks
0043 for FRAMEWORK in QtGui QtNetwork QtSvg QtXml
0044 do
0045         install_name_tool -change ${QTPREFIX}/QtCore.framework/Versions/4/QtCore \
0046                 @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
0047                 $FRAMEWORK.framework/Versions/4/$FRAMEWORK
0048 done
0049 
0050 for FRAMEWORK in QtSvg
0051 do
0052         install_name_tool -change ${QTPREFIX}/QtGui.framework/Versions/4/QtGui \
0053                 @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \
0054                 $FRAMEWORK.framework/Versions/4/$FRAMEWORK
0055         install_name_tool -change ${QTPREFIX}/QtXml.framework/Versions/4/QtXml \
0056                 @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml \
0057                 $FRAMEWORK.framework/Versions/4/$FRAMEWORK
0058 done
0059 
0060 #
0061 # Update Marble related libs and binaries
0062 #
0063 
0064 cd $MACOS_PREFIX
0065 for FILE in \
0066   marble \
0067   lib/libmarblewidget.0.5.0.dylib
0068 do
0069  for FRAMEWORK in QtCore QtGui QtNetwork QtSvg QtXml 
0070         do
0071                 install_name_tool -change ${QTPREFIX}/${FRAMEWORK}.framework/Versions/4/$FRAMEWORK \
0072                         @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/4/$FRAMEWORK \
0073                         $MACOS_PREFIX/$FILE
0074         done
0075 done
0076 
0077 
0078 
0079 #
0080 # Update qt imageformat plugin paths
0081 #
0082 
0083 
0084 cd ${MACOS_PREFIX}/../
0085 mkdir -p plugins/imageformats
0086 cd plugins/imageformats
0087 
0088 LIBJPEG=libjpeg.dylib
0089 LIBQJPEG=${UNIVERSAL_LIBS_PREFIX}/plugins/imageformats/libqjpeg.dylib
0090 if test ! -f $LIBJPEG; then
0091         cp $LIBQJPEG $LIBJPEG
0092         # Update path to supporting libraries
0093         install_name_tool -change ${QTPREFIX}/QtCore.framework/Versions/4/QtCore \
0094                 @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
0095                 $LIBJPEG
0096         install_name_tool -change ${QTPREFIX}/QtGui.framework/Versions/4/QtGui \
0097                 @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \
0098                 $LIBJPEG
0099         install_name_tool -change $LIBQJPEG @executable_path/../plugins/imageformats/$LIBJPEG 
0100 fi
0101 LIBGIF=libgif.dylib
0102 LIBQGIF=${UNIVERSAL_LIBS_PREFIX}/plugins/imageformats/libqgif.dylib
0103 if test ! -f $LIBGIF; then
0104         cp $LIBQGIF $LIBGIF
0105         # Update path to supporting libraries
0106         install_name_tool -change ${QTPREFIX}/QtCore.framework/Versions/4/QtCore \
0107                 @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
0108                 $LIBGIF
0109         install_name_tool -change ${QTPREFIX}/QtGui.framework/Versions/4/QtGui \
0110                 @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \
0111                 $LIBGIF
0112         install_name_tool -change $LIBQGIF @executable_path/../plugins/imageformats/$LIBGIF 
0113 fi
0114 
0115 popd
0116 
0117 
0118 # You may want to comment out this section if you are trying to debug...
0119 # but enable it for final packaging because your bundle will be much
0120 # smaller
0121 for FRAMEWORK in $QTFRAMEWORKS
0122 do
0123   strip -x ${APP_PREFIX}/Contents/Frameworks/${FRAMEWORK}.framework/Versions/4/${FRAMEWORK}
0124 done