Mercurial > hg > easyhg
changeset 667:0f3e086066fc qt5
Start reworking deployment scripts
author | Chris Cannam |
---|---|
date | Fri, 27 May 2016 09:56:22 +0100 |
parents | 98a7fbbe9d88 |
children | a5127c696880 |
files | deploy/osx/build-all.sh deploy/osx/combine.sh deploy/osx/deploy.sh deploy/osx/extract-leopard.sh deploy/osx/paths.sh |
diffstat | 5 files changed, 58 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/deploy/osx/build-all.sh Fri May 27 09:55:56 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#!/bin/bash - -# Carbon (10.4+ PPC/i386). -# -$HOME/qt-builds/qt-471-carbon-10.4u/bin/qmake -spec macx-g++40 || exit -make clean && make && \ - cp EasyMercurial.app/Contents/MacOS/EasyMercurial \ - EasyMercurial.carbon.app/Contents/MacOS/ && \ - bash deploy/osx/paths.sh EasyMercurial.carbon - -# Cocoa (10.6+ x86_64) -# -/usr/bin/qmake -spec macx-g++ || exit -make clean && make && \ - cp EasyMercurial.app/Contents/MacOS/EasyMercurial \ - EasyMercurial.cocoa.app/Contents/MacOS/ && \ - bash deploy/osx/paths.sh EasyMercurial.cocoa - -# Complicated lipo business -# -bash deploy/osx/combine.sh || exit 1 - -# Info.plist etc and make dmg -bash deploy/osx/deploy.sh EasyMercurial.app EasyMercurial - - - -
--- a/deploy/osx/combine.sh Fri May 27 09:55:56 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -#!/bin/bash -app=EasyMercurial -if [ ! -d "$app.carbon.app" ] || [ ! -d "$app.cocoa.app" ]; then - echo Carbon or Cocoa bundle not found - exit 1 -fi -(cd "$app.cocoa.app" ; find . -type f -print) | while read f; do - d=$(dirname "$f") - mkdir -p "$app.app/$d" - case $(file "$app.cocoa.app/$f") in - *universal*x86_64*) - lipo "$app.cocoa.app/$f" -extract x86_64 -output "/tmp/$$.x86_64";; - *x86_64*) - lipo "$app.cocoa.app/$f" -create -output "/tmp/$$.x86_64";; - *) - cp "$app.cocoa.app/$f" "$app.app/$f" - continue;; - esac - case $(file "$app.carbon.app/$f") in - *x86_64*) - lipo "$app.carbon.app/$f" -remove x86_64 -output "/tmp/$$.rest" - ;; - *universal*) - cp "$app.carbon.app/$f" "/tmp/$$.rest" - ;; - *) - lipo "$app.carbon.app/$f" -create -output "/tmp/$$.rest" - ;; - esac - lipo "/tmp/$$.x86_64" "/tmp/$$.rest" -create -output "$app.app/$f" - rm "/tmp/$$".* -done - -
--- a/deploy/osx/deploy.sh Fri May 27 09:55:56 2016 +0100 +++ b/deploy/osx/deploy.sh Fri May 27 09:56:22 2016 +0100 @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # Execute this from the top-level directory of the project (the one # that contains the .app bundle). Supply the name of the .app bundle # as argument (the target will use $app.app regardless, but we need @@ -13,6 +15,8 @@ fi app=EasyMercurial +set -u + version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h` case "$version" in [0-9].[0-9]) bundleVersion="$version".0 ;; @@ -21,6 +25,30 @@ esac echo +echo "Copying in frameworks and plugins from Qt installation directory." + +deploy/osx/copy-qt.sh "$app" || exit 2 + +echo +echo "Fixing up paths." + +deploy/osx/paths.sh "$app" + +echo +echo "Copying in qt.conf to set local-only plugin paths." +echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*" +echo "You probably want platforms/, accessible/ and imageformats/ subdirectories." +cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf + +echo "Writing version $bundleVersion in to bundle." +echo "(This should be a three-part number: major.minor.point)" + +perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ + > "$source"/Contents/Info.plist + +echo "Done: check $source/Contents/Info.plist for sanity please" + +echo echo "Making target tree." volume="$app"-"$version" @@ -31,17 +59,11 @@ ln -s /Applications "$volume"/Applications cp COPYING "$volume/COPYING.txt" -cp -RPp "$source" "$target" +cp -rp "$source" "$target" echo "Done" -echo "Writing version $bundleVersion in to bundle." -echo "(This should be a three-part number: major.minor.point)" - -perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ - > "$target"/Contents/Info.plist - -echo "Done: check $target/Contents/Info.plist for sanity please" +deploy/osx/sign.sh "$volume" || exit 1 echo echo "Making dmg..."
--- a/deploy/osx/extract-leopard.sh Fri May 27 09:55:56 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -mkdir -p 10.5/src -cd 10.5 -cp -a ../EasyMercurial.app . -lipo ../EasyMercurial.app/Contents/MacOS/EasyMercurial -remove x86_64 -output ./EasyMercurial.app/Contents/MacOS/EasyMercurial -cp -a ../src/version.h src/ -cp -a ../COPYING . -bash ../deploy/osx/deploy.sh EasyMercurial.app EasyMercurial_leopard -cp *_leopard*.dmg .. -cd .. -rm -r 10.5 -echo Done - -
--- a/deploy/osx/paths.sh Fri May 27 09:55:56 2016 +0100 +++ b/deploy/osx/paths.sh Fri May 27 09:56:22 2016 +0100 @@ -1,5 +1,7 @@ #!/bin/bash +set -e + app="$1" if [ -z "$app" ]; then echo "Usage: $0 <appname>" @@ -7,21 +9,29 @@ exit 2 fi +set -u + +frameworks="QtCore QtNetwork QtGui QtWidgets QtPrintSupport QtDBus" + echo -echo "I expect you to have already copied QtCore, QtNetwork and QtGui to " -echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to " -echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing" +echo "I expect you to have already copied these frameworks from the Qt installation to" +echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing:" +echo "$frameworks" echo echo "Fixing up loader paths in binaries..." -install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore" -install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui" -install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" +for fwk in $frameworks; do + install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk" +done -for fwk in QtCore QtGui QtNetwork; do +find "$app.app" -name \*.dylib -print | while read x; do + install_name_tool -id "`basename \"$x\"`" "$x" +done + +for fwk in $frameworks; do find "$app.app" -type f -print | while read x; do - current=$(otool -L "$x" | grep "$fwk" | grep ramework | awk '{ print $1; }') + current=$(otool -L "$x" | grep "$fwk" | grep amework | grep -v ':$' | awk '{ print $1; }') [ -z "$current" ] && continue echo "$x has $current" relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ @@ -31,6 +41,16 @@ done done +find "$app.app" -type f -print | while read x; do + qtdep=$(otool -L "$x" | grep Qt | grep amework | grep -v ':$' | grep -v '@loader_path' | awk '{ print $1; }') + if [ -n "$qtdep" ]; then + echo + echo "ERROR: File $x depends on Qt framework(s) not apparently present in the bundle:" + echo $qtdep + exit 1 + fi +done + echo "Done: be sure to run the app and see that it works!"