From e15ba2219d370bad8c1d9ed4bd11e0e3f46d2013 Mon Sep 17 00:00:00 2001 From: DominikDeak Date: Mon, 20 Jul 2020 18:30:24 +1000 Subject: [PATCH] Work on macOS scripts. Work on documentation. --- Documentation/BuildMacOS.md | 5 +++- Documentation/BuildWindows.md | 2 +- Documentation/HelpMacOS.txt | 4 ++-- buildMacOS.sh | 44 ++++++++++++++++++++++++++--------- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/Documentation/BuildMacOS.md b/Documentation/BuildMacOS.md index e1dc80a..232b6a6 100644 --- a/Documentation/BuildMacOS.md +++ b/Documentation/BuildMacOS.md @@ -7,7 +7,10 @@ * [Homebrew](http://brew.sh/) * [XCode](https://developer.apple.com/xcode/download/) * [Qt 5](https://www.qt.io/download), select the following components: - * Qt 5.12.9, MSVC 2017 64-bit + * Qt 5.12.9 / macOS + + + 2. Use Homebrew to install additional tools and libraries: diff --git a/Documentation/BuildWindows.md b/Documentation/BuildWindows.md index a9758c2..0132cb4 100644 --- a/Documentation/BuildWindows.md +++ b/Documentation/BuildWindows.md @@ -13,7 +13,7 @@ * WiX Toolset Build Tools * WiX Toolset Visual Studio 2019 Extension * [Qt 5](https://www.qt.io/download), select the following components: - * Qt 5.12.9, MSVC 2017 64-bit + * Qt 5.12.9 / MSVC 2017 64-bit 2. Edit the `buildWindows.cmd` script and make sure the following script variables are configured properly: diff --git a/Documentation/HelpMacOS.txt b/Documentation/HelpMacOS.txt index 9d62f05..ad08744 100644 --- a/Documentation/HelpMacOS.txt +++ b/Documentation/HelpMacOS.txt @@ -11,8 +11,8 @@ DESCRIPTION -h, --help Display this help message. - --cmake - Build binaries only with CMake. + --app + Build the application bundle. --dmg Build a DMG disk image file. diff --git a/buildMacOS.sh b/buildMacOS.sh index ae3b5d9..5ba1002 100755 --- a/buildMacOS.sh +++ b/buildMacOS.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Path to the Qt library, clang, 64-bit build. +libQtPath="~/Qt5.12.9/5.12.9/clang_64" + upstreamURL="https://github.com/DEAKSoftware/Synergy-Binaries.git" queriedURL="$( git config --get remote.origin.url )" toplevelPath="$( git rev-parse --show-toplevel )" @@ -17,46 +20,65 @@ binariesPath="${toplevelPath}/Binaries" toolsPath="${toplevelPath}/Tools" + configureSubmodules() { git submodule update --init --remote --recursive } +configureQt() { + + export PATH="${libQtPath}:$PATH" + +} + configureCMake() { - cmake -S "${synergyCorePath}" -B "${buildPath}" -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON || exit 1 + cmake -S "${synergyCorePath}" -B "${buildPath}" \ + -D CMAKE_OSX_DEPLOYMENT_TARGET=10.12 \ + -D CMAKE_OSX_ARCHITECTURES=x86_64 \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CONFIGURATION_TYPES=Release \ + -D SYNERGY_ENTERPRISE=ON || exit 1 } configureVersion() { - source /etc/os-release || exit 1 - linuxVersion="${ID}${VERSION_ID}" - source "${buildPath}/version" synergyVersion="${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}" - synergyVersionStage="${SYNERGY_VERSION_STAGE}" + synergyReleaseName="synergy-${synergyVersion}-macos-x64" } configure() { configureSubmodules + configureQt configureCMake configureVersion } +buildApp() { + + pushd "${buildPath}" || exit 1 -buildCMake() { + make -j || exit 1 + make install/strip || exit 1 - cmake --build "${buildPath}" --parallel 8 || exit 1 + macdeployqt "${buildPath}/bundle/Synergy.app" + ln -s /Applications "${buildPath}/bundle/Applications" + + popd } buildDMG() { - echo . + mv "${buildPath}/bundle/Synergy.app" "${buildPath}/bundle/Synergy-test.app" + + hdiutil create -volname "Synergy ${synergyVersion}" -srcfolder "${buildPath}/bundle" -ov -format UDZO "${binariesPath}/${synergyReleaseName}.dmg" || exit 1 } @@ -80,10 +102,10 @@ if [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then cat "${toplevelPath}/Documentation/HelpMacOS.txt" -elif [ "${1}" = "--cmake" ]; then +elif [ "${1}" = "--app" ]; then configure - buildCMake + buildApp elif [ "${1}" = "--dmg" ]; then @@ -93,7 +115,7 @@ elif [ "${1}" = "--dmg" ]; then elif [ "${1}" = "--all" ]; then configure - buildCMake + buildApp buildDMG elif [ "${1}" = "--clean" ]; then