Improve Mac deployment script
This commit is contained in:
parent
ccf673b277
commit
7c7a47a066
5 changed files with 110 additions and 47 deletions
|
@ -31,7 +31,7 @@ matrix:
|
|||
- brew install qt5
|
||||
- brew link qt5 --force
|
||||
script:
|
||||
- qmake "CONFIG+=istravis" -spec macx-xcode Jamulus.pro
|
||||
- qmake -spec macx-xcode Jamulus.pro
|
||||
- xcodebuild -list -project Jamulus.xcodeproj
|
||||
- xcodebuild -scheme Jamulus build
|
||||
#deploy function is only available in travis-ci.com (not free) but not in travis-ci.org (free)
|
||||
|
|
15
Jamulus.pro
15
Jamulus.pro
|
@ -75,14 +75,25 @@ win32 {
|
|||
LIBS += "C:/Program Files (x86)/Jack/lib/libjack64.lib"
|
||||
}
|
||||
} else:macx {
|
||||
contains(CONFIG, "server_bundle") {
|
||||
message(The generated application bundle will run a server instance.)
|
||||
|
||||
DEFINES += SERVER_BUNDLE
|
||||
TARGET = $${TARGET}Server
|
||||
}
|
||||
|
||||
QT += macextras
|
||||
HEADERS += mac/sound.h
|
||||
SOURCES += mac/sound.cpp
|
||||
RC_FILE = mac/mainicon.icns
|
||||
CONFIG += x86
|
||||
!contains(CONFIG, "istravis") {
|
||||
QMAKE_INFO_PLIST = mac/Info.plist
|
||||
QMAKE_TARGET_BUNDLE_PREFIX = net.sourceforge.llcon
|
||||
QMAKE_APPLICATION_BUNDLE_NAME. = $$TARGET
|
||||
|
||||
macx-xcode {
|
||||
QMAKE_INFO_PLIST = mac/Info-xcode.plist
|
||||
} else {
|
||||
QMAKE_INFO_PLIST = mac/Info-make.plist
|
||||
}
|
||||
|
||||
LIBS += -framework CoreFoundation \
|
||||
|
|
32
mac/Info-xcode.plist
Normal file
32
mac/Info-xcode.plist
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${QMAKE_FULL_VERSION}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>mainicon.icns</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>Jamulus needs access to the microphone to record and stream your music to other musicians</string>
|
||||
<!-- Temporarily opt out of Dark Mode as Qt 5.9 does not support it well, see https://bugreports.qt.io/browse/QTBUG-68891 -->
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<string>true</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,57 +1,77 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
APP_NAME="Jamulus"
|
||||
SERVER_NAME="${APP_NAME}Server"
|
||||
INSTALLER_NAME="${APP_NAME}-installer"
|
||||
ROOT_PATH="$(pwd)"
|
||||
MAC_PATH="${ROOT_PATH}/mac"
|
||||
RES_PATH="${ROOT_PATH}/src/res"
|
||||
BUILD_PATH="${ROOT_PATH}/build"
|
||||
DEPLOY_PATH="${ROOT_PATH}/deploy"
|
||||
JOB_COUNT=$(sysctl -n hw.ncpu)
|
||||
root_path="$(pwd)"
|
||||
project_path="${root_path}/Jamulus.pro"
|
||||
macdeploy_path="${root_path}/mac"
|
||||
resources_path="${root_path}/src/res"
|
||||
build_path="${root_path}/build"
|
||||
deploy_path="${root_path}/deploy"
|
||||
|
||||
function build_app {
|
||||
# Build Jamulus
|
||||
qmake "${ROOT_PATH}/${APP_NAME}.pro" -o "${BUILD_PATH}/Makefile" \
|
||||
"CONFIG+=release" "TARGET=$1" "QMAKE_APPLICATION_BUNDLE_NAME=$1" ${@:2}
|
||||
|
||||
make -f "${BUILD_PATH}/Makefile" -C "${BUILD_PATH}" -j${JOB_COUNT}
|
||||
|
||||
# Deploy Jamulus
|
||||
macdeployqt "${BUILD_PATH}/$1.app" -verbose=2 -always-overwrite
|
||||
mv "${BUILD_PATH}/$1.app" "${DEPLOY_PATH}"
|
||||
make -f "${BUILD_PATH}/Makefile" -C "${BUILD_PATH}" distclean
|
||||
cleanup()
|
||||
{
|
||||
# Clean up previous deployments
|
||||
rm -rf "${build_path}"
|
||||
rm -rf "${deploy_path}"
|
||||
mkdir -p "${build_path}"
|
||||
mkdir -p "${deploy_path}"
|
||||
}
|
||||
|
||||
# Check we are running from the correct location
|
||||
if [ ! -f "${ROOT_PATH}/${APP_NAME}.pro" ]; then
|
||||
echo Please run this script from the ${APP_NAME} Qt project directory.
|
||||
|
||||
build_app()
|
||||
{
|
||||
# Build Jamulus
|
||||
qmake "${project_path}" -o "${build_path}/Makefile" "CONFIG+=release" ${@:2}
|
||||
local target_name="$(cat "${build_path}/Makefile" | sed -nE 's/^QMAKE_TARGET *= *(.*)$/\1/p')"
|
||||
local job_count="$(sysctl -n hw.ncpu)"
|
||||
|
||||
make -f "${build_path}/Makefile" -C "${build_path}" -j "${job_count}"
|
||||
|
||||
# Add Qt deployment dependencies
|
||||
macdeployqt "${build_path}/${target_name}.app" -verbose=2 -always-overwrite
|
||||
mv "${build_path}/${target_name}.app" "${deploy_path}"
|
||||
|
||||
# Cleanup
|
||||
make -f "${build_path}/Makefile" -C "${build_path}" distclean
|
||||
|
||||
# Return app name for installer image
|
||||
eval "$1=${target_name}"
|
||||
}
|
||||
|
||||
|
||||
build_installer_image()
|
||||
{
|
||||
# Install dmgbuild (for the current user), this is required to build the installer image
|
||||
python -m ensurepip --user --default-pip
|
||||
python -m pip install --user dmgbuild
|
||||
local dmgbuild_bin="$(python -c 'import site; print(site.USER_BASE)')/bin/dmgbuild"
|
||||
|
||||
# Get Jamulus version
|
||||
local app_version="$(cat "${project_path}" | sed -nE 's/^VERSION *= *(.*)$/\1/p')"
|
||||
|
||||
# Build installer image
|
||||
"${dmgbuild_bin}" -s "${macdeploy_path}/deployment_settings.py" -D background="${resources_path}/installerbackground.png" \
|
||||
-D app_path="${deploy_path}/$1.app" -D server_path="${deploy_path}/$2.app" \
|
||||
-D license="${root_path}/COPYING" "$1 Installer" "${deploy_path}/$1-${app_version}-installer-mac.dmg"
|
||||
}
|
||||
|
||||
|
||||
# Check that we are running from the correct location
|
||||
if [ ! -f "${project_path}" ];
|
||||
then
|
||||
echo Please run this script from the Qt project directory where "$(basename ${project_path})" is located.
|
||||
echo Usage: mac/$(basename $0)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install dmgbuild (for the current user), this is required to build the installer image
|
||||
python -m ensurepip --user --default-pip
|
||||
python -m pip install --user dmgbuild
|
||||
DMGBUILD_BIN="$(python -c 'import site; print(site.USER_BASE)')/bin/dmgbuild"
|
||||
|
||||
# Get Jamulus version
|
||||
APP_VERSION=$(cat "${ROOT_PATH}/${APP_NAME}.pro" | sed -nE 's/^VERSION *= *(.*)$/\1/p')
|
||||
|
||||
# Cleanup previous deployments
|
||||
rm -rf "${BUILD_PATH}"
|
||||
rm -rf "${DEPLOY_PATH}"
|
||||
mkdir -p "${BUILD_PATH}"
|
||||
mkdir -p "${DEPLOY_PATH}"
|
||||
cleanup
|
||||
|
||||
# Build Jamulus client
|
||||
build_app "${APP_NAME}"
|
||||
# Build Jamulus client and server
|
||||
build_app client_app
|
||||
build_app server_app "CONFIG+=server_bundle"
|
||||
|
||||
# Build Jamulus server
|
||||
build_app "${SERVER_NAME}" "DEFINES+=SERVER_BUNDLE"
|
||||
|
||||
# Build installer image
|
||||
"${DMGBUILD_BIN}" -s "${MAC_PATH}/deployment_settings.py" -D background="${RES_PATH}/installerbackground.png" \
|
||||
-D app_path="${DEPLOY_PATH}/${APP_NAME}.app" -D server_path="${DEPLOY_PATH}/${SERVER_NAME}.app" \
|
||||
-D license="${ROOT_PATH}/COPYING" "${INSTALLER_NAME}" "${DEPLOY_PATH}/${INSTALLER_NAME}-${APP_VERSION}-mac.dmg"
|
||||
# Create versioned installer image
|
||||
build_installer_image "${client_app}" "${server_app}"
|
||||
|
|
Loading…
Reference in a new issue