forked from deskflow/deskflow
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script that uses macdeployqt instead of
reref_dylibs.sh
shell s…
…cript to create the `.app` bundle
- Loading branch information
1 parent
b6a1b57
commit e37277f
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/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@" | ||
|
||
# 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 --max-count 1 '/.*macdeployqt')" | ||
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 || 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 -use-debug-libs -no-strip || exit 1 | ||
success "Bundle created successfully" | ||
fi |