Merge pull request #113 from doloopuntil/improved_mac_deployment

Improve installer packaging mechanism for macOS
This commit is contained in:
corrados 2020-04-19 20:48:46 +02:00 committed by GitHub
commit 95c5832554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 187 additions and 24 deletions

5
.gitignore vendored
View file

@ -19,11 +19,12 @@ windows/ASIOSDK2
windows/VC_redist.x64.exe windows/VC_redist.x64.exe
windows/vc_redist.x86.exe windows/vc_redist.x86.exe
debug/ debug/
release/
build/
deploy/
jamulus.sln jamulus.sln
jamulus.vcxproj jamulus.vcxproj
jamulus.vcxproj.filters jamulus.vcxproj.filters
release/
deploy/
Jamulus.app/ Jamulus.app/
.DS_Store .DS_Store
distributions/opus* distributions/opus*

View file

@ -70,6 +70,8 @@ win32 {
SOURCES += mac/sound.cpp SOURCES += mac/sound.cpp
RC_FILE = mac/mainicon.icns RC_FILE = mac/mainicon.icns
CONFIG += x86 CONFIG += x86
QMAKE_INFO_PLIST = mac/Info.plist
QMAKE_TARGET_BUNDLE_PREFIX = net.sourceforge.llcon
LIBS += -framework CoreFoundation \ LIBS += -framework CoreFoundation \
-framework CoreServices \ -framework CoreServices \

32
mac/Info.plist Normal file
View 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@</string>
<key>CFBundleDisplayName</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>@BUNDLEIDENTIFIER@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>@FULL_VERSION@</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</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>

View file

@ -1,31 +1,57 @@
#!/bin/sh #!/bin/bash
cd .. 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)
# TODO add tag to CVS with current version number function build_app {
# cvs -n update 2>null | grep -i "M " # error if any file is locally modified!!! -> TODO # 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}
# call qmake # Deploy Jamulus
qmake Jamulus.pro 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
}
# first clean up # Check we are running from the correct location
rm -rf Jamulus.app if [ ! -f "${ROOT_PATH}/${APP_NAME}.pro" ]; then
make clean echo Please run this script from the ${APP_NAME} Qt project directory.
echo Usage: mac/$(basename $0)
exit 1
fi
# make everything # Install dmgbuild (for the current user), this is required to build the installer image
make -j2 python -m ensurepip --user --default-pip
python -m pip install --user dmgbuild
DMGBUILD_BIN="$(python -c 'import site; print(site.USER_BASE)')/bin/dmgbuild"
# call qt mac deploy tool # Get Jamulus version
macdeployqt Jamulus.app -dmg APP_VERSION=$(cat "${ROOT_PATH}/${APP_NAME}.pro" | sed -nE 's/^VERSION *= *(.*)$/\1/p')
# create zip file including COPYING file # Clean up previous deployments
zip Jamulus-version-mac.zip Jamulus.dmg COPYING rm -rf "${BUILD_PATH}"
rm -rf "${DEPLOY_PATH}"
mkdir -p "${BUILD_PATH}"
mkdir -p "${DEPLOY_PATH}"
# move new file in deploy directory # Build Jamulus client
mkdir -p deploy build_app "${APP_NAME}"
mv Jamulus-version-mac.zip deploy/Jamulus-version-mac.zip
# cleanup and go back to original directory # Build Jamulus server
rm Jamulus.dmg build_app "${SERVER_NAME}" "DEFINES+=SERVER_BUNDLE"
cd mac
# 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"

View file

@ -0,0 +1,96 @@
# -*- coding: utf-8 -*-
import biplist
import os.path
def icon_from_app(app_path):
plist_path = os.path.join(app_path, "Contents", "Info.plist")
plist = biplist.readPlist(plist_path)
icon_name = plist["CFBundleIconFile"]
icon_root, icon_ext = os.path.splitext(icon_name)
icon_name = icon_root + (icon_ext or ".icns")
return os.path.join(app_path, "Contents", "Resources", icon_name)
def validate_key_path(key, example):
value = defines.get(key, None)
if value is None:
raise ValueError("The " + key + " key must be specified.\n"
"Example: dmgbuild -D " + key + "=" + example + " ...")
if not os.path.exists(value):
raise ValueError("The " + key + " key must be a valid path.")
return value
# Path of the applications to deploy
app_path = validate_key_path("app_path", "Jamulus.app")
server_path = validate_key_path("server_path", "JamulusServer.app")
# Name of the applications to deploy
app_name = os.path.basename(app_path)
server_name = os.path.basename(server_path)
# Volume format (see hdiutil create -help)
format = defines.get("format", "UDBZ")
# Volume size
size = defines.get('size', None)
# Files to include
files = [
app_path,
server_path
]
# Symlinks to create
symlinks = { 'Applications': '/Applications' }
# Background
background = validate_key_path("background", "picture.png")
# Volume icon
badge_icon = icon_from_app(app_path)
# Select the default view
default_view = "icon-view"
# Set these to True to force inclusion of icon/list view settings
include_icon_view_settings = False
include_list_view_settings = False
# Where to put the icons
icon_locations = {
app_name: (630, 210),
server_name: (530, 210),
"Applications": (820, 210)
}
# View/Window element configuration
show_status_bar = False
show_tab_view = False
show_toolbar = False
show_pathbar = False
show_sidebar = False
show_icon_preview = False
# Window position in ((x, y), (w, h)) format
window_rect = ((200, 400), (900, 320))
# Icon view configuration
arrange_by = None
grid_offset = (0, 0)
grid_spacing = 72
scroll_position = (0, 0)
label_pos = "bottom"
icon_size = 72
text_size = 12
# License configuration
license = {
"default-language": "en_US",
"licenses": { "en_US": validate_key_path("license", "COPYING") }
}

View file

@ -44,7 +44,14 @@ int main ( int argc, char** argv )
// initialize all flags and string which might be changed by command line // initialize all flags and string which might be changed by command line
// arguments // arguments
#if defined( SERVER_BUNDLE ) && ( defined( __APPLE__ ) || defined( __MACOSX ) )
// if we are on MacOS and we are building a server bundle, starts Jamulus in server mode
bool bIsClient = false;
#else
bool bIsClient = true; bool bIsClient = true;
#endif
bool bUseGUI = true; bool bUseGUI = true;
bool bStartMinimized = false; bool bStartMinimized = false;
bool bShowComplRegConnList = false; bool bShowComplRegConnList = false;
@ -447,7 +454,6 @@ int main ( int argc, char** argv )
#endif #endif
} }
// Dependencies ------------------------------------------------------------ // Dependencies ------------------------------------------------------------
// per definition: if we are in "GUI" server mode and no central server // per definition: if we are in "GUI" server mode and no central server
// address is given, we use the default central server address // address is given, we use the default central server address

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.