From 096fdd230779bbd8d1c893c3e27ad6c55ad2260d Mon Sep 17 00:00:00 2001 From: Mustafa Alperen Seki Date: Mon, 10 Apr 2023 14:19:13 +0300 Subject: [PATCH] SDK changes. --- packaging/functions.sh | 8 +- packaging/macos/buildpackage.sh | 336 +++++++++++++---------------- packaging/windows/buildpackage.nsi | 9 +- packaging/windows/buildpackage.sh | 2 + 4 files changed, 157 insertions(+), 198 deletions(-) diff --git a/packaging/functions.sh b/packaging/functions.sh index 742c0bc..fef9189 100644 --- a/packaging/functions.sh +++ b/packaging/functions.sh @@ -10,7 +10,7 @@ # Arguments: # SRC_PATH: Path to the root SDK directory # DEST_PATH: Path to the root of the install destination (will be created if necessary) -# TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, linux-x64, unix-generic) +# TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, osx-arm64, linux-x64, linux-arm64, unix-generic) # RUNTIME: Runtime type (net6, mono) # ENGINE_PATH: Path to the engine root directory install_mod_assemblies() { @@ -35,19 +35,19 @@ install_mod_assemblies() { install -m644 "${LIB}" "${DEST_PATH}" done - if [ "${TARGETPLATFORM}" = "linux-x64" ]; then + if [ "${TARGETPLATFORM}" = "linux-x64" ] || [ "${TARGETPLATFORM}" = "linux-arm64" ]; then for LIB in "${ENGINE_PATH}/bin/"*.so; do install -m755 "${LIB}" "${DEST_PATH}" done fi - if [ "${TARGETPLATFORM}" = "osx-x64" ]; then + if [ "${TARGETPLATFORM}" = "osx-x64" ] || [ "${TARGETPLATFORM}" = "osx-arm64" ]; then for LIB in "${ENGINE_PATH}/bin/"*.dylib; do install -m755 "${LIB}" "${DEST_PATH}" done fi else - find . -maxdepth 1 -name '*.sln' -exec dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -r "${TARGETPLATFORM}" -o "${DEST_PATH}" --self-contained true \; + find . -maxdepth 1 -name '*.sln' -exec dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -r "${TARGETPLATFORM}" -p:PublishDir="${DEST_PATH}" --self-contained true \; cd "${ORIG_PWD}" || exit 1 fi } diff --git a/packaging/macos/buildpackage.sh b/packaging/macos/buildpackage.sh index f20eceb..864fbc4 100755 --- a/packaging/macos/buildpackage.sh +++ b/packaging/macos/buildpackage.sh @@ -13,7 +13,7 @@ # MACOS_DEVELOPER_USERNAME: Email address for the developer account # MACOS_DEVELOPER_PASSWORD: App-specific password for the developer account # -set -e +set -o errexit -o pipefail || exit $? if [[ "$OSTYPE" != "darwin"* ]]; then echo >&2 "macOS packaging requires a macOS host" @@ -22,6 +22,7 @@ fi command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK macOS packaging requires make."; exit 1; } command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK macOS packaging requires python 3."; exit 1; } +command -v clang >/dev/null 2>&1 || { echo >&2 "macOS packaging requires clang."; exit 1; } require_variables() { missing="" @@ -35,8 +36,8 @@ require_variables() { fi } -if [ $# -eq "0" ]; then - echo "Usage: $(basename "$0") version [outputdir]" +if [ $# -ne "2" ]; then + echo "Usage: $(basename "$0") tag outputdir" exit 1 fi @@ -99,210 +100,161 @@ modify_plist() { sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3" } -build_platform() { - PLATFORM="${1}" - DMG_NAME="${2}" - LAUNCHER_DIR="${BUILTDIR}/${PACKAGING_OSX_APP_NAME}" - LAUNCHER_CONTENTS_DIR="${LAUNCHER_DIR}/Contents" - LAUNCHER_ASSEMBLY_DIR="${LAUNCHER_CONTENTS_DIR}/MacOS" - LAUNCHER_RESOURCES_DIR="${LAUNCHER_CONTENTS_DIR}/Resources" - - echo "Building launcher (${PLATFORM})" - - mkdir -p "${LAUNCHER_RESOURCES_DIR}" - mkdir -p "${LAUNCHER_CONTENTS_DIR}/MacOS" - echo "APPL????" > "${LAUNCHER_CONTENTS_DIR}/PkgInfo" - cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/Info.plist.in" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - - modify_plist "{DEV_VERSION}" "${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - modify_plist "{FAQ_URL}" "${PACKAGING_FAQ_URL}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - modify_plist "{MOD_ID}" "${MOD_ID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - modify_plist "{MOD_NAME}" "${PACKAGING_DISPLAY_NAME}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - - if [ -n "${DISCORD_APPID}" ]; then - modify_plist "{DISCORD_URL_SCHEME}" "discord-${DISCORD_APPID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - else - modify_plist "{DISCORD_URL_SCHEME}" "" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - fi - - if [ "${PLATFORM}" = "compat" ]; then - modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.9" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - clang -m64 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher-mono.m" -o "${LAUNCHER_ASSEMBLY_DIR}/Launcher" -framework AppKit -mmacosx-version-min=10.9 - else - modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.13" "${LAUNCHER_CONTENTS_DIR}/Info.plist" - clang -m64 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher.m" -o "${LAUNCHER_ASSEMBLY_DIR}/Launcher" -framework AppKit -mmacosx-version-min=10.13 - fi - - echo "Building core files" - RUNTIME="net6" - if [ "${PLATFORM}" = "compat" ]; then - RUNTIME="mono" - fi - - install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "${RUNTIME}" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" - install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_RESOURCES_DIR}" - - for f in ${PACKAGING_COPY_ENGINE_FILES}; do - mkdir -p "${LAUNCHER_RESOURCES_DIR}/$(dirname "${f}")" - cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${LAUNCHER_RESOURCES_DIR}/${f}" - done - - echo "Building mod files" - install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "${RUNTIME}" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" - - cp -LR "${TEMPLATE_ROOT}mods/"* "${LAUNCHER_RESOURCES_DIR}/mods" - - set_engine_version "${ENGINE_VERSION}" "${LAUNCHER_RESOURCES_DIR}" - if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then - set_mod_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" - else - MOD_VERSION=$(grep 'Version:' "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" | awk '{print $2}') - echo "Mod version ${MOD_VERSION} will remain unchanged."; - fi +LAUNCHER_DIR="${BUILTDIR}/${PACKAGING_OSX_APP_NAME}" +LAUNCHER_CONTENTS_DIR="${LAUNCHER_DIR}/Contents" +LAUNCHER_ASSEMBLY_DIR="${LAUNCHER_CONTENTS_DIR}/MacOS" +LAUNCHER_RESOURCES_DIR="${LAUNCHER_CONTENTS_DIR}/Resources" + +echo "Building launcher" + +mkdir -p "${LAUNCHER_RESOURCES_DIR}" +mkdir -p "${LAUNCHER_ASSEMBLY_DIR}/x86_64" +mkdir -p "${LAUNCHER_ASSEMBLY_DIR}/arm64" +mkdir -p "${LAUNCHER_ASSEMBLY_DIR}/mono" +echo "APPL????" > "${LAUNCHER_CONTENTS_DIR}/PkgInfo" +cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/Info.plist.in" "${LAUNCHER_CONTENTS_DIR}/Info.plist" + +modify_plist "{DEV_VERSION}" "${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +modify_plist "{FAQ_URL}" "${PACKAGING_FAQ_URL}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +modify_plist "{MOD_ID}" "${MOD_ID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.11" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +modify_plist "{MOD_NAME}" "${PACKAGING_DISPLAY_NAME}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +if [ -n "${DISCORD_APPID}" ]; then + modify_plist "{DISCORD_URL_SCHEME}" "discord-${DISCORD_APPID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +else + modify_plist "{DISCORD_URL_SCHEME}" "" "${LAUNCHER_CONTENTS_DIR}/Info.plist" +fi - # Assemble multi-resolution icon - mkdir "${BUILTDIR}/mod.iconset" - cp "${ARTWORK_DIR}/icon_16x16.png" "${BUILTDIR}/mod.iconset/icon_16x16.png" - cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_16x16@2.png" - cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_32x32.png" - cp "${ARTWORK_DIR}/icon_64x64.png" "${BUILTDIR}/mod.iconset/icon_32x32@2x.png" - cp "${ARTWORK_DIR}/icon_128x128.png" "${BUILTDIR}/mod.iconset/icon_128x128.png" - cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_128x128@2x.png" - cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_256x256.png" - cp "${ARTWORK_DIR}/icon_512x512.png" "${BUILTDIR}/mod.iconset/icon_256x256@2x.png" - iconutil --convert icns "${BUILTDIR}/mod.iconset" -o "${LAUNCHER_RESOURCES_DIR}/${MOD_ID}.icns" - rm -rf "${BUILTDIR}/mod.iconset" - - # Sign binaries with developer certificate - if [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then - codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/entitlements.plist" --deep "${LAUNCHER_DIR}" - fi +# Compile universal (x86_64 + arm64) Launcher and arch-specific apphosts +clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/apphost.c" -o "${LAUNCHER_ASSEMBLY_DIR}/apphost-x86_64" -framework AppKit -target x86_64-apple-macos10.15 +clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/apphost.c" -o "${LAUNCHER_ASSEMBLY_DIR}/apphost-arm64" -framework AppKit -target arm64-apple-macos10.15 +clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/apphost-mono.c" -o "${LAUNCHER_ASSEMBLY_DIR}/apphost-mono" -framework AppKit -target x86_64-apple-macos10.11 +clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/checkmono.c" -o "${LAUNCHER_ASSEMBLY_DIR}/checkmono" -framework AppKit -target x86_64-apple-macos10.11 +clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher.m" -o "${LAUNCHER_ASSEMBLY_DIR}/Launcher-x86_64" -framework AppKit -target x86_64-apple-macos10.11 +clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher.m" -o "${LAUNCHER_ASSEMBLY_DIR}/Launcher-arm64" -framework AppKit -target arm64-apple-macos10.15 +lipo -create -output "${LAUNCHER_ASSEMBLY_DIR}/Launcher" "${LAUNCHER_ASSEMBLY_DIR}/Launcher-x86_64" "${LAUNCHER_ASSEMBLY_DIR}/Launcher-arm64" +rm "${LAUNCHER_ASSEMBLY_DIR}/Launcher-x86_64" "${LAUNCHER_ASSEMBLY_DIR}/Launcher-arm64" + +install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}/x86_64" "osx-x64" "net6" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" +install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}/arm64" "osx-arm64" "net6" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" +install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}/mono" "osx-x64" "mono" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" +install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_RESOURCES_DIR}" + +for f in ${PACKAGING_COPY_ENGINE_FILES}; do + mkdir -p "${LAUNCHER_RESOURCES_DIR}/$(dirname "${f}")" + cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${LAUNCHER_RESOURCES_DIR}/${f}" +done + +echo "Building mod files" +install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}/x86_64" "osx-x64" "net6" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" +install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}/arm64" "osx-arm64" "net6" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" +install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}/mono" "osx-x64" "mono" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" + +cp -LR "${TEMPLATE_ROOT}mods/"* "${LAUNCHER_RESOURCES_DIR}/mods" + +set_engine_version "${ENGINE_VERSION}" "${LAUNCHER_RESOURCES_DIR}" +if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then + set_mod_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" +else + MOD_VERSION=$(grep 'Version:' "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" | awk '{print $2}') + echo "Mod version ${MOD_VERSION} will remain unchanged."; +fi - echo "Packaging disk image" - hdiutil create "${PACKAGING_DIR}/${DMG_NAME}" -format UDRW -volname "${PACKAGING_DISPLAY_NAME}" -fs HFS+ -srcfolder "${BUILTDIR}" - DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "${PACKAGING_DIR}/${DMG_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}') - sleep 2 +# Assemble multi-resolution icon +mkdir "${BUILTDIR}/mod.iconset" +cp "${ARTWORK_DIR}/icon_16x16.png" "${BUILTDIR}/mod.iconset/icon_16x16.png" +cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_16x16@2.png" +cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_32x32.png" +cp "${ARTWORK_DIR}/icon_64x64.png" "${BUILTDIR}/mod.iconset/icon_32x32@2x.png" +cp "${ARTWORK_DIR}/icon_128x128.png" "${BUILTDIR}/mod.iconset/icon_128x128.png" +cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_128x128@2x.png" +cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_256x256.png" +cp "${ARTWORK_DIR}/icon_512x512.png" "${BUILTDIR}/mod.iconset/icon_256x256@2x.png" +iconutil --convert icns "${BUILTDIR}/mod.iconset" -o "${LAUNCHER_RESOURCES_DIR}/${MOD_ID}.icns" +rm -rf "${BUILTDIR}/mod.iconset" + +# Sign binaries with developer certificate +if [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then + codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/entitlements.plist" --deep "${LAUNCHER_DIR}" +fi - # Background image is created from source svg in artsrc repository - mkdir "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/" - tiffutil -cathidpicheck "${ARTWORK_DIR}/macos-background.png" "${ARTWORK_DIR}/macos-background-2x.png" -out "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/background.tiff" - - cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" - - echo ' - tell application "Finder" - tell disk "'${PACKAGING_DISPLAY_NAME}'" - open - set current view of container window to icon view - set toolbar visible of container window to false - set statusbar visible of container window to false - set the bounds of container window to {400, 100, 1000, 550} - set theViewOptions to the icon view options of container window - set arrangement of theViewOptions to not arranged - set icon size of theViewOptions to 72 - set background picture of theViewOptions to file ".background:background.tiff" - make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} - set position of item "'${PACKAGING_OSX_APP_NAME}'" of container window to {'${PACKAGING_OSX_DMG_MOD_ICON_POSITION}'} - set position of item "Applications" of container window to {'${PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION}'} - set position of item ".background" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} - set position of item ".fseventsd" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} - set position of item ".VolumeIcon.icns" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} - update without registering applications - delay 5 - close - end tell - end tell - ' | osascript - - # HACK: Copy the volume icon again - something in the previous step seems to delete it...? - cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" - SetFile -c icnC "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" - SetFile -a C "/Volumes/${PACKAGING_DISPLAY_NAME}" - - chmod -Rf go-w "/Volumes/${PACKAGING_DISPLAY_NAME}" - sync - sync +echo "Packaging disk image" +hdiutil create "build.dmg" -format UDRW -volname "${PACKAGING_DISPLAY_NAME}" -fs HFS+ -srcfolder "${BUILTDIR}" +DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "${PACKAGING_DIR}/build.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') +sleep 2 + +# Background image is created from source svg in artsrc repository +mkdir "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/" +tiffutil -cathidpicheck "${ARTWORK_DIR}/macos-background.png" "${ARTWORK_DIR}/macos-background-2x.png" -out "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/background.tiff" + +cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" + +echo ' + tell application "Finder" + tell disk "'${PACKAGING_DISPLAY_NAME}'" + open + set current view of container window to icon view + set toolbar visible of container window to false + set statusbar visible of container window to false + set the bounds of container window to {400, 100, 1000, 550} + set theViewOptions to the icon view options of container window + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 72 + set background picture of theViewOptions to file ".background:background.tiff" + make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} + set position of item "'${PACKAGING_OSX_APP_NAME}'" of container window to {'${PACKAGING_OSX_DMG_MOD_ICON_POSITION}'} + set position of item "Applications" of container window to {'${PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION}'} + set position of item ".background" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} + set position of item ".fseventsd" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} + set position of item ".VolumeIcon.icns" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} + update without registering applications + delay 5 + close + end tell + end tell +' | osascript + +# HACK: Copy the volume icon again - something in the previous step seems to delete it...? +cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" +SetFile -c icnC "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" +SetFile -a C "/Volumes/${PACKAGING_DISPLAY_NAME}" + +chmod -Rf go-w "/Volumes/${PACKAGING_DISPLAY_NAME}" +sync +sync + +hdiutil detach "${DMG_DEVICE}" +rm -rf "${BUILTDIR}" - hdiutil detach "${DMG_DEVICE}" - rm -rf "${BUILTDIR}" -} +if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then + security delete-keychain build.keychain +fi -notarize_package() { - DMG_PATH="${1}" - NOTARIZE_DMG_PATH="${DMG_PATH%.*}"-notarization.dmg - echo "Submitting ${DMG_PATH} for notarization" +if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then + echo "Submitting build for notarization" # Reset xcode search path to fix xcrun not finding altool sudo xcode-select -r # Create a temporary read-only dmg for submission (notarization service rejects read/write images) - hdiutil convert "${DMG_PATH}" -format ULFO -ov -o "${NOTARIZE_DMG_PATH}" - - NOTARIZATION_UUID=$(xcrun altool --notarize-app --primary-bundle-id "net.openra.modsdk" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" --file "${NOTARIZE_DMG_PATH}" 2>&1 | awk -F' = ' '/RequestUUID/ { print $2; exit }') - if [ -z "${NOTARIZATION_UUID}" ]; then - echo "Submission failed" - exit 1 - fi + hdiutil convert "build.dmg" -format ULFO -ov -o "build-notarization.dmg" - echo "${DMG_PATH} submission UUID is ${NOTARIZATION_UUID}" - rm "${NOTARIZE_DMG_PATH}" + xcrun notarytool submit "build-notarization.dmg" --wait --apple-id "${MACOS_DEVELOPER_USERNAME}" --password "${MACOS_DEVELOPER_PASSWORD}" --team-id "${MACOS_DEVELOPER_IDENTITY}" - while :; do - sleep 30 - NOTARIZATION_RESULT=$(xcrun altool --notarization-info "${NOTARIZATION_UUID}" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" 2>&1 | awk -F': ' '/Status/ { print $2; exit }') - echo "${DMG_PATH}: ${NOTARIZATION_RESULT}" + rm "build-notarization.dmg" - if [ "${NOTARIZATION_RESULT}" == "invalid" ]; then - NOTARIZATION_LOG_URL=$(xcrun altool --notarization-info "${NOTARIZATION_UUID}" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" 2>&1 | awk -F': ' '/LogFileURL/ { print $2; exit }') - echo "${NOTARIZATION_UUID} failed notarization with error:" - curl -s "${NOTARIZATION_LOG_URL}" -w "\n" - exit 1 - fi - - if [ "${NOTARIZATION_RESULT}" == "success" ]; then - echo "${DMG_PATH}: Stapling tickets" - DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_PATH}" | egrep '^/dev/' | sed 1q | awk '{print $1}') - sleep 2 - - xcrun stapler staple "/Volumes/${PACKAGING_DISPLAY_NAME}/${PACKAGING_OSX_APP_NAME}" - - sync - sync - - hdiutil detach "${DMG_DEVICE}" - break - fi - done -} - -finalize_package() { - PLATFORM="${1}" - INPUT_PATH="${2}" - OUTPUT_PATH="${3}" - - if [ "${PLATFORM}" = "compat" ]; then - hdiutil convert "${INPUT_PATH}" -format UDZO -imagekey zlib-level=9 -ov -o "${OUTPUT_PATH}" - else - # ULFO offers better compression and faster decompression speeds, but is only supported by 10.11+ - hdiutil convert "${INPUT_PATH}" -format ULFO -ov -o "${OUTPUT_PATH}" - fi - rm "${INPUT_PATH}" -} + echo "Stapling tickets" + DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "build.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') + sleep 2 -build_platform "standard" "build.dmg" -build_platform "compat" "build-compat.dmg" + xcrun stapler staple "/Volumes/${PACKAGING_DISPLAY_NAME}/${PACKAGING_OSX_APP_NAME}" -if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then - security delete-keychain build.keychain -fi + sync + sync -if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ]; then - # Parallelize processing - (notarize_package "build.dmg") & - (notarize_package "build-compat.dmg") & - wait + hdiutil detach "${DMG_DEVICE}" fi -finalize_package "standard" "build.dmg" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}.dmg" -finalize_package "compat" "build-compat.dmg" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-compat.dmg" +hdiutil convert "build.dmg" -format ULFO -ov -o "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}.dmg" +rm "build.dmg" \ No newline at end of file diff --git a/packaging/windows/buildpackage.nsi b/packaging/windows/buildpackage.nsi index 6cf2a4a..e337a22 100644 --- a/packaging/windows/buildpackage.nsi +++ b/packaging/windows/buildpackage.nsi @@ -1,4 +1,4 @@ -; Copyright 2007-2021 OpenRA developers (see AUTHORS) +; Copyright (c) The OpenRA Developers and Contributors ; This file is part of OpenRA. ; ; OpenRA is free software: you can redistribute it and/or modify @@ -174,13 +174,18 @@ Function ${UN}Clean Delete $INSTDIR\COPYING Delete "$INSTDIR\global mix database.dat" Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP + RMDir /r $INSTDIR\Support + !ifndef USE_PROGRAMFILES32 + SetRegView 64 + !endif + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" !ifdef USE_DISCORDID - DeleteRegKey HKLM "Software\Classes\discord-${DISCORD_APP_ID}" + DeleteRegKey HKLM "Software\Classes\discord-${USE_DISCORDID}" !endif Delete $INSTDIR\uninstaller.exe diff --git a/packaging/windows/buildpackage.sh b/packaging/windows/buildpackage.sh index 70a689c..a5fbcee 100755 --- a/packaging/windows/buildpackage.sh +++ b/packaging/windows/buildpackage.sh @@ -1,8 +1,10 @@ #!/bin/bash set -e +command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires curl or wget."; exit 1; } command -v makensis >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires makensis."; exit 1; } command -v convert >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires ImageMagick."; exit 1; } command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires python 3."; exit 1; } +command -v wine64 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires wine64."; exit 1; } require_variables() { missing=""