Skip to content

Commit

Permalink
kenbuild: macos packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
jonof committed Mar 3, 2024
1 parent c951f18 commit af65381
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/xcode/*.xcodeproj/project.xcworkspace
/xcode/*.xcodeproj/xcuserdata
/xcode/Signing.xcconfig
/xcode/Version.xcconfig
/xcode/build
/xcode/frameworks

Expand Down
75 changes: 75 additions & 0 deletions kenbuild/tools/package-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

[email protected]
KEYCHAINPROFILE=default
PRODUCT=jfbuild
BUNDLEID=au.id.jonof.kenbuild
VERSION=$(date +%Y%m%d)

if [ "$1" = "build" ]; then
set -xe

# Clean everything.
(cd ../xcode && xcrun xcodebuild -project game.xcodeproj -alltargets clean)

# Configure code signing.
cat >../xcode/Signing.xcconfig <<EOT
CODE_SIGN_IDENTITY = Developer ID Application
CODE_SIGN_STYLE = Manual
DEVELOPMENT_TEAM = S7U4E54CHC
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO
OTHER_CODE_SIGN_FLAGS = --timestamp
EOT

# Set the build version.
cat >../xcode/Version.xcconfig <<EOT
CURRENT_PROJECT_VERSION = $VERSION
EOT

# Build away.
(cd ../xcode && xcrun xcodebuild -parallelizeTargets -project game.xcodeproj -target game -target build -configuration Release)

elif [ "$1" = "notarise" ]; then
set -xe

# Zip up the app bundles.
mkdir -p ../xcode/build/Release/notarise
cp -R ../xcode/build/Release/*.app ../xcode/build/Release/notarise
ditto -c -k --sequesterRsrc ../xcode/build/Release/notarise notarise.zip
rm -rf ../xcode/build/Release/notarise

# Send the zip to Apple.
xcrun notarytool submit -p $KEYCHAINPROFILE --wait notarise.zip

elif [ "$1" = "notarystatus" ]; then
if [ -z "$2" ]; then
set -xe
xcrun notarytool history -p $KEYCHAINPROFILE
else
set -xe
xcrun notarytool log -p $KEYCHAINPROFILE "$2"
fi

elif [ "$1" = "finish" ]; then
set -xe

# Clean a previous packaging attempt.
rm -rf $PRODUCT-$VERSION-mac $PRODUCT-$VERSION-mac.zip

# Put all the pieces together.
mkdir $PRODUCT-$VERSION-mac
cp -R ../xcode/build/Release/*.app $PRODUCT-$VERSION-mac
cp ../buildlic.txt $PRODUCT-$VERSION-mac

# Staple notary tickets to the applications.
find $PRODUCT-$VERSION-mac -maxdepth 1 -name '*.app' -print0 | xargs -t -0 -I% xcrun stapler staple -v %

# Zip it all up.
ditto -c -k --sequesterRsrc --keepParent $PRODUCT-$VERSION-mac $PRODUCT-$VERSION-mac.zip

else
echo package-macos.sh build
echo package-macos.sh notarise
echo package-macos.sh notarystatus '[uuid]'
echo package-macos.sh finish
fi
4 changes: 4 additions & 0 deletions xcode/Common.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// By default the binary is signed to run locally.
CODE_SIGN_IDENTITY = -
CURRENT_PROJECT_VERSION = 1.0

// Copy xcode/Signing.xcconfig.sample to xcode/Signing.xcconfig
// and then update the signing settings to personalise.
#include? "Signing.xcconfig"

// Copy xcode/Version.xcconfig.sample to xcode/Version.xcconfig
// to set version properties.
#include? "Version.xcconfig"
2 changes: 2 additions & 0 deletions xcode/Version.xcconfig.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Sample Xcode configuration with versioning information.
CURRENT_PROJECT_VERSION = 20200101
4 changes: 3 additions & 1 deletion xcode/build-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
Expand Down
87 changes: 87 additions & 0 deletions xcode/engine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
AB77B4D6171AC3F700982712 /* PBXTargetDependency */,
AB77B4D8171AC3F700982712 /* PBXTargetDependency */,
AB77B4DA171AC3F700982712 /* PBXTargetDependency */,
AB392FF92B9427F3002B0F5D /* PBXTargetDependency */,
ABD03E291A518A1F0012B9D1 /* PBXTargetDependency */,
);
name = tools;
Expand All @@ -36,6 +37,11 @@

