improve macos build

This commit is contained in:
walker0643 2018-03-01 13:05:53 -05:00
parent 786d513379
commit e6a3a124ee
6 changed files with 18 additions and 21 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
winbuild_env.bat build_env.*
unixbuild_env.sh
config.h config.h
.DS_Store .DS_Store
*.pyc *.pyc

View File

@ -19,7 +19,7 @@ goto done
:buildproject :buildproject
echo To build a 64-bit Windows installer: 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 - also set other environmental overrides necessary for your build environment
echo - run clean_build.bat to build Barrier and verify that it succeeds echo - run clean_build.bat to build Barrier and verify that it succeeds
echo - re-run this script to create the installation package echo - re-run this script to create the installation package

View File

@ -1,6 +1,6 @@
@echo off @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_BUILD_TYPE=Debug
set B_QT_ROOT=C:\Qt set B_QT_ROOT=C:\Qt
set B_QT_VER=5.6.3 set B_QT_VER=5.6.3
@ -10,7 +10,7 @@ set B_BONJOUR=C:\Program Files\Bonjour SDK
set savedir=%cd% set savedir=%cd%
cd /d %~dp0 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 REM needed by cmake to set bonjour include dir
set BONJOUR_SDK_HOME=%B_BONJOUR% set BONJOUR_SDK_HOME=%B_BONJOUR%

View File

@ -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" 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 fi
# allow local customizations to build environment # 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" B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS"
rm -rf build rm -rf build
mkdir build || exit 1 mkdir build || exit 1

View File

@ -1,29 +1,27 @@
#!/bin/sh #!/bin/sh
# change this to rename the installer package # change this to rename the installer package
B_DMG="Barrier-v1.9.dmg" B_DMG="Barrier-@BARRIER_VERSION@.dmg"
cd $(dirname $0)
# sanity check so we don't distribute packages full of debug symbols # 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 [ "@CMAKE_BUILD_TYPE@" != "Release" ]; then
if [ "$B_BUILD_TYPE" != "Release" ]; then
echo Will only build installers for Release builds echo Will only build installers for Release builds
exit 1 exit 1
fi 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 if [ ! -x $B_REREF_SCRIPT ]; then
echo Missing script: $B_REREF_SCRIPT echo Missing script: $B_REREF_SCRIPT
exit 1 exit 1
fi 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 # 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 Barrier.app/Contents 2>/dev/null
cd build/bundle/Barrier.app/Contents 2>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo Please make sure that the build completed successfully echo Please make sure that the build completed successfully
echo before trying to create the installer. echo before trying to create the installer.
@ -37,7 +35,7 @@ mkdir MacOS || exit 1
cd MacOS || exit 1 cd MacOS || exit 1
# copy all executables # copy all executables
cp ${B_BINARY_PATH}/* . || exit 1 cp @CMAKE_RUNTIME_OUTPUT_DIR@/* . || exit 1
# copy the qt platform plugin # copy the qt platform plugin
# TODO: this is hacky and will probably break if there is more than one qt # 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 # create the DMG to be distributed in build/bundle
cd ../../.. cd ../../..
hdiutil create -size 64m -fs HFS+ -volname "Barrier" bundle.dmg || exit 1 hdiutil create -size 64m -fs HFS+ -volname "Barrier" temp.dmg || exit 1
hdiutil attach bundle.dmg -mountpoint mnt || exit 1 hdiutil attach temp.dmg -mountpoint mnt || exit 1
cp -r Barrier.app mnt/ || exit 1 cp -r Barrier.app mnt/ || exit 1
hdiutil detach mnt || exit 1 hdiutil detach mnt || exit 1
hdiutil convert bundle.dmg -format UDZO -o $B_DMG || exit 1 hdiutil convert temp.dmg -format UDZO -o $B_DMG || exit 1
rm bundle.dmg rm temp.dmg
echo "Installer created successfully" echo "Installer created successfully"