Build Jamulus client and server for macOS

This commit is contained in:
Daniel Masato 2020-04-18 17:49:11 +01:00
parent aee0483c58
commit 8411debb39
9 changed files with 191 additions and 34 deletions

5
.gitignore vendored
View File

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

View File

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

52
mac/deploy.sh Executable file
View File

@ -0,0 +1,52 @@
#!/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)
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
}
# 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.
echo Usage: mac/$(basename $0)
exit 1
fi
# Get Jamulus version
APP_VERSION=$(cat "${ROOT_PATH}/${APP_NAME}.pro" | sed -nE 's/^VERSION *= *(.*)$/\1/p')
# Clean up previous deployments
rm -rf "${BUILD_PATH}"
rm -rf "${DEPLOY_PATH}"
mkdir -p "${BUILD_PATH}"
mkdir -p "${DEPLOY_PATH}"
# Build Jamulus client
build_app "${APP_NAME}"
# Build Jamulus server
build_app "${SERVER_NAME}" "DEFINES+=SERVER_MODE"
# Build installer image
dmgbuild -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" "${APP_NAME} Installer" "${DEPLOY_PATH}/${INSTALLER_NAME}.dmg"

View File

@ -1,31 +0,0 @@
#!/bin/sh
cd ..
# TODO add tag to CVS with current version number
# cvs -n update 2>null | grep -i "M " # error if any file is locally modified!!! -> TODO
# call qmake
qmake Jamulus.pro
# first clean up
rm -rf Jamulus.app
make clean
# make everything
make -j2
# call qt mac deploy tool
macdeployqt Jamulus.app -dmg
# create zip file including COPYING file
zip Jamulus-version-mac.zip Jamulus.dmg COPYING
# move new file in deploy directory
mkdir -p deploy
mv Jamulus-version-mac.zip deploy/Jamulus-version-mac.zip
# cleanup and go back to original directory
rm Jamulus.dmg
cd mac

View File

@ -0,0 +1,97 @@
# -*- 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: (600, 240),
server_name: (500, 240),
"Applications": (790, 240)
}
# 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
sidebar_width = 180
# Window position in ((x, y), (w, h)) format
window_rect = ((200, 400), (900, 340))
# Icon view configuration
arrange_by = None
grid_offset = (0, 0)
grid_spacing = 100
scroll_position = (0, 0)
label_pos = "bottom"
icon_size = 80
text_size = 12
# License configuration
license = {
"default-language": "en_US",
"licenses": { "en_US": validate_key_path("license", "COPYING") }
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.