diff --git a/.github/workflows/touchHLE_release.yml b/.github/workflows/touchHLE_release.yml index 991ae0168..3771664bc 100644 --- a/.github/workflows/touchHLE_release.yml +++ b/.github/workflows/touchHLE_release.yml @@ -68,7 +68,7 @@ jobs: env: CMAKE: ${{ github.workspace }}/vendor/cmake/bin/cmake - name: Create .app bundle - run: cd dev-scripts && ./make-macos-bundle.sh ../target/x86_64-apple-darwin/release/touchHLE && mkdir touchHLE-dmg-src && mv touchHLE.app touchHLE-dmg-src/ && hdiutil create -volname touchHLE -srcfolder touchHLE-dmg-src touchHLE.dmg && mv touchHLE.dmg .. + run: cd dev-scripts && ./make-macos-bundle.sh ../target/x86_64-apple-darwin/release/touchHLE "`cargo run --package touchHLE_version`" "`cargo run --package touchHLE_version -- --branding`" && mkdir touchHLE-dmg-src && mv *.app touchHLE-dmg-src/ && hdiutil create -volname touchHLE -srcfolder touchHLE-dmg-src touchHLE.dmg && mv touchHLE.dmg .. - uses: actions/upload-artifact@v4 with: name: touchHLE_macOS_x86_64 diff --git a/dev-scripts/.gitignore b/dev-scripts/.gitignore index 391a550fd..2fc3fc37e 100644 --- a/dev-scripts/.gitignore +++ b/dev-scripts/.gitignore @@ -1,3 +1,5 @@ /new_release -/touchHLE.app +/*.app /touchHLE_windows_bundle +/*.icns +/*.iconset diff --git a/dev-scripts/make-macos-bundle.sh b/dev-scripts/make-macos-bundle.sh index 01397575f..bba7de76d 100755 --- a/dev-scripts/make-macos-bundle.sh +++ b/dev-scripts/make-macos-bundle.sh @@ -2,18 +2,41 @@ set -e # Creates the .app bundle containing the basic set of files needed for touchHLE -# to run. +# to run. Also adds an icon and metadata similar to the Android APK. -if [[ $# == 1 ]]; then +if [[ $# == 3 ]]; then PATH_TO_BINARY="$1" - shift + VERSION="$2" + BRANDING="$3" + shift 3 - rm -rf touchHLE.app - mkdir -p touchHLE.app/Contents/MacOS touchHLE.app/Contents/Resources - cp $PATH_TO_BINARY touchHLE.app/Contents/MacOS/touchHLE - cp -r ../touchHLE_dylibs touchHLE.app/Contents/Resources/ - cp -r ../touchHLE_fonts touchHLE.app/Contents/Resources/ - cp -r ../touchHLE_default_options.txt touchHLE.app/Contents/Resources/ + if [[ "x$BRANDING" == "x" ]]; then + APP_NAME=touchHLE + ICON_NAME=icon + else + APP_NAME="touchHLE $BRANDING" + ICON_NAME="icon_$(echo "$BRANDING" | tr 'A-Z' 'a-z')" + VERSION="$VERSION $BRANDING" + fi + rm -rf "$ICON_NAME.icns" "$ICON_NAME.iconset" + mkdir "$ICON_NAME.iconset" + cp ../res/"$ICON_NAME.png" "$ICON_NAME.iconset"/icon_512x512.png + iconutil -c icns -o "$ICON_NAME.icns" "$ICON_NAME.iconset" + + rm -rf "$APP_NAME.app" + mkdir -p "$APP_NAME.app"/Contents/MacOS "$APP_NAME.app"/Contents/Resources + cp $PATH_TO_BINARY "$APP_NAME.app"/Contents/MacOS/touchHLE + cp -r ../touchHLE_dylibs "$APP_NAME.app"/Contents/Resources/ + cp -r ../touchHLE_fonts "$APP_NAME.app"/Contents/Resources/ + cp -r ../touchHLE_default_options.txt "$APP_NAME.app"/Contents/Resources/ + cp "$ICON_NAME.icns" "$APP_NAME.app"/Contents/Resources/ + + plutil -create xml1 "$APP_NAME.app"/Contents/Info.plist + plutil -insert CFBundleName -string "$APP_NAME" "$APP_NAME.app"/Contents/Info.plist + plutil -insert CFBundleDisplayName -string "$APP_NAME" "$APP_NAME.app"/Contents/Info.plist + plutil -insert CFBundleShortVersionString -string "$VERSION" "$APP_NAME.app"/Contents/Info.plist + plutil -insert CFBundleExecutable -string touchHLE "$APP_NAME.app"/Contents/Info.plist + plutil -insert CFBundleIconFile -string "$ICON_NAME" "$APP_NAME.app"/Contents/Info.plist else echo "Incorrect usage." exit 1