q3rally/engine/make-macosx-ub2.sh

160 lines
4.8 KiB
Bash
Raw Normal View History

ioquake3 resync to commit 4610a240 from bc8737d7 Upgrade to build and run from VS2019 Upgrades to Xcode project and Apple Silicon support Update SDL2 to 2.0.14 Updated SDL2 include files to fix Mac build in GitHub Actions Added another mention of arm64 to command line help Restored original opus sse files, excluded from Xcode Added arm64 to the post-build symlinking step Merge branch 'main' into xcode Merge branch 'main' into vs2019 Added shell script to compile Universal 2 binary (x86_64+arm64) Reverting alert style to deprecated methods Upgrades to Xcode project and Apple Silicon support Update SDL2 to 2.0.14 Added another mention of arm64 to command line help Restored original opus sse files, excluded from Xcode Added arm64 to the post-build symlinking step Added shell script to compile Universal 2 binary (x86_64+arm64) Reverting alert style to deprecated methods Merge branch 'xcode' of https://github.com/tomkidd/ioq3 into xcode Removed signature from SDL dylib, enabled dark mode on macOS. spaces > tabs Ad-hoc signed libSDL2-2.0.0.dylib Fix compiling against SDL 2.0.17 UB2 now signs and notarizes, upgraded to SDL 2.0.16 Architectures in libSDL2 restored for ppc and i386 Merge remote-tracking branch 'upstream/main' into vs2019 Update SDL2 to 2.0.16 Added rudimentary support for automatically finding Microsoft Store version of Quake 3 GHA deprecated Ubuntu 16.04 - update to 18.04 qsort cannot be called with NULL Merge remote-tracking branch 'upstream/main' into vs2019 Addressed string concatenation issue and added dummy method for Mac/Linux Added missing variable. Merge remote-tracking branch 'upstream/main' into xcode Updated SDL 2.0.16 headers and Mac version of libraries to fix GitHub actions Addressed PR suggestions Modified MS Store path handling to better follow the pattern of Steam/GOG Merge pull request #481 from tomkidd/xcode Merge pull request #482 from tomkidd/vs2019 OpenGL2: Fix r_grayscale 1 making everything solid black Print full GL_EXTENSIONS list for OpenGL contexts before 3.0 Fix being unable to enter Team Arena CD key OpenGL2: GL_DEPTH_TEXTURE_MODE was removed from OpenGL 3.0/Core Improve setting Microsoft Store path Update building for macOS in README Make macOS arm64 default to target macOS 11 in Makefile Fix error when cross-compiling for macOS arm64 using Makefile Fix passing arguments to VM dylib on Apple M1 Fix compiling on older macOS Fix memory corruption in S_TransferPaintBuffer Fix memset Fix hex digit Fix uninitialized variable some old URL and doc updates Update README.md Update FUNDING.yml code/curl: update ifdef condition for MCST-LCC compiler in mcst-lcc compiler => 1.25 added a new macro definition to determine compiler Revert "code/curl: update ifdef condition for MCST-LCC compiler" Revert "E2K: fixed build by MCST lcc compiler when using USE_CURL=1 option" More predictable mesh normals generation vm_x86.c: Add `defined(_M_IX86) || defined(_M_X64)` (fix for VS2019) Add keys for SDL 2.0.14's new gamepad buttons Fix in_availableJoysticks cvar not updating Fix (disabled) Wavelet sound decompression Update to SDL 2.24.0 and add separate macOS UB2 dylib Update macOS UB1 to SDL 2.0.22 Fix running make-macosx{,-ub2}.sh on Linux Update MSVC .lib files to SDL 2.24.0
2023-03-03 04:26:22 +00:00
#!/bin/bash
cd `dirname $0`
if [ ! -f Makefile ]; then
echo "This script must be run from the ioquake3 build directory"
exit 1
fi
# This script is to build a Universal 2 binary
# (Apple's term for an x86_64 and arm64 binary)
unset X86_64_SDK
unset X86_64_CFLAGS
unset X86_64_MACOSX_VERSION_MIN
unset ARM64_SDK
unset ARM64_CFLAGS
unset ARM64_MACOSX_VERSION_MIN
X86_64_MACOSX_VERSION_MIN="10.9"
ARM64_MACOSX_VERSION_MIN="11.0"
echo "Building X86_64 Client/Dedicated Server"
echo "Building ARM64 Client/Dedicated Server"
echo
if [ "$1" == "" ]; then
echo "Run script with a 'notarize' flag to perform signing and notarization."
fi
# For parallel make on multicore boxes...
SYSCTL_PATH=`command -v sysctl 2> /dev/null`
if [ -n "$SYSCTL_PATH" ]; then
NCPU=`sysctl -n hw.ncpu`
else
# osxcross on linux
NCPU=`nproc`
fi
# x86_64 client and server
#if [ -d build/release-release-x86_64 ]; then
# rm -r build/release-darwin-x86_64
#fi
(PLATFORM=darwin ARCH=x86_64 CFLAGS=$X86_64_CFLAGS MACOSX_VERSION_MIN=$X86_64_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo;echo
# arm64 client and server
#if [ -d build/release-release-arm64 ]; then
# rm -r build/release-darwin-arm64
#fi
(PLATFORM=darwin ARCH=arm64 CFLAGS=$ARM64_CFLAGS MACOSX_VERSION_MIN=$ARM64_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo
# use the following shell script to build a universal 2 application bundle
export MACOSX_DEPLOYMENT_TARGET="10.9"
export MACOSX_DEPLOYMENT_TARGET_X86_64="$X86_64_MACOSX_VERSION_MIN"
export MACOSX_DEPLOYMENT_TARGET_ARM64="$ARM64_MACOSX_VERSION_MIN"
if [ -d build/release-darwin-universal2 ]; then
rm -r build/release-darwin-universal2
fi
"./make-macosx-app.sh" release
if [ "$1" == "notarize" ]; then
# user-specific values
# specify the actual values in a separate file called make-macosx-values.local
# ****************************************************************************************
# identity as specified in Keychain
SIGNING_IDENTITY="Developer ID Application: Your Name (XXXXXXXXX)"
ASC_USERNAME="your@apple.id"
# signing password is app-specific (https://appleid.apple.com/account/manage) and stored in Keychain (as "notarize-app" in this case)
ASC_PASSWORD="@keychain:notarize-app"
# ProviderShortname can be found with
# xcrun altool --list-providers -u your@apple.id -p "@keychain:notarize-app"
ASC_PROVIDER="XXXXXXXXX"
# ****************************************************************************************
source make-macosx-values.local
# release build location
RELEASE_LOCATION="build/release-darwin-universal2"
# release build name
RELEASE_BUILD="ioquake3.app"
# Pre-notarized zip file (not what is shipped)
PRE_NOTARIZED_ZIP="ioquake3_prenotarized.zip"
# Post-notarized zip file (shipped)
POST_NOTARIZED_ZIP="ioquake3_notarized.zip"
BUNDLE_ID="org.ioquake3.ioquake3"
# allows for unsigned executable memory in hardened runtime
# see: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-unsigned-executable-memory
ENTITLEMENTS_FILE="misc/xcode/ioquake3/ioquake3.entitlements"
# sign the resulting app bundle
echo "signing..."
codesign --force --options runtime --deep --entitlements "${ENTITLEMENTS_FILE}" --sign "${SIGNING_IDENTITY}" ${RELEASE_LOCATION}/${RELEASE_BUILD}
cd ${RELEASE_LOCATION}
# notarize app
# script taken from https://github.com/rednoah/notarize-app
# create the zip to send to the notarization service
echo "zipping..."
ditto -c -k --sequesterRsrc --keepParent ${RELEASE_BUILD} ${PRE_NOTARIZED_ZIP}
# create temporary files
NOTARIZE_APP_LOG=$(mktemp -t notarize-app)
NOTARIZE_INFO_LOG=$(mktemp -t notarize-info)
# delete temporary files on exit
function finish {
rm "$NOTARIZE_APP_LOG" "$NOTARIZE_INFO_LOG"
}
trap finish EXIT
echo "submitting..."
# submit app for notarization
if xcrun altool --notarize-app --primary-bundle-id "$BUNDLE_ID" --asc-provider "$ASC_PROVIDER" --username "$ASC_USERNAME" --password "$ASC_PASSWORD" -f "$PRE_NOTARIZED_ZIP" > "$NOTARIZE_APP_LOG" 2>&1; then
cat "$NOTARIZE_APP_LOG"
RequestUUID=$(awk -F ' = ' '/RequestUUID/ {print $2}' "$NOTARIZE_APP_LOG")
# check status periodically
while sleep 60 && date; do
# check notarization status
if xcrun altool --notarization-info "$RequestUUID" --asc-provider "$ASC_PROVIDER" --username "$ASC_USERNAME" --password "$ASC_PASSWORD" > "$NOTARIZE_INFO_LOG" 2>&1; then
cat "$NOTARIZE_INFO_LOG"
# once notarization is complete, run stapler and exit
if ! grep -q "Status: in progress" "$NOTARIZE_INFO_LOG"; then
xcrun stapler staple "$RELEASE_BUILD"
break
fi
else
cat "$NOTARIZE_INFO_LOG" 1>&2
exit 1
fi
done
else
cat "$NOTARIZE_APP_LOG" 1>&2
exit 1
fi
echo "notarized"
echo "zipping notarized..."
ditto -c -k --sequesterRsrc --keepParent ${RELEASE_BUILD} ${POST_NOTARIZED_ZIP}
echo "done. ${POST_NOTARIZED_ZIP} contains notarized ${RELEASE_BUILD} build."
fi