create_app_bundle.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. set -e
  3. PUBLISH_DIRECTORY=$1
  4. OUTPUT_DIRECTORY=$2
  5. ENTITLEMENTS_FILE_PATH=$3
  6. APP_BUNDLE_DIRECTORY="$OUTPUT_DIRECTORY/Ryujinx.app"
  7. rm -rf "$APP_BUNDLE_DIRECTORY"
  8. mkdir -p "$APP_BUNDLE_DIRECTORY/Contents"
  9. mkdir "$APP_BUNDLE_DIRECTORY/Contents/Frameworks"
  10. mkdir "$APP_BUNDLE_DIRECTORY/Contents/MacOS"
  11. mkdir "$APP_BUNDLE_DIRECTORY/Contents/Resources"
  12. # Copy executable and nsure executable can be executed
  13. cp "$PUBLISH_DIRECTORY/Ryujinx" "$APP_BUNDLE_DIRECTORY/Contents/MacOS/Ryujinx"
  14. chmod u+x "$APP_BUNDLE_DIRECTORY/Contents/MacOS/Ryujinx"
  15. # Then all libraries
  16. cp "$PUBLISH_DIRECTORY"/*.dylib "$APP_BUNDLE_DIRECTORY/Contents/Frameworks"
  17. # Then resources
  18. cp Info.plist "$APP_BUNDLE_DIRECTORY/Contents"
  19. cp Ryujinx.icns "$APP_BUNDLE_DIRECTORY/Contents/Resources/Ryujinx.icns"
  20. cp updater.sh "$APP_BUNDLE_DIRECTORY/Contents/Resources/updater.sh"
  21. cp -r "$PUBLISH_DIRECTORY/THIRDPARTY.md" "$APP_BUNDLE_DIRECTORY/Contents/Resources"
  22. echo -n "APPL????" > "$APP_BUNDLE_DIRECTORY/Contents/PkgInfo"
  23. # Fixup libraries and executable
  24. python3 bundle_fix_up.py "$APP_BUNDLE_DIRECTORY" MacOS/Ryujinx
  25. # Now sign it
  26. if ! [ -x "$(command -v codesign)" ];
  27. then
  28. if ! [ -x "$(command -v rcodesign)" ];
  29. then
  30. echo "Cannot find rcodesign on your system, please install rcodesign."
  31. exit 1
  32. fi
  33. # cargo install apple-codesign
  34. echo "Usign rcodesign for ad-hoc signing"
  35. rcodesign sign --entitlements-xml-path "$ENTITLEMENTS_FILE_PATH" "$APP_BUNDLE_DIRECTORY"
  36. else
  37. echo "Usign codesign for ad-hoc signing"
  38. codesign --entitlements "$ENTITLEMENTS_FILE_PATH" -f --deep -s - "$APP_BUNDLE_DIRECTORY"
  39. fi