Merge branch 'next' into corvuscorax/OP-1156_pathfollower-unification
[librepilot.git] / package / osx / libraries
blob5370158843b005ca612623ca26def8431b276e82
1 #!/bin/bash
3 APP="${1?}"
4 PLUGINS="${APP}/Contents/Plugins"
5 OP_PLUGINS="${APP}/Contents/Plugins/OpenPilot"
6 QT_LIBS="QtCore QtGui QtMultimedia QtMultimediaWidgets QtNetwork QtOpenGL QtPrintSupport QtQml QtQuick QtScript QtSerialPort QtSql QtSvg QtWidgets QtV8 QtXml"
7 QT_DIR=$(otool -L "${APP}/Contents/MacOS/OpenPilot GCS" | sed -n -e 's/\/QtCore\.framework.*//p' | sed -n -E 's:^.::p')
8 QT_EXTRA="accessible/libqtaccessiblewidgets.dylib bearer/libqgenericbearer.dylib imageformats/libqgif.dylib imageformats/libqico.dylib imageformats/libqjpeg.dylib imageformats/libqmng.dylib imageformats/libqtiff.dylib imageformats/libqsvg.dylib qmltooling/libqmldbg_tcp.dylib sqldrivers/libqsqlodbc.dylib sqldrivers/libqsqlpsql.dylib sqldrivers/libqsqlite.dylib imageformats/libqtga.dylib iconengines/libqsvgicon.dylib"
10 OSG_EXTRA="libosgViewer.90.dylib"
12 if [ -z "${QT_DIR}" ]
13 then
14 # QT_DIR is empty, then we have (presumably):
15 QT_FRAMEWORKS="/Library/Frameworks"
16 QT_PLUGINS="/Developer/Applications/Qt/plugins"
17 else
18 # Typical Nokia SDK paths
19 QT_FRAMEWORKS="${QT_DIR}"
20 QT_PLUGINS="${QT_DIR}/../plugins"
21 QT_DIR="${QT_DIR}/"
24 echo "Qt library directory is \"${QT_DIR}\""
26 echo "Running macdeployqt from ${QT_DIR}../bin/macdeployqt"
28 "${QT_DIR}../bin/macdeployqt" "${APP}" -no-strip -verbose=2
30 #Append Qml2Imports config to qt.conf
31 echo "Qml2Imports = Imports" >> "${APP}/"Contents/Resources/qt.conf
33 echo "Processing Qt libraries paths in ${APP}"
34 for f in "${PLUGINS}/"*.dylib "${OP_PLUGINS}/"*.dylib "${APP}/"Contents/Imports/QtQuick.2/*.dylib "${APP}/"Contents/Imports/QtQuick/*/*.dylib
36 if [ -f "${f}" ] && [ ! -L "${f}" ]
37 then
38 # Only process plain files
39 chmod +w "${f}"
40 echo "* ${f}"
41 for g in $QT_LIBS
43 install_name_tool -change \
44 "${QT_DIR}${g}.framework/Versions/5/${g}" \
45 @executable_path/../Frameworks/${g}.framework/Versions/5/${g} \
46 "${f}"
47 done
48 chmod -w "${f}"
50 done
52 echo "Copying SDL"
53 cp -a "/Library/Frameworks/SDL.framework" "${APP}/Contents/Frameworks/"
54 chmod +w "${APP}/Contents/Plugins/libsdlgamepad.1.dylib"
55 chmod +w "${APP}/Contents/Frameworks/SDL.framework/SDL"
56 echo "Changing package identification of SDL"
57 install_name_tool -id \
58 @executable_path/../Frameworks/SDL.framework/SDL \
59 "${APP}/Contents/Frameworks/SDL.framework/SDL"
60 install_name_tool -change \
61 @rpath/SDL.framework/Versions/A/SDL \
62 "@executable_path/../Frameworks/SDL.framework/SDL" \
63 "${APP}/Contents/Plugins/libsdlgamepad.1.dylib"
64 chmod -w "${APP}/Contents/Plugins/libsdlgamepad.1.dylib"
65 chmod -w "${APP}/Contents/Frameworks/SDL.framework/SDL"
67 # deleting unnecessary files
68 echo "Deleting unnecessary files"
69 find "${APP}/Contents/Frameworks" -iname "*_debug" -exec rm -rf \{\} \;