From 13b4026c83294b23d8fbace21a5e6662de256bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gabe=20maga=C3=B1a?= Date: Sun, 30 Mar 2025 18:57:51 -0700 Subject: [PATCH 1/3] Properly package MacOS build --- .gitignore | 4 + macbuild/Stardrop.csproj | 180 ++++++++++++++++++++++++++++++ macbuild/assets/background.png | Bin 0 -> 17378 bytes macbuild/assets/ents.entitlements | 14 +++ macbuild/build-mac.sh | 131 ++++++++++++++++++++++ 5 files changed, 329 insertions(+) create mode 100644 macbuild/Stardrop.csproj create mode 100644 macbuild/assets/background.png create mode 100644 macbuild/assets/ents.entitlements create mode 100755 macbuild/build-mac.sh diff --git a/.gitignore b/.gitignore index 7ef3b1d9..b9f5e4f5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,10 @@ ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +# MacOS Finder files +*.DS_Store +.DS_Store? + # User-specific files *.rsuser *.suo diff --git a/macbuild/Stardrop.csproj b/macbuild/Stardrop.csproj new file mode 100644 index 00000000..2e77ecdc --- /dev/null +++ b/macbuild/Stardrop.csproj @@ -0,0 +1,180 @@ + + + WinExe + net7.0 + enable + 1.2.1 + false + true + Assets\icon.ico + osx-x64;osx-arm64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FlexibleOptionWindow.axaml + + + NexusInfo.axaml + + + ProfileNaming.axaml + + + ProfileEditor.axaml + + + WarningWindow.axaml + + + DownloadPanel.axaml + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macbuild/assets/background.png b/macbuild/assets/background.png new file mode 100644 index 0000000000000000000000000000000000000000..bbdf116fb59beb7a082a2a29778c03faa7fa8aca GIT binary patch literal 17378 zcmeHPc~nzZ8c$*Tx zBA8&E5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Gk;ecJJPejts9&l!@AMcZ7v)9q*vK zNU`rg;;8R|nzMPX%JqRu2Yp}+&5$QM!T5KN>XjQX@DuIwH!T*yWDDZnwU>l7IuvY!o)ZeTS28FlV}a5>&5RSuox#i>0w7kr1_VGr z0E8wA2SH&V_6PwG5CEYSS3}6Q8Zn0e2nc}CLTaHJ3sk7msF6X{J~cBS00IIaG~;Th z?!4kP{#yXz7z!Q;gTXUY{{^55MIeU$j|}}kFmad)f7Eq(-gV + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.automation.apple-events + + + \ No newline at end of file diff --git a/macbuild/build-mac.sh b/macbuild/build-mac.sh new file mode 100755 index 00000000..4536f315 --- /dev/null +++ b/macbuild/build-mac.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +APP_NAME="Stardrop" +HOME="/Users/gdmagana" +PROJECT_DIR="$HOME/Developer/Github/Stardrop/Stardrop" +OUTPUT_DIR="$HOME/Developer/Github/Stardrop/releases" +ASSETS_DIR="$PROJECT_DIR/Assets" +MAC_ASSETS_DIR="assets" +ENTITLEMENTS="$MAC_ASSETS_DIR/ents.entitlements" +SIGNING_IDENTITY="Developer ID Application: Gabriel Magaña (Z4D7MUNZ97)" +DMG_BACKGROUND="$MAC_ASSETS_DIR/background.png" + +# Architectures to build for +DEFAULT_ARCHS=("osx-x64" "osx-arm64") +ARCHS=() + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + --arch) + if [[ -z "$2" || "$2" == --* ]]; then + echo "Error: --arch requires an architecture value" + exit 1 + fi + ARCHS+=("$2") + shift 2 + ;; + --arch=*) + arch_value="${1#*=}" + if [[ -z "$arch_value" ]]; then + echo "Error: --arch= requires an architecture value" + exit 1 + fi + ARCHS+=("$arch_value") + shift + ;; + -h|--help) + echo "Usage: $0 [--arch architecture]" + echo " --arch architecture Build for specific architecture (can be specified multiple times)" + echo " Default: osx-x64 osx-arm64" + exit 0 + ;; + *) + echo "Unknown parameter: $1" + echo "Use --help for usage information" + exit 1 + ;; + esac +done + +# If no architectures specified, use defaults +if [ ${#ARCHS[@]} -eq 0 ]; then + ARCHS=("${DEFAULT_ARCHS[@]}") +fi + +# Ensure output directory exists +mkdir -p "$OUTPUT_DIR" + +for ARCH in "${ARCHS[@]}"; do + echo "[INFO] Building for $ARCH..." + mkdir -p "$OUTPUT_DIR/$ARCH" + + # Step 1: Build the project + # dotnet publish "$PROJECT_DIR/Stardrop.csproj" -c Release -r $ARCH --self-contained || exit 1 + dotnet publish "$PROJECT_DIR/Stardrop.csproj" -r $ARCH -c Release /p:PublishSingleFile=true \ + /p:IncludeAllContentForSelfExtract=true /p:IncludeNativeLibrariesForSelfExtract=true \ + /p:EnableCompressionInSingleFile=true /p:PublishReadyToRun=true \ + -p:UseAppHost=true --self-contained true || exit 1 + # Check if the build was successful + if [ $? -ne 0 ]; then + echo "[ERROR] Build failed for $ARCH" + exit 1 + fi + echo "[INFO] Build successful for $ARCH" + + # Step 2: Create the .app bundle + BUILD_DIR="$PROJECT_DIR/bin/Release/$ARCH/publish" + APP_BUNDLE="$OUTPUT_DIR/$ARCH/$APP_NAME.app" + rm -rf "$APP_BUNDLE" + mkdir -p "$APP_BUNDLE/Contents/MacOS" + mkdir -p "$APP_BUNDLE/Contents/Resources" + + # Copy executable and resources + cp "$BUILD_DIR/$APP_NAME" "$APP_BUNDLE/Contents/MacOS/" + cp "$BUILD_DIR/"*.dylib "$APP_BUNDLE/Contents/MacOS/" + cp -R "$BUILD_DIR/Themes" "$APP_BUNDLE/Contents/MacOS/" + cp -R "$BUILD_DIR/i18n" "$APP_BUNDLE/Contents/MacOS/" + cp "$ASSETS_DIR/Info.plist" "$APP_BUNDLE/Contents/" + cp "$ASSETS_DIR/Stardrop.icns" "$APP_BUNDLE/Contents/Resources/" + + # Step 3: Sign the .app bundle + echo "[INFO] Signing the .app bundle for $ARCH..." + find "$APP_BUNDLE/Contents/MacOS" -type f | while read -r fname; do + codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$fname" + done + codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$APP_BUNDLE" + + # Step 4: Notarize the .app bundle + echo "[INFO] Notarizing the .app bundle for $ARCH..." + ZIP_FILE="$OUTPUT_DIR/$ARCH/$APP_NAME.zip" + ditto -c -k --sequesterRsrc --keepParent "$APP_BUNDLE" "$ZIP_FILE" + xcrun notarytool submit "$ZIP_FILE" --wait --keychain-profile Stardrop || exit 1 + xcrun stapler staple "$APP_BUNDLE" + + # Step 5: Create a DMG file + echo "[INFO] Creating a DMG file for $ARCH..." + DMG_FILE="$OUTPUT_DIR/$ARCH/$APP_NAME.dmg" + # Clean up any old temporary DMG files + rm -f "$OUTPUT_DIR"/"$ARCH"/rw.*.dmg + create-dmg \ + --icon-size 128 \ + --volname "$APP_NAME" \ + --text-size 16 \ + --icon "$APP_NAME.app" 200 150 \ + --app-drop-link 450 150 \ + --window-pos 200 200 \ + --window-size 650 376 \ + --background "$DMG_BACKGROUND" \ + --disk-image-size 150 \ + "$DMG_FILE" "$OUTPUT_DIR/$ARCH" \ + + # Step 6: Notarize the DMG file + echo "[INFO] Notarizing the DMG file for $ARCH..." + xcrun notarytool submit "$DMG_FILE" --wait --keychain-profile Stardrop || exit 1 + xcrun stapler staple "$DMG_FILE" + + # Cleanup + rm "$ZIP_FILE" +done + +echo "[INFO] Build and packaging complete. Output: $OUTPUT_DIR" \ No newline at end of file From 8a1623fb994b12e3b17ddd9f98c16313e217d96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gabe=20maga=C3=B1a?= Date: Sun, 30 Mar 2025 19:05:06 -0700 Subject: [PATCH 2/3] create README.md for mac build scripts --- macbuild/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 macbuild/README.md diff --git a/macbuild/README.md b/macbuild/README.md new file mode 100644 index 00000000..f39905d6 --- /dev/null +++ b/macbuild/README.md @@ -0,0 +1,8 @@ +This script builds the app, codesigns it, notarizes it, packages it into a disk image for intuitive installation, and notarizes that dmg. + +To properly build and codesign for MacOS, this script needs to be run by someone with an Apple Developer Program account. +As this costs $99 a year to obtain, builds are currently made by @gdmagana. +The Stardrop.csproj also must be replaced in the original project so that both architectures can be targeted. + +usage: +`./build-mac --arch osx-arm64` (leave blank to build both) From b81b98bdfb9fd3e7bf21877ecb5805e8400176f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gabe=20maga=C3=B1a?= Date: Sun, 30 Mar 2025 19:16:09 -0700 Subject: [PATCH 3/3] remove zip file from dmg --- macbuild/build-mac.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/macbuild/build-mac.sh b/macbuild/build-mac.sh index 4536f315..b05e7682 100755 --- a/macbuild/build-mac.sh +++ b/macbuild/build-mac.sh @@ -101,7 +101,9 @@ for ARCH in "${ARCHS[@]}"; do ditto -c -k --sequesterRsrc --keepParent "$APP_BUNDLE" "$ZIP_FILE" xcrun notarytool submit "$ZIP_FILE" --wait --keychain-profile Stardrop || exit 1 xcrun stapler staple "$APP_BUNDLE" - + # Cleanup + rm "$ZIP_FILE" + # Step 5: Create a DMG file echo "[INFO] Creating a DMG file for $ARCH..." DMG_FILE="$OUTPUT_DIR/$ARCH/$APP_NAME.dmg" @@ -123,9 +125,6 @@ for ARCH in "${ARCHS[@]}"; do echo "[INFO] Notarizing the DMG file for $ARCH..." xcrun notarytool submit "$DMG_FILE" --wait --keychain-profile Stardrop || exit 1 xcrun stapler staple "$DMG_FILE" - - # Cleanup - rm "$ZIP_FILE" done -echo "[INFO] Build and packaging complete. Output: $OUTPUT_DIR" \ No newline at end of file +echo "[INFO] Build and packaging complete. Output: $OUTPUT_DIR"