Add icon, branding and version metadata to macOS bundle, like on Android

Change-Id: Ie264db1167578d8913b38f39acd21d4acf9f4ef1
This commit is contained in:
hikari_no_yume
2025-06-29 23:08:35 +02:00
parent 1d26407656
commit 97fc52f3fa
3 changed files with 36 additions and 11 deletions

View File

@@ -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

View File

@@ -1,3 +1,5 @@
/new_release
/touchHLE.app
/*.app
/touchHLE_windows_bundle
/*.icns
/*.iconset

View File

@@ -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