/* Begin PBXBuildFile section */
AB1751270CEF5AF8003AF128 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1751260CEF5AF8003AF128 /* SDL2.framework */; };
AB392FEE2B9427BA002B0F5D /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = AB735F510A29A39C003261DC /* compat.c */; };
AB392FEF2B9427BA002B0F5D /* osxbits.m in Sources */ = {isa = PBXBuildFile; fileRef = AB735F5C0A29A39C003261DC /* osxbits.m */; };
AB392FF12B9427BA002B0F5D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB7029840AEB2D69004FCD2A /* AppKit.framework */; };
AB392FF72B9427E5002B0F5D /* klist.c in Sources */ = {isa = PBXBuildFile; fileRef = AB392FF62B9427E5002B0F5D /* klist.c */; };
AB3930042B9428B2002B0F5D /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = AB735F520A29A39C003261DC /* crc32.c */; };
AB3B2A0E0EE3FC0400944CD1 /* hightile.c in Sources */ = {isa = PBXBuildFile; fileRef = AB3B2A0D0EE3FC0400944CD1 /* hightile.c */; };
AB3B2A1D0EE3FCF900944CD1 /* polymost.c in Sources */ = {isa = PBXBuildFile; fileRef = AB3B2A1C0EE3FCF900944CD1 /* polymost.c */; };
AB3B2AB60EE402B600944CD1 /* engine_priv.h in Headers */ = {isa = PBXBuildFile; fileRef = AB3B2AB50EE402B600944CD1 /* engine_priv.h */; };
Expand Down Expand Up @@ -139,6 +145,13 @@
/* End PBXBuildRule section */

/* Begin PBXContainerItemProxy section */
AB392FF82B9427F3002B0F5D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AB735F3A0A29A24A003261DC /* Project object */;
proxyType = 1;
remoteGlobalIDString = AB392FEB2B9427BA002B0F5D;
remoteInfo = klist;
};
AB3FE4660C0433A600D5DBDC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AB735F3A0A29A24A003261DC /* Project object */;
Expand Down Expand Up @@ -197,6 +210,8 @@

