Merge pull request #648 from simons-public/use-macdeployqt

Use macdeployqt
This commit is contained in:
Dom Rodriguez 2020-05-06 18:48:53 +01:00 committed by GitHub
commit 675a17d6e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 10 deletions

View File

@ -400,12 +400,10 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
configure_files (${BARRIER_BUNDLE_SOURCE_DIR} ${BARRIER_BUNDLE_DIR}) configure_files (${BARRIER_BUNDLE_SOURCE_DIR} ${BARRIER_BUNDLE_DIR})
if (CMAKE_BUILD_TYPE STREQUAL "Release") add_custom_target(Barrier_MacOS ALL
add_custom_target(Barrier_dmg ALL bash build_dist.sh
bash build_installer.sh
DEPENDS barrier barriers barrierc DEPENDS barrier barriers barrierc
WORKING_DIRECTORY ${BARRIER_BUNDLE_DIR}) WORKING_DIRECTORY ${BARRIER_BUNDLE_DIR})
endif()
endif() endif()
# #

View File

@ -82,11 +82,16 @@ jobs:
Release: Release:
B_BUILD_TYPE: Release B_BUILD_TYPE: Release
BARRIER_VERSION_STAGE: Release BARRIER_VERSION_STAGE: Release
variables:
VERBOSE: 1
TERM: xterm-256color
steps: steps:
- script: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aac86fc018c48d7b6f23a2e7535276899774567a/Formula/qt.rb - script: rm -rf /usr/local/opt/openssl
displayName: Installed Pinned Qt displayName: Remove incompatible OpenSSL 1.0.2t from macOS-10.14 vmImage
- script: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aac86fc018c48d7b6f23a2e7535276899774567a/Formula/openssl.rb - script: brew reinstall openssl
displayName: Installed Pinned OpenSSL displayName: Installed newer OpenSSL 1.1.x
- script: brew install pkg-config qt5
displayName: Install Qt5 and pkg-config prereqs
- script: sh -x ./clean_build.sh - script: sh -x ./clean_build.sh
displayName: Clean Build displayName: Clean Build
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1

73
dist/macos/bundle/build_dist.sh.in vendored Executable file
View File

@ -0,0 +1,73 @@
#!/bin/sh
# Use the same verbose variable as CMake
[ "$VERBOSE" == "1" ] && set -x
# Exit on unset variables or pipe errors
set -uo pipefail
B_MACOS="Barrier.app/Contents/MacOS"
B_VERSION="@BARRIER_VERSION@"
B_BINDIR="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"
B_BUILDTYPE="@CMAKE_BUILD_TYPE@"
B_BARRIERC="Barrier.app/Contents/MacOS/barrierc"
B_BARRIERS="Barrier.app/Contents/MacOS/barriers"
# Colorized output
function info() { tput bold; echo "$@" ; tput sgr0 ;}
function error() { tput bold; tput setaf 1; echo "$@"; tput sgr0 ; }
function success() { tput bold; tput setaf 2; echo "$@"; tput sgr0 ; }
function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
info "Checking for bundle contents"
if [ ! -d "Barrier.app/Contents" ]; then
error "Please make sure that the build completed successfully"
error "before trying to create the installer."
exit 1
fi
if [ -d "$B_MACOS" ]; then
info "Removing old binaries from bundle"
rm -r "$B_MACOS"
fi
info "Copying binaries into bundle"
# Copy the folder instead of globbing unquoted path
cp -r "$B_BINDIR" "$B_MACOS" || exit 1
# Check for macdeployqt on MacPorts
if which -s port ; then
info "MacPorts found, searching for macdeployqt"
DEPLOYQT="$(port contents qt5-qttools | grep --only --max-count 1 '/.*macdeployqt')"
if [ ! -x "$DEPLOYQT" ]; then
error Please install package qt5-qttools
exit 1
fi
fi
# Check for macdeployqt on Homebrew
if which -s brew ; then
info "Homebrew found, searching for macdeployqt"
DEPLOYQT="$(brew list qt | grep --only '/.*macdeployqt' | head -1)"
if [ ! -x "$DEPLOYQT" ]; then
error Please install package qt
exit 1
fi
fi
# Use macdeployqt to include libraries and create dmg
if [ "$B_BUILDTYPE" == "Release" ]; then
info "Building Release disk image (dmg)"
"$DEPLOYQT" Barrier.app -dmg \
-executable="$B_BARRIERC" \
-executable="$B_BARRIERS" || exit 1
mv "Barrier.dmg" "Barrier-$B_VERSION.dmg" || exit 1
success "Created Barrier-$B_VERSION.dmg"
else
warn "Disk image (dmg) only created for Release builds"
info "Building debug bundle"
"$DEPLOYQT" Barrier.app -no-strip \
-executable="$B_BARRIERC" \
-executable="$B_BARRIERS" || exit 1
success "Bundle created successfully"
fi

View File

@ -1,5 +1,10 @@
#!/bin/sh #!/bin/sh
# add warning for users running manually
function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
warn "The scripts build_installer.sh and reref_dylibs.sh have been deprecated."
warn "Please use build_dist.sh instead to deploy using macdeployqt"
# change this to rename the installer package # change this to rename the installer package
B_DMG="Barrier-@BARRIER_VERSION@.dmg" B_DMG="Barrier-@BARRIER_VERSION@.dmg"

View File

@ -3,6 +3,12 @@
# $1 = binary (program or dylib) # $1 = binary (program or dylib)
B_TARGET=$1 B_TARGET=$1
if [ "x$B_TARGET" = "x" ]; then if [ "x$B_TARGET" = "x" ]; then
# add warning for users running manually
function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
warn "The scripts build_installer.sh and reref_dylibs.sh have been deprecated."
warn "Please use build_dist.sh instead to deploy using macdeployqt"
echo Which binary needs to be re-referenced? echo Which binary needs to be re-referenced?
exit 1 exit 1
fi fi