diff --git a/.github/build.sh b/.github/build.sh index 077a0f412..faf9480ac 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -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;; 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 android_platform=android-30 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 mv android/$APP_EXE.apk $APP_EXE.apk 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 - 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 aarch64) appimage_arch=aarch64;; arm) appimage_arch=armhf ;; @@ -361,7 +404,8 @@ if [[ $PACKAGE_MODE == appimage ]]; then mv AppRun $appdir/AppRun cp ../resources/icon_exe.svg $appdir/$APP_VENDOR-$APP_EXE.svg 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_ID.desktop $appdir/usr/share/applications/$APP_ID.desktop ./appimagetool $appdir $ASSET_PATH diff --git a/.github/prepare.py b/.github/prepare.py index 4c2617b0f..18c954c84 100755 --- a/.github/prepare.py +++ b/.github/prepare.py @@ -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', '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_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', False, False, None, None, 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', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'debug' ), - ( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'release' ), - ( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', False, False, None, None, None, 'debug' ), - ( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, None, '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', '', 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 + ( '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', '.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', '.dmg', False, False, None, 'dmg', None, 'debug' ), + ( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'release' ), + ( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '.dmg', False, False, None, 'dmg', None, 'debug' ), + ( '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', '.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', '.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', 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' ), diff --git a/resources/Info.template.plist b/resources/Info.template.plist new file mode 100644 index 000000000..60709e5e0 --- /dev/null +++ b/resources/Info.template.plist @@ -0,0 +1,70 @@ + + + + + CFBundleURLTypes + + + CFBundleURLSchemes + + ptsave + + CFBundleURLName + Powder Toy Save URL + + + CFBundleName + @APPNAME@ + CFBundleIconFile + icon_exe.icns + NSHumanReadableCopyright + Copyright © 2008-2011 Stanislaw K Skowrenek, Copyright © 2011-2022 Simon Robertshaw, Copyright © 2016-2022 jacob1 + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + stm + + CFBundleTypeIconFile + icon_cps.icns + CFBundleTypeName + Powder Toy Save + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + cps + + CFBundleTypeIconFile + icon_cps.icns + CFBundleTypeName + Powder Toy Stamp + CFBundleTypeRole + Viewer + + + CFBundleExecutable + @APPEXE@ + CFBundleIdentifier + @APPID@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + SUBST_SAVE_VERSION.SUBST_MINOR_VERSION + CFBundleSignature + ???? + CFBundleVersion + SUBST_SAVE_VERSION.SUBST_MINOR_VERSION (build SUBST_BUILD_NUM) + LSMinimumSystemVersion + 10.9.0 + NSPrincipalClass + NSApplication + + diff --git a/resources/meson.build b/resources/meson.build index a37602eac..7d940a190 100644 --- a/resources/meson.build +++ b/resources/meson.build @@ -62,9 +62,13 @@ if host_platform == 'windows' 'resource.h', ], ) -endif - -if host_platform == 'linux' +elif host_platform == 'darwin' + configure_file( + 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_cps'], extra_args: 'icon_cps_png') data_files += to_array.process('save.xml', extra_args: 'save_xml')