From 621ed8ff28d0fde7e946d4b08022497749acacae Mon Sep 17 00:00:00 2001 From: Marti Martz Date: Sat, 18 Mar 2017 09:48:11 -0600 Subject: [PATCH] Mac: Create the `bundle` target and modify affected shell scripts (#2260) --- .travis.yml | 2 +- BUILDING.md | 8 ++------ QupZilla.pro | 6 ++++++ README.md | 4 +--- mac/create_dmg.sh | 2 +- mac/macdeploy.sh | 42 ++++++++++++++++++++---------------------- 6 files changed, 31 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2735f68e4..62270e26e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,7 +69,7 @@ script: before_deploy: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd $QZ_DIR; - ./mac/macdeploy.sh $MACDEPLOYQT; + make bundle; mv bin/QupZilla.dmg bin/QupZilla-${QZ_VER}.dmg; fi diff --git a/BUILDING.md b/BUILDING.md index 891e19517..aa10cde24 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -47,13 +47,9 @@ MAC OS X You need to have Xcode from the Apple App Store installed in Applications, [Command Line Tools for the same Xcode version](https://developer.apple.com/) may be included depending on the version, [Homebrew](http://brew.sh/), and `$ brew install openssl` for openssl. Next compulsory requirement is Qt 5 (>= 5.8) with QtWebEngine. - After successful compilation, you need to build the application bundle and follow any - instructions that may be presented. You will do it with following command: + After successful compilation, you need to build the application bundle. You will do it with following command: - $ ./mac/macdeploy.sh [] - - You need to specify path to macdeployqt (usually in QTDIR/bin/macdeployqt) only - if it is not in PATH. + $ make bundle FreeBSD ---------------------------------------------------------------------------------- diff --git a/QupZilla.pro b/QupZilla.pro index 7ba2464ad..72b8eb7f2 100644 --- a/QupZilla.pro +++ b/QupZilla.pro @@ -29,3 +29,9 @@ src_plugins.subdir = src/plugins src_plugins.depends = sub-src-lib SUBDIRS += src_lib src_main src_plugins + +mac: { + macdeploysh.target = bundle + macdeploysh.commands = mac/macdeploy.sh $$[QT_INSTALL_BINS]/macdeployqt + QMAKE_EXTRA_TARGETS += macdeploysh +} diff --git a/README.md b/README.md index e9de0ba8c..dfa4cebc8 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,7 @@ On Linux/Unix: To install QupZilla, run this command: (it may be necessary to ru On Mac OS X: To deploy QupZilla in dmg image, run this command: - $ ./mac/macdeploy.sh full-path-to-macdeployqt - -You need to specify path to `macdeployqt` only if it is not in PATH. + $ make bundle Current version ---------------------------------------------------------------------------------------- diff --git a/mac/create_dmg.sh b/mac/create_dmg.sh index b741b5ad8..38e0a8f8e 100755 --- a/mac/create_dmg.sh +++ b/mac/create_dmg.sh @@ -45,7 +45,7 @@ hdiutil create -size 200m "$TMP/$WORK_TEMPLATE" -type SPARSE -fs HFS+ -volname " cp -fpR "$BUNDLE_PATH/QupZilla.app/Contents" "$TMP/$VOLUME_TEMPLATE/QupZilla.app" echo "Blessing folder to automatically open on mount…" - bless -folder "$TMP/$VOLUME_TEMPLATE" --openfolder "$TMP/$VOLUME_TEMPLATE" + bless --folder "$TMP/$VOLUME_TEMPLATE" --openfolder "$TMP/$VOLUME_TEMPLATE" echo "Detaching working disk image template from write…" hdiutil detach "$TMP/$VOLUME_TEMPLATE" diff --git a/mac/macdeploy.sh b/mac/macdeploy.sh index 88bb84257..3ecfed2b4 100755 --- a/mac/macdeploy.sh +++ b/mac/macdeploy.sh @@ -1,19 +1,20 @@ #!/bin/bash # -# Usage: ./macdeploy.sh [] +# Usage: ./macdeploy.sh # # macdeployqt is usually located in QTDIR/bin/macdeployqt -# If path to macdeployqt is not specified, using it from PATH -MACDEPLOYQT="macdeployqt" +if [ -z "$1" ]; then + echo "Required parameter missing for full path to macdeployqt" + exit 1 +fi + +MACDEPLOYQT=$1 +QTDIR="`dirname $MACDEPLOYQT`/.." LIBRARY_NAME="libQupZilla.2.dylib" PLUGINS="QupZilla.app/Contents/Resources/plugins" QTPLUGINS="QupZilla.app/Contents/PlugIns" -if [ -n "$1" ]; then - MACDEPLOYQT=$1 -fi - # cd to directory with bundle test -d bin || cd .. cd bin @@ -34,22 +35,19 @@ do install_name_tool -change $LIBRARY_NAME @executable_path/$LIBRARY_NAME $plugin done -if [ -z ${QTDIR+x} ]; then - printf '\nPlease set the environment variable for the Qt platform folder.\n\texample:\n\t$ export QTDIR="$HOME/Qt/5.8/clang_64"\n' - exit 1 +# copy known, missing, Qt native library plugins into bundle +# +# See: +# * http://code.qt.io/cgit/qt/qttools.git/tree/src/macdeployqt/shared/shared.cpp#n1044 +# +mkdir -p $QTPLUGINS + +FILE="$QTDIR/plugins/iconengines/libqsvgicon.dylib" +if [ -f "$FILE" ]; then + cp $FILE $QTPLUGINS/ else - printf '\nCopying known, missing, Qt native library plugins to target bundle...\n' - - mkdir -p $QTPLUGINS - - FILE="$QTDIR/plugins/iconengines/libqsvgicon.dylib" - if [ -f "$FILE" ]; then - cp $FILE $QTPLUGINS/ - else - echo "$FILE: No such file" - exit 1 - fi - + echo "$FILE: No such file" + exit 1 fi # run macdeployqt