/* Begin PBXFileReference section */
AB1751260CEF5AF8003AF128 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = frameworks/SDL2.framework; sourceTree = SOURCE_ROOT; };
AB392FF52B9427BA002B0F5D /* klist */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = klist; sourceTree = BUILT_PRODUCTS_DIR; };
AB392FF62B9427E5002B0F5D /* klist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = klist.c; sourceTree = "<group>"; };
AB3B2A0D0EE3FC0400944CD1 /* hightile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hightile.c; sourceTree = "<group>"; };
AB3B2A1C0EE3FCF900944CD1 /* polymost.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = polymost.c; sourceTree = "<group>"; usesTabs = 1; };
AB3B2A6B0EE4007B00944CD1 /* mdsprite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdsprite.c; sourceTree = "<group>"; usesTabs = 1; };
Expand All @@ -209,6 +224,7 @@
AB3E07290A33035B00FF2442 /* EditorStartupWinController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditorStartupWinController.m; sourceTree = "<group>"; };
AB3FE4550C04336F00D5DBDC /* libeditorsupp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libeditorsupp.a; sourceTree = BUILT_PRODUCTS_DIR; };
AB4C36DB2B74EFC50092B8DD /* engine-version.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "engine-version.c"; sourceTree = BUILT_PRODUCTS_DIR; };
AB6465A12B94376000A757A9 /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
AB66C6A92907E89F0063C874 /* glbuild_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glbuild_priv.h; sourceTree = "<group>"; };
AB66C6AB2907E8BE0063C874 /* rg_etc1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rg_etc1.h; sourceTree = "<group>"; };
AB66C6AC2907E8BE0063C874 /* polymosttexcompress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = polymosttexcompress.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -299,6 +315,14 @@
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
AB392FF02B9427BA002B0F5D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB392FF12B9427BA002B0F5D /* AppKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AB3FE4510C04336F00D5DBDC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -407,6 +431,7 @@
AB735F380A29A24A003261DC = {
isa = PBXGroup;
children = (
AB6465A12B94376000A757A9 /* Common.xcconfig */,
AB735FBF0A29A89F003261DC /* Editor */,
AB735F720A29A3A0003261DC /* Engine */,
AB4C36DB2B74EFC50092B8DD /* engine-version.c */,
Expand All @@ -428,6 +453,7 @@
ABAE9C390F0CC81900A528DC /* kgroup */,
ABD03E211A5189E00012B9D1 /* transpal */,
ABE362492144CA6500BA44B3 /* bin2c */,
AB392FF52B9427BA002B0F5D /* klist */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -545,6 +571,7 @@
ABAE9ADA0F0B30D500A528DC /* Tools */ = {
isa = PBXGroup;
children = (
AB392FF62B9427E5002B0F5D /* klist.c */,
ABE3624A2144CA9000BA44B3 /* bin2c.cc */,
ABAE9ADB0F0B310900A528DC /* kextract.c */,
ABAE9ADC0F0B310900A528DC /* kgroup.c */,
Expand Down Expand Up @@ -608,6 +635,22 @@
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
AB392FEB2B9427BA002B0F5D /* klist */ = {
isa = PBXNativeTarget;
buildConfigurationList = AB392FF22B9427BA002B0F5D /* Build configuration list for PBXNativeTarget "klist" */;
buildPhases = (
AB392FEC2B9427BA002B0F5D /* Sources */,
AB392FF02B9427BA002B0F5D /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = klist;
productName = arttool;
productReference = AB392FF52B9427BA002B0F5D /* klist */;
productType = "com.apple.product-type.tool";
};
AB3FE44A0C04336F00D5DBDC /* editorsupp */ = {
isa = PBXNativeTarget;
buildConfigurationList = AB3FE4520C04336F00D5DBDC /* Build configuration list for PBXNativeTarget "editorsupp" */;
Expand Down Expand Up @@ -792,6 +835,7 @@
ABE362422144CA6500BA44B3 /* bin2c */,
ABAE9C270F0CC80200A528DC /* kextract */,
ABAE9C320F0CC81900A528DC /* kgroup */,
AB392FEB2B9427BA002B0F5D /* klist */,
ABD03E201A5189E00012B9D1 /* transpal */,
AB77B4D2171AC3E800982712 /* tools */,
AB4C36E32B75852A0092B8DD /* fetch-deps */,
Expand Down Expand Up @@ -841,6 +885,17 @@
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
AB392FEC2B9427BA002B0F5D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AB392FF72B9427E5002B0F5D /* klist.c in Sources */,
AB3930042B9428B2002B0F5D /* crc32.c in Sources */,
AB392FEE2B9427BA002B0F5D /* compat.c in Sources */,
AB392FEF2B9427BA002B0F5D /* osxbits.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AB3FE44D0C04336F00D5DBDC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -954,6 +1009,11 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
AB392FF92B9427F3002B0F5D /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = AB392FEB2B9427BA002B0F5D /* klist */;
targetProxy = AB392FF82B9427F3002B0F5D /* PBXContainerItemProxy */;
};
AB3FE4670C0433A600D5DBDC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = AB3FE44A0C04336F00D5DBDC /* editorsupp */;
Expand Down Expand Up @@ -987,6 +1047,22 @@
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
AB392FF32B9427BA002B0F5D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INSTALL_PATH = "$(HOME)/bin";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
AB392FF42B9427BA002B0F5D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
INSTALL_PATH = "$(HOME)/bin";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
AB3FE4530C04336F00D5DBDC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -1021,6 +1097,7 @@
};
AB735F3C0A29A24B003261DC /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AB6465A12B94376000A757A9 /* Common.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
Expand Down Expand Up @@ -1053,6 +1130,7 @@
};
AB735F3D0A29A24B003261DC /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AB6465A12B94376000A757A9 /* Common.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
Expand Down Expand Up @@ -1214,6 +1292,15 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
AB392FF22B9427BA002B0F5D /* Build configuration list for PBXNativeTarget "klist" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB392FF32B9427BA002B0F5D /* Debug */,
AB392FF42B9427BA002B0F5D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AB3FE4520C04336F00D5DBDC /* Build configuration list for PBXNativeTarget "editorsupp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
4 changes: 3 additions & 1 deletion xcode/game-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
Expand Down
Loading

0 comments on commit af65381

Please sign in to comment.