You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
acts-of-gods/scripts/package-macos.sh

53 lines
1.4 KiB
Bash

#!/bin/bash
# https://github.com/create-dmg/create-dmg/tree/master?tab=readme-ov-file#create-dmg
NAME='Acts of Gods.app'
APP="platforms/macos/$NAME"
CONTENTS="$APP/Contents"
GAME="$CONTENTS/MacOS"
RESOURCES="$CONTENTS/Resources"
FRAMEWORKS="$CONTENTS/Frameworks"
mkdir -p "$APP"
mkdir -p "$GAME"
mkdir -p "$RESOURCES"
mkdir -p "$FRAMEWORKS"
# Copy icons to package
cp -f media/ActsOfGods.icns "$RESOURCES"
# Generate cross-architecture binary
rm -f "$GAME/ActsOfGods"
lipo "target/x86_64-apple-darwin/release/acts-of-gods" \
"target/aarch64-apple-darwin/release/acts-of-gods" \
-create -output "$GAME/ActsOfGods"
# Copy assets
rm -rf "$GAME/assets"
cp -r assets "$GAME/"
# Copy fmod libraries
cp -f lib/macos/libfmod.dylib "$FRAMEWORKS/"
cp -f lib/macos/libfmodstudio.dylib "$FRAMEWORKS/"
# Update dynamic linking search paths
install_name_tool -change @rpath/libfmod.dylib "@loader_path/../Frameworks/libfmod.dylib" "$GAME/"
install_name_tool -change @rpath/libfmodstudio.dylib "@loader_path/../Frameworks/libfmodstudio.dylib" "$GAME/ActsOfGods"
# Build dmg file
PACKAGE_FILE="packages/ActsOfGods-alpha-macos.dmg"
rm -f $PACKAGE_FILE
create-dmg \
--volname "Acts of Gods" \
--volicon "media/ActsOfGods.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--app-drop-link 600 200 \
--icon-size 100 \
--icon "$NAME" 200 190 \
--hide-extension "$NAME" \
--app-drop-link 600 185 \
$PACKAGE_FILE \
./platforms/macos/