diff --git a/.github/build.sh b/.github/build.sh index 27355cab0..f650dfed0 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -43,8 +43,8 @@ if [[ -z ${SEPARATE_DEBUG-} ]]; then >&2 echo "SEPARATE_DEBUG not set" exit 1 fi -if [[ -z ${BUILD_PACKAGE-} ]]; then - >&2 echo "BUILD_PACKAGE not set" +if [[ -z ${PACKAGE_MODE-} ]]; then + >&2 echo "PACKAGE_MODE not set" exit 1 fi if [[ -z ${ASSET_PATH-} ]]; then @@ -55,14 +55,6 @@ if [[ -z ${DEBUG_ASSET_PATH-} ]]; then >&2 echo "DEBUG_ASSET_PATH not set" exit 1 fi -if [[ -z ${PACKAGE_ASSET_PATH-} ]]; then - >&2 echo "PACKAGE_ASSET_PATH not set" - exit 1 -fi -if [[ -z ${PACKAGE_DEBUG_ASSET_PATH-} ]]; then - >&2 echo "PACKAGE_DEBUG_ASSET_PATH not set" - exit 1 -fi case $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC in x86_64-linux-gnu-static) ;; @@ -335,6 +327,19 @@ meson_configure+=$'\t'-Dc_link_args=[$c_link_args] meson_configure+=$'\t'-Dcpp_link_args=[$c_link_args] $meson_configure build cd build +strip=strip +objcopy=objcopy +strip_target=$ASSET_PATH +if [[ $BSH_HOST_PLATFORM == android ]]; then + strip=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$strip + objcopy=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$objcopy + strip_target=libpowder.so +fi +if [[ $PACKAGE_MODE == appimage ]]; then + # so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later + meson configure -Dinstall_check=false -Dignore_updates=true -Dbuild_render=false -Dbuild_font=false + strip_target=powder +fi if [[ $BSH_BUILD_PLATFORM == windows ]]; then set +e ninja -v -d keeprsp @@ -346,25 +351,11 @@ else ninja -v fi -strip=strip -objcopy=objcopy -function separate_debug() { - local binary=$1 - local debug=$2 - $objcopy --only-keep-debug $binary $debug - $strip --strip-debug --strip-unneeded $binary - $objcopy --add-gnu-debuglink $debug $binary - chmod -x $debug -} - -strip_target=$ASSET_PATH -if [[ $BSH_HOST_PLATFORM == android ]]; then - strip=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$strip - objcopy=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$objcopy - strip_target=libpowder.so -fi if [[ $SEPARATE_DEBUG == yes ]] && [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-msvc ]]; then - separate_debug $strip_target $DEBUG_ASSET_PATH + $objcopy --only-keep-debug $strip_target $DEBUG_ASSET_PATH + $strip --strip-debug --strip-unneeded $strip_target + $objcopy --add-gnu-debuglink $DEBUG_ASSET_PATH $strip_target + chmod -x $DEBUG_ASSET_PATH fi if [[ $BSH_HOST_PLATFORM == android ]]; then $JAVA_HOME_8_X64/bin/keytool -genkeypair -keystore keystore.jks -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -keypass bagelsbagels -storepass bagelsbagels -dname "CN=nobody" @@ -372,13 +363,8 @@ if [[ $BSH_HOST_PLATFORM == android ]]; then ANDROID_KEYSTORE_PASS=bagelsbagels ninja android/powder.apk mv android/powder.apk powder.apk fi -if [[ $BUILD_PACKAGE == yes ]]; then +if [[ $PACKAGE_MODE == appimage ]]; then # so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later - meson configure -Dinstall_check=false -Dignore_updates=true -Dbuild_render=false -Dbuild_font=false - ninja -v - if [[ $SEPARATE_DEBUG == yes ]]; then - separate_debug $ASSET_PATH $PACKAGE_DEBUG_ASSET_PATH - fi 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 @@ -406,5 +392,5 @@ if [[ $BUILD_PACKAGE == yes ]]; then cp appdata.xml $appdir/usr/share/metainfo/uk.co.powdertoy.tpt.appdata.xml cp $appdir/powder.png $appdir/usr/share/icons/powder.png cp $appdir/uk.co.powdertoy.tpt.desktop $appdir/usr/share/applications/uk.co.powdertoy.tpt.desktop - ./appimagetool $appdir $PACKAGE_ASSET_PATH + ./appimagetool $appdir $ASSET_PATH fi diff --git a/.github/prepare.py b/.github/prepare.py index e790d8609..52e51faea 100755 --- a/.github/prepare.py +++ b/.github/prepare.py @@ -45,77 +45,97 @@ with open('.github/mod_id.txt') as f: build_matrix = [] publish_matrix = [] # consider disabling line wrapping to edit this monstrosity -for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_build_platform, runs_on, package_suffix, publish, artifact, debug_suffix, starcatcher_suffix, build_package in [ - ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', True, True, '.dbg', 'x86_64-lin-gcc-static', True ), - ( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, '', False ), -# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', '', False ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them - ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, '', False ), - ( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, True, '.dbg', '', False ), - ( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), - ( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', 'x86_64-win-msvc-static', False ), - ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), - ( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', 'i686-win-msvc-static', False ), - ( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, '', False ), - ( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, 'x86_64-mac-gcc-static', False ), # I have no idea how to separate debug info on macos - ( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, '', False ), - ( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-11.0', '', True, True, None, 'arm64-mac-gcc-static', False ), -# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-11.0', '', False, False, None, '', False ), # 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', True, True, '.dbg', 'i686-and-gcc-static', False ), - ( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'x86_64-and-gcc-static', False ), - ( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'arm-and-gcc-static', False ), - ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', 'arm64-and-gcc-static', False ), +for arch, platform, libc, statdyn, bplatform, runson, suffix, publish, artifact, dbgsuffix, mode, starcatcher, dbgrel in [ + ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', True, True, '.dbg', None, 'x86_64-lin-gcc-static', 'release' ), + ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', False, True, '.dbg', 'appimage', None, 'release' ), + ( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, None, None, 'release' ), +# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'debug' ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them +# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', None, None, 'release' ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them + ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'release' ), + ( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, True, '.dbg', None, None, 'release' ), + ( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'release' ), + ( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', True, True, '.pdb', None,'x86_64-win-msvc-static', 'release' ), + ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ), + ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'release' ), + ( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug' ), + ( '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', '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' ), + ( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', None, 'x86_64-and-gcc-static', 'release' ), + ( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', False, False, None, None, None, 'debug' ), + ( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', None, 'arm-and-gcc-static', 'release' ), + ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', False, False, None, None, None, 'debug' ), + ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-18.04', '.apk', True, True, '.dbg', None, 'arm64-and-gcc-static', 'release' ), ]: + if not mode: + mode = 'default' separate_debug = True - if not debug_suffix: - debug_suffix = '' + if not dbgsuffix: + dbgsuffix = 'BOGUS' separate_debug = False + if not starcatcher: + starcatcher = 'BOGUS' if publish: assert artifact - for debug_release in [ 'debug', 'release' ]: - publish_release = publish and debug_release == 'release' - artifact_release = artifact and debug_release == 'release' - asset_path = f'powder{package_suffix}' - asset_name = f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{package_suffix}' - debug_asset_path = f'powder{debug_suffix}' - debug_asset_name = f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{debug_suffix}' - package_asset_path = f'The_Powder_Toy-{bsh_host_arch}.AppImage' - package_asset_name = f'The_Powder_Toy-{bsh_host_arch}.AppImage' - package_debug_asset_path = f'The_Powder_Toy-{bsh_host_arch}.AppImage.dbg' - package_debug_asset_name = f'The_Powder_Toy-{bsh_host_arch}.AppImage.dbg' - starcatcher_name = f'powder-{release_name}-{starcatcher_suffix}{package_suffix}' - build_matrix.append({ - 'bsh_build_platform': bsh_build_platform, # part of the unique portion of the matrix - 'bsh_host_arch': bsh_host_arch, # part of the unique portion of the matrix - 'bsh_host_platform': bsh_host_platform, # part of the unique portion of the matrix - 'bsh_host_libc': bsh_host_libc, # part of the unique portion of the matrix - 'bsh_static_dynamic': bsh_static_dynamic, # part of the unique portion of the matrix - 'bsh_debug_release': debug_release, # part of the unique portion of the matrix - 'runs_on': runs_on, - 'package_suffix': package_suffix, - 'publish': publish_release and 'yes' or 'no', - 'artifact': artifact_release and 'yes' or 'no', - 'separate_debug': separate_debug and 'yes' or 'no', - 'build_package': build_package and 'yes' or 'no', + if dbgrel != 'release': + assert not publish + assert not artifact + asset_path = f'powder{suffix}' + asset_name = f'powder-{release_name}-{arch}-{platform}-{libc}{suffix}' + debug_asset_path = f'powder{dbgsuffix}' + debug_asset_name = f'powder-{release_name}-{arch}-{platform}-{libc}{dbgsuffix}' + if mode == 'appimage': + asset_path = f'The_Powder_Toy-{arch}.AppImage' + asset_name = f'The_Powder_Toy-{arch}.AppImage' + debug_asset_path = f'The_Powder_Toy-{arch}.AppImage.dbg' + debug_asset_name = f'The_Powder_Toy-{arch}.AppImage.dbg' + starcatcher_name = f'powder-{release_name}-{starcatcher}{suffix}' + build_matrix.append({ + 'bsh_build_platform': bplatform, # part of the unique portion of the matrix + 'bsh_host_arch': arch, # part of the unique portion of the matrix + 'bsh_host_platform': platform, # part of the unique portion of the matrix + 'bsh_host_libc': libc, # part of the unique portion of the matrix + 'bsh_static_dynamic': statdyn, # part of the unique portion of the matrix + 'bsh_debug_release': dbgrel, # part of the unique portion of the matrix + 'runs_on': runson, + 'package_suffix': suffix, + 'package_mode': mode, + 'publish': publish and 'yes' or 'no', + 'artifact': artifact and 'yes' or 'no', + 'separate_debug': separate_debug and 'yes' or 'no', + 'asset_path': asset_path, + 'asset_name': asset_name, + 'debug_asset_path': debug_asset_path, + 'debug_asset_name': debug_asset_name, + }) + if publish: + publish_matrix.append({ + 'bsh_build_platform': bplatform, # part of the unique portion of the matrix + 'bsh_host_arch': arch, # part of the unique portion of the matrix + 'bsh_host_platform': platform, # part of the unique portion of the matrix + 'bsh_host_libc': libc, # part of the unique portion of the matrix + 'bsh_static_dynamic': statdyn, # part of the unique portion of the matrix 'asset_path': asset_path, 'asset_name': asset_name, - 'debug_asset_path': debug_asset_path, - 'debug_asset_name': debug_asset_name, - 'package_asset_path': package_asset_path, - 'package_asset_name': package_asset_name, - 'package_debug_asset_path': package_debug_asset_path, - 'package_debug_asset_name': package_debug_asset_name, + 'starcatcher_name': starcatcher_name, }) - if publish_release: - publish_matrix.append({ - 'bsh_build_platform': bsh_build_platform, # part of the unique portion of the matrix - 'bsh_host_arch': bsh_host_arch, # part of the unique portion of the matrix - 'bsh_host_platform': bsh_host_platform, # part of the unique portion of the matrix - 'bsh_host_libc': bsh_host_libc, # part of the unique portion of the matrix - 'bsh_static_dynamic': bsh_static_dynamic, # part of the unique portion of the matrix - 'asset_path': asset_path, - 'asset_name': asset_name, - 'starcatcher_name': starcatcher_name, - }) set_output('build_matrix', json.dumps({ 'include': build_matrix })) set_output('publish_matrix', json.dumps({ 'include': publish_matrix })) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index da7d4afa3..c581f0b99 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -78,11 +78,9 @@ jobs: RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }} MOD_ID: ${{ needs.prepare.outputs.mod_id }} SEPARATE_DEBUG: ${{ matrix.separate_debug }} - BUILD_PACKAGE: ${{ matrix.build_package }} + PACKAGE_MODE: ${{ matrix.package_mode }} ASSET_PATH: ${{ matrix.asset_path }} DEBUG_ASSET_PATH: ${{ matrix.debug_asset_path }} - PACKAGE_ASSET_PATH: ${{ matrix.package_asset_path }} - PACKAGE_DEBUG_ASSET_PATH: ${{ matrix.package_debug_asset_path }} - uses: LBPHacker/upload-release-asset@v2 # TODO-NTL: ship licenses if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' env: @@ -111,16 +109,6 @@ jobs: with: path: build/${{ matrix.debug_asset_path }} name: ${{ matrix.debug_asset_name }} - - uses: actions/upload-artifact@v3 - if: matrix.artifact == 'yes' && matrix.build_package == 'yes' - with: - path: build/${{ matrix.package_asset_path }} - name: ${{ matrix.package_asset_name }} - - uses: actions/upload-artifact@v3 - if: matrix.artifact == 'yes' && matrix.build_package == 'yes' && matrix.separate_debug == 'yes' - with: - path: build/${{ matrix.package_debug_asset_path }} - name: ${{ matrix.package_debug_asset_name }} publish: runs-on: ubuntu-latest needs: [build, prepare]