From e6a3a124ee4201eaae8d859db46501700f9bade1 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Thu, 1 Mar 2018 13:05:53 -0500 Subject: [PATCH] improve macos build --- .gitignore | 3 +- build_installer.bat | 2 +- clean_build.bat | 4 +-- clean_build.sh | 2 +- .../macos/bundle/build_installer.sh.in | 28 +++++++++---------- .../macos/bundle/reref_dylibs.sh | 0 6 files changed, 18 insertions(+), 21 deletions(-) rename build_osx_installer.sh => dist/macos/bundle/build_installer.sh.in (75%) rename osx_reref_dylibs.sh => dist/macos/bundle/reref_dylibs.sh (100%) diff --git a/.gitignore b/.gitignore index 4000ad56..eb253b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -winbuild_env.bat -unixbuild_env.sh +build_env.* config.h .DS_Store *.pyc diff --git a/build_installer.bat b/build_installer.bat index ac292c21..424e585a 100644 --- a/build_installer.bat +++ b/build_installer.bat @@ -19,7 +19,7 @@ goto done :buildproject echo To build a 64-bit Windows installer: -echo - set Q_BUILD_TYPE=Release in winbuild_env.bat +echo - set Q_BUILD_TYPE=Release in build_env.bat echo - also set other environmental overrides necessary for your build environment echo - run clean_build.bat to build Barrier and verify that it succeeds echo - re-run this script to create the installation package diff --git a/clean_build.bat b/clean_build.bat index 14268cd5..9aebadd8 100644 --- a/clean_build.bat +++ b/clean_build.bat @@ -1,6 +1,6 @@ @echo off -REM defaults - override them by creating a winbuild_env.bat file +REM defaults - override them by creating a build_env.bat file set B_BUILD_TYPE=Debug set B_QT_ROOT=C:\Qt set B_QT_VER=5.6.3 @@ -10,7 +10,7 @@ set B_BONJOUR=C:\Program Files\Bonjour SDK set savedir=%cd% cd /d %~dp0 -if exist winbuild_env.bat call winbuild_env.bat +if exist build_env.bat call build_env.bat REM needed by cmake to set bonjour include dir set BONJOUR_SDK_HOME=%B_BONJOUR% diff --git a/clean_build.sh b/clean_build.sh index 0c7ee516..730b21d0 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -17,7 +17,7 @@ if [ "$(uname)" = "Darwin" ]; then B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" fi # allow local customizations to build environment -[ -r ./unixbuild_env.sh ] && source ./unixbuild_env.sh +[ -r ./build_env.sh ] && source ./build_env.sh B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" rm -rf build mkdir build || exit 1 diff --git a/build_osx_installer.sh b/dist/macos/bundle/build_installer.sh.in similarity index 75% rename from build_osx_installer.sh rename to dist/macos/bundle/build_installer.sh.in index 43276af3..1fa724c7 100755 --- a/build_osx_installer.sh +++ b/dist/macos/bundle/build_installer.sh.in @@ -1,29 +1,27 @@ #!/bin/sh # change this to rename the installer package -B_DMG="Barrier-v1.9.dmg" - -cd $(dirname $0) +B_DMG="Barrier-@BARRIER_VERSION@.dmg" # sanity check so we don't distribute packages full of debug symbols -B_BUILD_TYPE=$(grep -E ^CMAKE_BUILD_TYPE build/CMakeCache.txt | cut -d= -f2) -if [ "$B_BUILD_TYPE" != "Release" ]; then +if [ "@CMAKE_BUILD_TYPE@" != "Release" ]; then echo Will only build installers for Release builds exit 1 fi -B_REREF_SCRIPT=$(pwd)/osx_reref_dylibs.sh +cd @CMAKE_CURRENT_SOURCE_DIR@/build/bundle || exit 1 + +B_REREF_SCRIPT=./reref_dylibs.sh if [ ! -x $B_REREF_SCRIPT ]; then echo Missing script: $B_REREF_SCRIPT exit 1 fi -# remove any old copies so there's no confusion about whever this +# remove any old copies so there's no confusion about whether this # process completes successfully or not -rm -rf build/bundle/{bundle.dmg,$B_DMG} +rm -rf temp.dmg $B_DMG -B_BINARY_PATH=$(pwd)/build/bin -cd build/bundle/Barrier.app/Contents 2>/dev/null +cd Barrier.app/Contents 2>/dev/null if [ $? -ne 0 ]; then echo Please make sure that the build completed successfully echo before trying to create the installer. @@ -37,7 +35,7 @@ mkdir MacOS || exit 1 cd MacOS || exit 1 # copy all executables -cp ${B_BINARY_PATH}/* . || exit 1 +cp @CMAKE_RUNTIME_OUTPUT_DIR@/* . || exit 1 # copy the qt platform plugin # TODO: this is hacky and will probably break if there is more than one qt @@ -69,11 +67,11 @@ chmod +x barrier.sh # create the DMG to be distributed in build/bundle cd ../../.. -hdiutil create -size 64m -fs HFS+ -volname "Barrier" bundle.dmg || exit 1 -hdiutil attach bundle.dmg -mountpoint mnt || exit 1 +hdiutil create -size 64m -fs HFS+ -volname "Barrier" temp.dmg || exit 1 +hdiutil attach temp.dmg -mountpoint mnt || exit 1 cp -r Barrier.app mnt/ || exit 1 hdiutil detach mnt || exit 1 -hdiutil convert bundle.dmg -format UDZO -o $B_DMG || exit 1 -rm bundle.dmg +hdiutil convert temp.dmg -format UDZO -o $B_DMG || exit 1 +rm temp.dmg echo "Installer created successfully" diff --git a/osx_reref_dylibs.sh b/dist/macos/bundle/reref_dylibs.sh similarity index 100% rename from osx_reref_dylibs.sh rename to dist/macos/bundle/reref_dylibs.sh