mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-21 15:41:35 +02:00
Do macos packaging on ghactions
This commit is contained in:
58
.github/build.sh
vendored
58
.github/build.sh
vendored
@@ -43,6 +43,26 @@ aarch64-android-bionic-static) ;;
|
|||||||
*) >&2 echo "configuration $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC is not supported" && exit 1;;
|
*) >&2 echo "configuration $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC is not supported" && exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
function inplace_sed() {
|
||||||
|
local subst=$1
|
||||||
|
local path=$2
|
||||||
|
if [[ $BSH_BUILD_PLATFORM == darwin ]]; then
|
||||||
|
sed -i "" -e $subst $path
|
||||||
|
else
|
||||||
|
sed -i $subst $path
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function subst_version() {
|
||||||
|
local path=$1
|
||||||
|
if [[ $BSH_HOST_PLATFORM != darwin ]]; then
|
||||||
|
inplace_sed "s|SUBST_DATE|$(date --iso-8601)|g" $path
|
||||||
|
fi
|
||||||
|
inplace_sed "s|SUBST_SAVE_VERSION|$save_version|g" $path
|
||||||
|
inplace_sed "s|SUBST_MINOR_VERSION|$minor_version|g" $path
|
||||||
|
inplace_sed "s|SUBST_BUILD_NUM|$build_num|g" $path
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $BSH_HOST_PLATFORM == android ]]; then
|
if [[ $BSH_HOST_PLATFORM == android ]]; then
|
||||||
android_platform=android-30
|
android_platform=android-30
|
||||||
if [[ -z "${JAVA_HOME_8_X64-}" ]]; then
|
if [[ -z "${JAVA_HOME_8_X64-}" ]]; then
|
||||||
@@ -335,13 +355,36 @@ if [[ $BSH_HOST_PLATFORM == android ]]; then
|
|||||||
ANDROID_KEYSTORE_PASS=bagelsbagels ninja android/$APP_EXE.apk
|
ANDROID_KEYSTORE_PASS=bagelsbagels ninja android/$APP_EXE.apk
|
||||||
mv android/$APP_EXE.apk $APP_EXE.apk
|
mv android/$APP_EXE.apk $APP_EXE.apk
|
||||||
fi
|
fi
|
||||||
if [[ $PACKAGE_MODE == appimage ]]; then
|
if [[ $PACKAGE_MODE == dmg ]]; then
|
||||||
|
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == darwin-macos
|
||||||
|
appdir=$APP_NAME.app
|
||||||
|
mkdir $appdir
|
||||||
|
mkdir $appdir/Contents
|
||||||
|
cp resources/Info.plist $appdir/Contents/Info.plist
|
||||||
|
subst_version $appdir/Contents/Info.plist
|
||||||
|
mkdir $appdir/Contents/MacOS
|
||||||
|
cp $APP_EXE $appdir/Contents/MacOS/$APP_EXE
|
||||||
|
mkdir $appdir/Contents/Resources
|
||||||
|
mkdir icon_exe.iconset
|
||||||
|
cp ../resources/generated_icons/icon_exe_16.png icon_exe.iconset/icon_16x16.png
|
||||||
|
cp ../resources/generated_icons/icon_exe_32.png icon_exe.iconset/icon_32x32.png
|
||||||
|
cp ../resources/generated_icons/icon_exe.png icon_exe.iconset/icon_128x128.png
|
||||||
|
iconutil -c icns icon_exe.iconset
|
||||||
|
cp icon_exe.icns $appdir/Contents/Resources/icon_exe.icns
|
||||||
|
mkdir icon_cps.iconset
|
||||||
|
cp ../resources/generated_icons/icon_cps_16.png icon_cps.iconset/icon_16x16.png
|
||||||
|
cp ../resources/generated_icons/icon_cps_32.png icon_cps.iconset/icon_32x32.png
|
||||||
|
cp ../resources/generated_icons/icon_cps.png icon_cps.iconset/icon_128x128.png
|
||||||
|
iconutil -c icns icon_cps.iconset
|
||||||
|
cp icon_cps.icns $appdir/Contents/Resources/icon_cps.icns
|
||||||
|
mkdir dmgroot
|
||||||
|
mv $appdir dmgroot/$appdir
|
||||||
|
cp ../LICENSE dmgroot/LICENSE
|
||||||
|
cp ../README.md dmgroot/README.md
|
||||||
|
hdiutil create uncompressed.dmg -ov -volname $APP_NAME -fs HFS+ -srcfolder dmgroot
|
||||||
|
hdiutil convert uncompressed.dmg -format UDZO -o $ASSET_PATH
|
||||||
|
elif [[ $PACKAGE_MODE == appimage ]]; then
|
||||||
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
|
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
|
||||||
cp resources/appdata.xml appdata.xml
|
|
||||||
sed -i "s|SUBST_DATE|$(date --iso-8601)|g" appdata.xml
|
|
||||||
sed -i "s|SUBST_SAVE_VERSION|$save_version|g" appdata.xml
|
|
||||||
sed -i "s|SUBST_MINOR_VERSION|$minor_version|g" appdata.xml
|
|
||||||
sed -i "s|SUBST_BUILD_NUM|$build_num|g" appdata.xml
|
|
||||||
case $BSH_HOST_ARCH in
|
case $BSH_HOST_ARCH in
|
||||||
aarch64) appimage_arch=aarch64;;
|
aarch64) appimage_arch=aarch64;;
|
||||||
arm) appimage_arch=armhf ;;
|
arm) appimage_arch=armhf ;;
|
||||||
@@ -361,7 +404,8 @@ if [[ $PACKAGE_MODE == appimage ]]; then
|
|||||||
mv AppRun $appdir/AppRun
|
mv AppRun $appdir/AppRun
|
||||||
cp ../resources/icon_exe.svg $appdir/$APP_VENDOR-$APP_EXE.svg
|
cp ../resources/icon_exe.svg $appdir/$APP_VENDOR-$APP_EXE.svg
|
||||||
cp resources/powder.desktop $appdir/$APP_ID.desktop
|
cp resources/powder.desktop $appdir/$APP_ID.desktop
|
||||||
cp appdata.xml $appdir/usr/share/metainfo/$APP_ID.appdata.xml
|
cp resources/appdata.xml $appdir/usr/share/metainfo/$APP_ID.appdata.xml
|
||||||
|
subst_version $appdir/usr/share/metainfo/$APP_ID.appdata.xml
|
||||||
cp $appdir/$APP_VENDOR-$APP_EXE.svg $appdir/usr/share/icons/$APP_VENDOR-$APP_EXE.svg
|
cp $appdir/$APP_VENDOR-$APP_EXE.svg $appdir/usr/share/icons/$APP_VENDOR-$APP_EXE.svg
|
||||||
cp $appdir/$APP_ID.desktop $appdir/usr/share/applications/$APP_ID.desktop
|
cp $appdir/$APP_ID.desktop $appdir/usr/share/applications/$APP_ID.desktop
|
||||||
./appimagetool $appdir $ASSET_PATH
|
./appimagetool $appdir $ASSET_PATH
|
||||||
|
16
.github/prepare.py
vendored
16
.github/prepare.py
vendored
@@ -87,14 +87,14 @@ for arch, platform, libc, statdyn, bplatform, runson, suff
|
|||||||
( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', None, 'i686-win-msvc-static', 'release' ),
|
( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', None, 'i686-win-msvc-static', 'release' ),
|
||||||
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ),
|
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ),
|
||||||
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'release' ),
|
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'release' ),
|
||||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'debug' ),
|
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'debug' ),
|
||||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, None, 'x86_64-mac-gcc-static', 'release' ), # I have no idea how to separate debug info on macos
|
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '.dmg', True, True, None, 'dmg', 'x86_64-mac-gcc-static', 'release' ), # I have no idea how to separate debug info on macos
|
||||||
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'debug' ),
|
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'debug' ),
|
||||||
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'release' ),
|
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'release' ),
|
||||||
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'debug' ),
|
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'debug' ),
|
||||||
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, None, 'arm64-mac-gcc-static', 'release' ),
|
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '.dmg', True, True, None, 'dmg', 'arm64-mac-gcc-static', 'release' ),
|
||||||
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'debug' ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'debug' ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
||||||
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'release' ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'release' ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
||||||
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', False, False, None, None, None, 'debug' ),
|
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', False, False, None, None, None, 'debug' ),
|
||||||
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', None, 'i686-and-gcc-static', 'release' ),
|
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', None, 'i686-and-gcc-static', 'release' ),
|
||||||
( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', False, False, None, None, None, 'debug' ),
|
( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', False, False, None, None, None, 'debug' ),
|
||||||
|
70
resources/Info.template.plist
Normal file
70
resources/Info.template.plist
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>ptsave</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>Powder Toy Save URL</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>@APPNAME@</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>icon_exe.icns</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright © 2008-2011 Stanislaw K Skowrenek, Copyright © 2011-2022 Simon Robertshaw, Copyright © 2016-2022 jacob1</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>stm</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>icon_cps.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Powder Toy Save</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>cps</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>icon_cps.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Powder Toy Stamp</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>@APPEXE@</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>@APPID@</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>SUBST_SAVE_VERSION.SUBST_MINOR_VERSION</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>SUBST_SAVE_VERSION.SUBST_MINOR_VERSION (build SUBST_BUILD_NUM)</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.9.0</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@@ -62,9 +62,13 @@ if host_platform == 'windows'
|
|||||||
'resource.h',
|
'resource.h',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
endif
|
elif host_platform == 'darwin'
|
||||||
|
configure_file(
|
||||||
if host_platform == 'linux'
|
input: 'Info.template.plist',
|
||||||
|
output: 'Info.plist',
|
||||||
|
configuration: conf_data,
|
||||||
|
)
|
||||||
|
elif host_platform == 'linux'
|
||||||
data_files += to_array.process(rendered_icons['icon_exe'], extra_args: 'icon_exe_png')
|
data_files += to_array.process(rendered_icons['icon_exe'], extra_args: 'icon_exe_png')
|
||||||
data_files += to_array.process(rendered_icons['icon_cps'], extra_args: 'icon_cps_png')
|
data_files += to_array.process(rendered_icons['icon_cps'], extra_args: 'icon_cps_png')
|
||||||
data_files += to_array.process('save.xml', extra_args: 'save_xml')
|
data_files += to_array.process('save.xml', extra_args: 'save_xml')
|
||||||
|
Reference in New Issue
Block a user