Skip to content

Commit 5800001

Browse files
authored
Merge pull request #3350 from ann0see/refactor/macDeploy
2 parents 6f4ddfa + 1371b70 commit 5800001

1 file changed

Lines changed: 39 additions & 22 deletions

File tree

mac/deploy_mac.sh

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ set -eu -o pipefail
44
root_path=$(pwd)
55
project_path="${root_path}/Jamulus.pro"
66
resources_path="${root_path}/src/res"
7+
raw_path="${root_path}/rawbuild" # Path for raw, not yet runnable or signed binaries.
78
build_path="${root_path}/build"
89
deploy_path="${root_path}/deploy"
10+
macapp_deploy_path="${root_path}/storedeploy"
11+
912
cert_name=""
1013
macapp_cert_name=""
1114
macinst_cert_name=""
@@ -51,8 +54,12 @@ cleanup() {
5154
# Clean up previous deployments
5255
rm -rf "${build_path}"
5356
rm -rf "${deploy_path}"
57+
rm -rf "${macapp_deploy_path}"
58+
rm -rf "${raw_path}"
5459
mkdir -p "${build_path}"
5560
mkdir -p "${deploy_path}"
61+
mkdir -p "${macapp_deploy_path}"
62+
mkdir -p "${raw_path}"
5663
}
5764

5865
build_app() {
@@ -98,33 +105,17 @@ build_app() {
98105
done
99106
fi
100107

108+
# Copy built (raw) artifacts to raw directory and deploy path
109+
mv "${build_path}/${target_name}.app" "${raw_path}/${target_name}.app"
110+
cp -a "${raw_path}/${target_name}.app" "${deploy_path}/${target_name}.app"
111+
101112
# Add Qt deployment dependencies
102113
if [[ -z "$cert_name" ]]; then
103-
macdeployqt "${build_path}/${target_name}.app" -verbose=2 -always-overwrite -codesign="-"
114+
macdeployqt "${deploy_path}/${target_name}.app" -verbose=2 -always-overwrite -codesign="-"
104115
else
105-
macdeployqt "${build_path}/${target_name}.app" -verbose=2 -always-overwrite -hardened-runtime -timestamp -appstore-compliant -sign-for-notarization="${cert_name}"
116+
macdeployqt "${deploy_path}/${target_name}.app" -verbose=2 -always-overwrite -hardened-runtime -timestamp -appstore-compliant -sign-for-notarization="${cert_name}"
106117
fi
107118

108-
## Build installer pkg file - for submission to App Store
109-
if [[ -z "$macapp_cert_name" ]]; then
110-
echo "No cert to sign for App Store, bypassing..."
111-
else
112-
# Clone the build directory to leave the adhoc signed app untouched
113-
cp -a "${build_path}" "${build_path}_storesign"
114-
115-
# Add Qt deployment deps and codesign the app for App Store submission
116-
macdeployqt "${build_path}_storesign/${target_name}.app" -verbose=2 -always-overwrite -hardened-runtime -timestamp -appstore-compliant -sign-for-notarization="${macapp_cert_name}"
117-
118-
# Create pkg installer and sign for App Store submission
119-
productbuild --sign "${macinst_cert_name}" --keychain build.keychain --component "${build_path}_storesign/${target_name}.app" /Applications "${build_path}/Jamulus_${JAMULUS_BUILD_VERSION}.pkg"
120-
121-
# move created pkg file to prep for download
122-
mv "${build_path}/Jamulus_${JAMULUS_BUILD_VERSION}.pkg" "${deploy_path}"
123-
fi
124-
125-
# move app bundle to prep for dmg creation
126-
mv "${build_path}/${target_name}.app" "${deploy_path}"
127-
128119
# Cleanup
129120
make -f "${build_path}/Makefile" -C "${build_path}" distclean
130121

@@ -181,6 +172,27 @@ build_installer_image() {
181172
"${deploy_path}/"
182173
}
183174

175+
build_storesign_pkg() {
176+
# Build installer pkg file - for submission to App Store
177+
# Note: We do not upload the server to the app store for now. This could be changed easily by uncommenting the respective lines below
178+
local client_target_name="${1}"
179+
# local server_target_name="${2}"
180+
echo "Cert signing for App Store started..."
181+
182+
# Copy binaries to separate temporary deploy directory leave the (adhoc) signed app untouched
183+
cp -a "${raw_path}/${client_target_name}.app" "${macapp_deploy_path}/${client_target_name}.app"
184+
# cp -a "${raw_path}/${server_target_name}.app" "${macapp_deploy_path}/${server_target_name}.app"
185+
186+
# Add Qt deployment deps and codesign the app for App Store submission
187+
macdeployqt "${macapp_deploy_path}/${client_target_name}.app" -verbose=2 -always-overwrite -hardened-runtime -timestamp -appstore-compliant -sign-for-notarization="${macapp_cert_name}"
188+
# macdeployqt "${macapp_deploy_path}/${server_target_name}.app" -verbose=2 -always-overwrite -hardened-runtime -timestamp -appstore-compliant -sign-for-notarization="${macapp_cert_name}"
189+
190+
echo "Creating .pkg files for App Store submission"
191+
# Create pkg installers and sign for App Store submission
192+
productbuild --sign "${macinst_cert_name}" --keychain build.keychain --component "${macapp_deploy_path}/${client_target_name}.app" /Applications "${deploy_path}/${client_target_name}_${JAMULUS_BUILD_VERSION}.pkg"
193+
# productbuild --sign "${macinst_cert_name}" --keychain build.keychain --component "${macapp_deploy_path}/${server_target_name}.app" /Applications "${deploy_path}/${server_target_name}_${JAMULUS_BUILD_VERSION}.pkg"
194+
}
195+
184196
brew_install_pinned() {
185197
local pkg="$1"
186198
local version="$2"
@@ -220,3 +232,8 @@ build_app server_app "CONFIG+=server_bundle"
220232

221233
# Create versioned installer image
222234
build_installer_image "${CLIENT_TARGET_NAME}" "${SERVER_TARGET_NAME}"
235+
236+
if [[ -n "$macapp_cert_name" ]]; then
237+
# Create pkg file for App Store submission if certificate is given
238+
build_storesign_pkg "${CLIENT_TARGET_NAME}" "${SERVER_TARGET_NAME}"
239+
fi

0 commit comments

Comments
 (0)