]> git.sur5r.net Git - fstl/blobdiff - app/package.sh
New upstream version 0.9.3
[fstl] / app / package.sh
index d51c470818b0589e07721a0663d78d678be8c522..bdb4999a91d18306e453a66f17056394719f1abd 100755 (executable)
@@ -1,14 +1,53 @@
 #!/bin/sh
+set -x -e
+
 cd ../build
-macdeployqt fstl.app
+make clean
+rm -rf fstl.app
+make -j8
+
+APP=fstl
+
+# Pull out framework paths info with otool
+MACDEPLOYQT=`otool -L $APP.app/Contents/MacOS/fstl | sed -n -e "s:\(.*\)lib/QtCore.*:\1/bin/macdeployqt:gp"`
+
+$MACDEPLOYQT $APP.app
+
+# Delete unused Qt plugins
 cd fstl.app/Contents/PlugIns
 rm -rf accessible audio imageformats mediaservice playlistformats position printsupport qml1tooling sensorgestures sensors
-cd ../Frameworks
-rm -rf QtDeclarative.framework QtMultimedia.framework QtMultimediaWidgets.framework QtNetwork.framework QtPositioning.framework QtQml.framework QtQuick.framework QtScript.framework QtSensors.framework QtSql.framework QtXmlPatterns.framework
+
+fix_qt () {
+    echo "Fixing Qt for $1"
+    for LIB in $( otool -L $1 | sed -n -e "s:\(.*Qt.*.framework[^ ]*\).*:\1:gp" )
+    do
+        RENAMED=`echo $LIB | sed -n -e "s:.*\(Qt.*\)\.framework.*:@executable_path/../Frameworks/\1.framework/Versions/5/\1:gp"`
+        install_name_tool -change $LIB $RENAMED $1
+    done
+}
+
+# Remap platform links
+cd platforms
+fix_qt libqcocoa.dylib
+
+# Delete unused Qt frameworks
+cd ../../Frameworks
+rm -rf QtDeclarative.framework QtMultimedia.framework QtMultimediaWidgets.framework QtNetwork.framework QtPositioning.framework QtQml.framework QtQuick.framework QtScript.framework QtSensors.framework QtSql.framework QtXmlPatterns.framework Qt3DCore.framework Qt3DRender.framework QtLocation.framework QtSerialBus.framework QtSerialPort.framework
+
+# Clean up remaining Qt frameworks
+for LIB in $( ls|sed -n -e "s:\(Qt.*\)\.framework:\1:gp" )
+do
+    fix_qt $LIB.framework/Versions/Current/$LIB
+done
+
 cd ../Resources
 rm empty.lproj
-cd ../../..
-cp -r fstl.app ..
-cd ..
-zip -r fstl_mac.zip fstl.app README.md
 
+# Create a disk image
+cd ../../..
+mkdir $APP
+cp ../README.md ./$APP/README.txt
+cp -R $APP.app ./$APP
+hdiutil create $APP.dmg -volname "$APP" -srcfolder $APP
+rm -rf $APP
+mv $APP.dmg ..