2007-06-24 23:01:16 +00:00
|
|
|
#!/bin/bash
|
2010-07-08 17:03:43 +00:00
|
|
|
# Author: Lothar May (originally from Erhard List)
|
2007-06-24 23:01:16 +00:00
|
|
|
|
|
|
|
|
# ATTENTION: this is for MAC only!
|
|
|
|
|
#
|
|
|
|
|
# This script integrates the necessary frameworks into the binary.
|
|
|
|
|
#
|
|
|
|
|
# The integration of Qt is optional (commandlineswitch --without-qt) as you can save 30MB
|
|
|
|
|
# of binary-size if you leave Qt out.
|
|
|
|
|
# (see http://trolltech.com/developer/downloads/qt/mac)
|
|
|
|
|
|
2019-07-29 07:38:58 +02:00
|
|
|
QT_FW_PATH="/usr/local/Cellar/qt/5.13.0/lib"
|
|
|
|
|
QT_PLUGIN_PATH="/usr/local/Cellar/qt/5.13.0/plugins"
|
2007-06-24 23:01:16 +00:00
|
|
|
SDL_FW_PATH="/Library/Frameworks"
|
2007-11-24 14:04:18 +00:00
|
|
|
APPLICATION="./pokerth.app"
|
2007-06-24 23:01:16 +00:00
|
|
|
BINARY="$APPLICATION/Contents/MacOs/pokerth"
|
2011-12-17 17:40:39 +00:00
|
|
|
RESOURCES="$APPLICATION/Contents/Resources"
|
2019-07-29 07:38:58 +02:00
|
|
|
DYLIB_PATH="$APPLICATION/Contents/MacOs/dylibs"
|
2007-06-24 23:01:16 +00:00
|
|
|
|
|
|
|
|
# strip binary
|
|
|
|
|
strip $BINARY
|
|
|
|
|
|
2011-12-17 17:40:39 +00:00
|
|
|
cp -R ./data $RESOURCES/
|
|
|
|
|
find $RESOURCES/data -name ".svn" | xargs rm -Rf
|
2007-06-24 23:01:16 +00:00
|
|
|
# create framework-path
|
|
|
|
|
BINARY_FW_PATH="$APPLICATION/Contents/Frameworks"
|
2010-07-08 17:03:43 +00:00
|
|
|
BINARY_PLUGIN_PATH="$APPLICATION/Contents/plugins"
|
2019-07-29 07:38:58 +02:00
|
|
|
|
|
|
|
|
rm -rf $BINARY_FW_PATH
|
|
|
|
|
rm -rf $BINARY_PLUGIN_PATH
|
|
|
|
|
rm -rf $DYLIB_PATH
|
|
|
|
|
|
|
|
|
|
mkdir $BINARY_FW_PATH
|
2010-07-08 17:03:43 +00:00
|
|
|
mkdir -p $BINARY_PLUGIN_PATH/imageformats
|
|
|
|
|
mkdir -p $BINARY_PLUGIN_PATH/sqldrivers
|
2013-08-31 20:28:17 +02:00
|
|
|
mkdir -p $BINARY_PLUGIN_PATH/platforms
|
2019-07-29 07:38:58 +02:00
|
|
|
mkdir -p $DYLIB_PATH
|
2007-06-24 23:01:16 +00:00
|
|
|
|
|
|
|
|
# integrate SDL-frameworks into binary
|
|
|
|
|
cp -R $SDL_FW_PATH/SDL.framework $BINARY_FW_PATH
|
|
|
|
|
cp -R $SDL_FW_PATH/SDL_mixer.framework $BINARY_FW_PATH
|
|
|
|
|
|
2019-07-29 07:38:58 +02:00
|
|
|
# integrate dylibs
|
|
|
|
|
cp /usr/lib/libcurl.4.dylib $DYLIB_PATH/.
|
2019-07-30 17:11:26 +02:00
|
|
|
cp /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib $DYLIB_PATH/.
|
2019-07-29 07:38:58 +02:00
|
|
|
cp /usr/local/opt/openssl/lib/libssl.1.0.0.dylib $DYLIB_PATH/.
|
|
|
|
|
cp /usr/lib/libsqlite3.dylib $DYLIB_PATH/.
|
|
|
|
|
cp /usr/local/opt/tinyxml/lib/libtinyxml.dylib $DYLIB_PATH/.
|
|
|
|
|
cp /usr/local/opt/protobuf/lib/libprotobuf.18.dylib $DYLIB_PATH/.
|
|
|
|
|
cp /usr/lib/libz.1.dylib $DYLIB_PATH/.
|
2007-06-24 23:01:16 +00:00
|
|
|
|
2019-07-30 17:11:26 +02:00
|
|
|
chmod -R +w $DYLIB_PATH;
|
|
|
|
|
|
2019-07-29 07:38:58 +02:00
|
|
|
LIBCURL_LINK=$(otool -L $BINARY | grep libcurl | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBCRYPTO_LINK=$(otool -L $BINARY | grep libcrypto | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBSSL_LINK=$(otool -L $BINARY | grep libssl | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBTINYXML_LINK=$(otool -L $BINARY | grep libtinyxml | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBSQLITE_LINK=$(otool -L $BINARY | grep libsqlite | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBPROTOBUF_LINK=$(otool -L $BINARY | grep libprotobuf | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBZ_LINK=$(otool -L $BINARY | grep libz | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
|
|
|
|
|
install_name_tool -change $LIBCURL_LINK @loader_path/dylibs/libcurl.4.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBCRYPTO_LINK @loader_path/dylibs/libcrypto.1.0.0.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBSSL_LINK @loader_path/dylibs/libssl.1.0.0.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBTINYXML_LINK @loader_path/dylibs/libtinyxml.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBSQLITE_LINK @loader_path/dylibs/libsqlite3.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBPROTOBUF_LINK @loader_path/dylibs/libprotobuf.18.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBSQLITE_LINK @loader_path/dylibs/libsqlite3.dylib $BINARY
|
|
|
|
|
install_name_tool -change $LIBZ_LINK @loader_path/dylibs/libz.1.dylib $BINARY
|
|
|
|
|
|
2019-07-30 17:11:26 +02:00
|
|
|
LIBCRYPTO_LINK=$(otool -L $DYLIB_PATH/libssl.1.0.0.dylib | grep libcrypto | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
LIBSSL_LINK=$(otool -L $DYLIB_PATH/libssl.1.0.0.dylib | grep libssl | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
install_name_tool -change $LIBCRYPTO_LINK @executable_path/dylibs/libcrypto.1.0.0.dylib $DYLIB_PATH/libssl.1.0.0.dylib
|
|
|
|
|
install_name_tool -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib @executable_path/dylibs/libssl.1.0.0.dylib $DYLIB_PATH/libssl.1.0.0.dylib
|
|
|
|
|
|
2019-07-29 07:38:58 +02:00
|
|
|
# integrate Qt-frameworks into binary
|
2007-06-24 23:01:16 +00:00
|
|
|
if [ "$1" != "--without-qt" ] ; then
|
2010-07-08 17:03:43 +00:00
|
|
|
cp $QT_PLUGIN_PATH/imageformats/libqgif.dylib $BINARY_PLUGIN_PATH/imageformats
|
|
|
|
|
cp $QT_PLUGIN_PATH/imageformats/libqjpeg.dylib $BINARY_PLUGIN_PATH/imageformats
|
2010-10-09 12:27:11 +00:00
|
|
|
cp $QT_PLUGIN_PATH/sqldrivers/libqsqlite.dylib $BINARY_PLUGIN_PATH/sqldrivers
|
2013-08-31 20:28:17 +02:00
|
|
|
cp $QT_PLUGIN_PATH/platforms/libqcocoa.dylib $BINARY_PLUGIN_PATH/platforms
|
2013-08-31 20:10:00 +02:00
|
|
|
cp -R $QT_FW_PATH/QtCore.framework $BINARY_FW_PATH
|
2010-07-08 17:03:43 +00:00
|
|
|
cp -R $QT_FW_PATH/QtGui.framework $BINARY_FW_PATH
|
2013-08-31 20:10:00 +02:00
|
|
|
cp -R $QT_FW_PATH/QtWidgets.framework $BINARY_FW_PATH
|
2010-07-08 17:03:43 +00:00
|
|
|
cp -R $QT_FW_PATH/QtSql.framework $BINARY_FW_PATH
|
|
|
|
|
cp -R $QT_FW_PATH/QtNetwork.framework $BINARY_FW_PATH
|
2013-08-31 21:02:41 +02:00
|
|
|
cp -R $QT_FW_PATH/QtPrintSupport.framework $BINARY_FW_PATH
|
2019-07-29 07:38:58 +02:00
|
|
|
cp -R /usr/local/Cellar/qt/5.13.0/lib/QtDBus.framework $BINARY_FW_PATH
|
|
|
|
|
chmod -R 775 $BINARY_FW_PATH
|
2010-07-08 17:03:43 +00:00
|
|
|
# remove debug versions
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtCore.framework/QtCore_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtCore.framework/QtCore_debug.prl
|
2013-08-31 19:50:40 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtCore.framework/Versions/5/QtCore_debug
|
2010-07-08 17:03:43 +00:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtGui.framework/QtGui_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtGui.framework/QtGui_debug.prl
|
2013-08-31 19:50:40 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtGui.framework/Versions/5/QtGui_debug
|
2013-08-31 20:10:00 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtWidgets.framework/QtWidgets_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtWidgets.framework/QtWidgets_debug.prl
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets_debug
|
2010-07-08 17:03:43 +00:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtSql.framework/QtSql_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtSql.framework/QtSql_debug.prl
|
2013-08-31 19:50:40 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtSql.framework/Versions/5/QtSql_debug
|
2010-07-08 17:03:43 +00:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtNetwork.framework/QtNetwork_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtNetwork.framework/QtNetwork_debug.prl
|
2013-08-31 19:50:40 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork_debug
|
2013-08-31 21:02:41 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtPrintSupport.framework/QtPrintSupport_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtPrintSupport.framework/QtPrintSupport_debug.prl
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport_debug
|
2019-07-29 07:38:58 +02:00
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtDBus.framework/QtDBus_debug
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtDBus.framework/QtDBus_debug.prl
|
|
|
|
|
rm -f $APPLICATION/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus_debug
|
2010-07-08 17:03:43 +00:00
|
|
|
|
2013-08-31 21:02:41 +02:00
|
|
|
# redirect binary to use integrated frameworks
|
2013-08-31 19:50:40 +02:00
|
|
|
QTCORE="QtCore.framework/Versions/5/QtCore"
|
|
|
|
|
QTGUI="QtGui.framework/Versions/5/QtGui"
|
2013-08-31 20:10:00 +02:00
|
|
|
QTWIDGETS="QtWidgets.framework/Versions/5/QtWidgets"
|
2013-08-31 19:50:40 +02:00
|
|
|
QTSQL="QtSql.framework/Versions/5/QtSql"
|
|
|
|
|
QTNETWORK="QtNetwork.framework/Versions/5/QtNetwork"
|
2013-08-31 21:11:09 +02:00
|
|
|
QTPRINT="QtPrintSupport.framework/Versions/5/QtPrintSupport"
|
2019-07-29 07:38:58 +02:00
|
|
|
QTDBUS="QtDBus.framework/Versions/5/QtDBus"
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTCORE
|
2013-08-31 19:50:40 +02:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QTGUI $BINARY_FW_PATH/$QTGUI
|
2013-08-31 20:10:00 +02:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QTWIDGETS $BINARY_FW_PATH/$QTWIDGETS
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QTSQL $BINARY_FW_PATH/$QTSQL
|
2013-08-31 20:10:00 +02:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QTNETWORK $BINARY_FW_PATH/$QTNETWORK
|
2013-08-31 21:02:41 +02:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QTPRINT $BINARY_FW_PATH/$QTPRINT
|
2019-07-29 07:38:58 +02:00
|
|
|
install_name_tool -id @executable_path/../Frameworks/$QDBUS $BINARY_FW_PATH/$QTDBUS
|
2010-07-08 17:03:43 +00:00
|
|
|
QTCORE_LINK=$(otool -L $BINARY | grep QtCore | cut -d"(" -f1 | cut -f2)
|
2013-08-31 19:50:40 +02:00
|
|
|
QTGUI_LINK=$(otool -L $BINARY | grep QtGui | cut -d"(" -f1 | cut -f2)
|
2013-08-31 20:10:00 +02:00
|
|
|
QTWIDGETS_LINK=$(otool -L $BINARY | grep QtWidgets | cut -d"(" -f1 | cut -f2)
|
2010-07-08 17:03:43 +00:00
|
|
|
QTSQL_LINK=$(otool -L $BINARY | grep QtSql | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
QTNETWORK_LINK=$(otool -L $BINARY | grep QtNetwork | cut -d"(" -f1 | cut -f2)
|
2019-07-29 07:38:58 +02:00
|
|
|
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY
|
2013-08-31 19:50:40 +02:00
|
|
|
install_name_tool -change $QTGUI_LINK @executable_path/../Frameworks/$QTGUI $BINARY
|
2013-08-31 20:10:00 +02:00
|
|
|
install_name_tool -change $QTWIDGETS_LINK @executable_path/../Frameworks/$QTWIDGETS $BINARY
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -change $QTSQL_LINK @executable_path/../Frameworks/$QTSQL $BINARY
|
|
|
|
|
install_name_tool -change $QTNETWORK_LINK @executable_path/../Frameworks/$QTNETWORK $BINARY
|
|
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_PLUGIN_PATH/imageformats/libqgif.dylib
|
|
|
|
|
install_name_tool -change $QTGUI_LINK @executable_path/../Frameworks/$QTGUI $BINARY_PLUGIN_PATH/imageformats/libqgif.dylib
|
2013-08-31 20:10:00 +02:00
|
|
|
install_name_tool -change $QTWIDGETS_LINK @executable_path/../Frameworks/$QTWIDGETS $BINARY_PLUGIN_PATH/imageformats/libqgif.dylib
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_PLUGIN_PATH/imageformats/libqjpeg.dylib
|
|
|
|
|
install_name_tool -change $QTGUI_LINK @executable_path/../Frameworks/$QTGUI $BINARY_PLUGIN_PATH/imageformats/libqjpeg.dylib
|
2013-08-31 20:10:00 +02:00
|
|
|
install_name_tool -change $QTWIDGETS_LINK @executable_path/../Frameworks/$QTWIDGETS $BINARY_PLUGIN_PATH/imageformats/libqjpeg.dylib
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_PLUGIN_PATH/sqldrivers/libqsqlite.dylib
|
|
|
|
|
install_name_tool -change $QTSQL_LINK @executable_path/../Frameworks/$QTSQL $BINARY_PLUGIN_PATH/sqldrivers/libqsqlite.dylib
|
2019-07-29 07:38:58 +02:00
|
|
|
|
|
|
|
|
QTDBUS_LINK=$(otool -L $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib | grep QtDBus | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
QTPRINT_LINK=$(otool -L $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib | grep QtPrintSupport | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
QTZ_LINK=$(otool -L $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib | grep libz | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
QTCORE_LINK=$(otool -L $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib | grep QtCore | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
QTGUI_LINK=$(otool -L $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib | grep QtGui | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
QTWIDGETS_LINK=$(otool -L $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib | grep QtWidgets | cut -d"(" -f1 | cut -f2)
|
2013-08-31 20:28:17 +02:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib
|
|
|
|
|
install_name_tool -change $QTGUI_LINK @executable_path/../Frameworks/$QTGUI $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib
|
|
|
|
|
install_name_tool -change $QTWIDGETS_LINK @executable_path/../Frameworks/$QTWIDGETS $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib
|
2013-08-31 21:02:41 +02:00
|
|
|
install_name_tool -change $QTPRINT_LINK @executable_path/../Frameworks/$QTPRINT $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib
|
2019-07-29 07:38:58 +02:00
|
|
|
install_name_tool -change $QTDBUS_LINK @executable_path/../Frameworks/$QTDBUS $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib
|
|
|
|
|
install_name_tool -change $QTZ_LINK @loader_path/dylibs/libz.1.dylib $BINARY_PLUGIN_PATH/platforms/libqcocoa.dylib
|
|
|
|
|
|
|
|
|
|
QTCORE_LINK=$(otool -L $BINARY_FW_PATH/$QTDBUS | grep QtCore | head -1 | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTDBUS
|
2010-07-08 17:03:43 +00:00
|
|
|
|
|
|
|
|
QTCORE_LINK=$(otool -L $BINARY_FW_PATH/$QTGUI | grep QtCore | head -1 | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTGUI
|
2013-08-31 20:10:00 +02:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTWIDGETS
|
2010-07-08 17:03:43 +00:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTSQL
|
|
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTNETWORK
|
2013-08-31 21:02:41 +02:00
|
|
|
install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTPRINT
|
2010-07-08 17:03:43 +00:00
|
|
|
|
2013-08-31 21:11:09 +02:00
|
|
|
QTGUI_LINK=$(otool -L $BINARY_FW_PATH/$QTWIDGETS | grep QtGui | cut -d"(" -f1 | cut -f2)
|
2013-08-31 21:02:41 +02:00
|
|
|
install_name_tool -change $QTGUI_LINK @executable_path/../Frameworks/$QTGUI $BINARY_FW_PATH/$QTWIDGETS
|
|
|
|
|
install_name_tool -change $QTGUI_LINK @executable_path/../Frameworks/$QTGUI $BINARY_FW_PATH/$QTPRINT
|
|
|
|
|
|
2013-08-31 21:11:09 +02:00
|
|
|
QTWIDGETS_LINK=$(otool -L $BINARY_FW_PATH/$QTPRINT | grep QtWidgets | cut -d"(" -f1 | cut -f2)
|
|
|
|
|
install_name_tool -change $QTWIDGETS_LINK @executable_path/../Frameworks/$QTWIDGETS $BINARY_FW_PATH/$QTPRINT
|
2007-11-24 14:04:18 +00:00
|
|
|
fi
|