2022-12-01 13:08:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
PUBLISH_DIRECTORY=$1
|
|
|
|
OUTPUT_DIRECTORY=$2
|
|
|
|
ENTITLEMENTS_FILE_PATH=$3
|
|
|
|
|
2023-03-12 16:21:21 +00:00
|
|
|
APP_BUNDLE_DIRECTORY="$OUTPUT_DIRECTORY/Ryujinx.app"
|
2022-12-01 13:08:43 +00:00
|
|
|
|
2023-03-12 16:21:21 +00:00
|
|
|
rm -rf "$APP_BUNDLE_DIRECTORY"
|
|
|
|
mkdir -p "$APP_BUNDLE_DIRECTORY/Contents"
|
|
|
|
mkdir "$APP_BUNDLE_DIRECTORY/Contents/Frameworks"
|
|
|
|
mkdir "$APP_BUNDLE_DIRECTORY/Contents/MacOS"
|
|
|
|
mkdir "$APP_BUNDLE_DIRECTORY/Contents/Resources"
|
2022-12-01 13:08:43 +00:00
|
|
|
|
2024-03-02 11:51:05 +00:00
|
|
|
# Copy executable and nsure executable can be executed
|
|
|
|
cp "$PUBLISH_DIRECTORY/Ryujinx" "$APP_BUNDLE_DIRECTORY/Contents/MacOS/Ryujinx"
|
2023-03-12 16:21:21 +00:00
|
|
|
chmod u+x "$APP_BUNDLE_DIRECTORY/Contents/MacOS/Ryujinx"
|
2022-12-01 13:08:43 +00:00
|
|
|
|
|
|
|
# Then all libraries
|
2023-03-12 16:21:21 +00:00
|
|
|
cp "$PUBLISH_DIRECTORY"/*.dylib "$APP_BUNDLE_DIRECTORY/Contents/Frameworks"
|
2022-12-01 13:08:43 +00:00
|
|
|
|
|
|
|
# Then resources
|
2023-03-12 16:21:21 +00:00
|
|
|
cp Info.plist "$APP_BUNDLE_DIRECTORY/Contents"
|
|
|
|
cp Ryujinx.icns "$APP_BUNDLE_DIRECTORY/Contents/Resources/Ryujinx.icns"
|
|
|
|
cp updater.sh "$APP_BUNDLE_DIRECTORY/Contents/Resources/updater.sh"
|
|
|
|
cp -r "$PUBLISH_DIRECTORY/THIRDPARTY.md" "$APP_BUNDLE_DIRECTORY/Contents/Resources"
|
2022-12-01 13:08:43 +00:00
|
|
|
|
2023-03-12 16:21:21 +00:00
|
|
|
echo -n "APPL????" > "$APP_BUNDLE_DIRECTORY/Contents/PkgInfo"
|
2022-12-01 13:08:43 +00:00
|
|
|
|
|
|
|
# Fixup libraries and executable
|
2023-03-12 16:21:21 +00:00
|
|
|
python3 bundle_fix_up.py "$APP_BUNDLE_DIRECTORY" MacOS/Ryujinx
|
2022-12-01 13:08:43 +00:00
|
|
|
|
|
|
|
# Now sign it
|
|
|
|
if ! [ -x "$(command -v codesign)" ];
|
|
|
|
then
|
|
|
|
if ! [ -x "$(command -v rcodesign)" ];
|
|
|
|
then
|
|
|
|
echo "Cannot find rcodesign on your system, please install rcodesign."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-04-28 09:14:44 +01:00
|
|
|
# cargo install apple-codesign
|
2022-12-01 13:08:43 +00:00
|
|
|
echo "Usign rcodesign for ad-hoc signing"
|
2023-03-12 16:21:21 +00:00
|
|
|
rcodesign sign --entitlements-xml-path "$ENTITLEMENTS_FILE_PATH" "$APP_BUNDLE_DIRECTORY"
|
2022-12-01 13:08:43 +00:00
|
|
|
else
|
|
|
|
echo "Usign codesign for ad-hoc signing"
|
2023-03-12 16:21:21 +00:00
|
|
|
codesign --entitlements "$ENTITLEMENTS_FILE_PATH" -f --deep -s - "$APP_BUNDLE_DIRECTORY"
|
2023-04-28 09:14:44 +01:00
|
|
|
fi
|