From f03d8e3f5da7658587fbcd7f65c88bd088ca1c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9A=93?= Date: Fri, 31 Jan 2025 23:35:20 -0500 Subject: [PATCH] Embed mkxp-z version into the libretro core --- .github/workflows/autobuild.yml | 312 +++++++++++++++++++------------- meson.build | 4 +- retro/core.info | 1 - src/core.cpp | 2 +- 4 files changed, 191 insertions(+), 128 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index e4766b08..60ccdf90 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -17,10 +17,12 @@ jobs: steps: - uses: benjlevesque/short-sha@v2.2 id: short-sha + name: Get Git commit hash with: length: 7 - - uses: msys2/setup-msys2@v2 + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 with: msystem: mingw64 install: >- @@ -36,7 +38,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/cache@v4 + - name: Restore cache + uses: actions/cache@v4 with: path: | windows/build-mingw64 @@ -72,7 +75,8 @@ jobs: cp -r ../../scripts . cp ../../assets/LICENSE.mkxp-z-with-https.txt . - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: mkxp-z.windows.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} path: build/artifact @@ -83,13 +87,15 @@ jobs: steps: - uses: benjlevesque/short-sha@v2.2 id: short-sha + name: Get Git commit hash with: length: 7 - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/cache@v4 + - name: Restore cache + uses: actions/cache@v4 with: path: | linux/build-x86_64 @@ -124,7 +130,8 @@ jobs: cp -r ../../scripts . cp ../../assets/LICENSE.mkxp-z-with-https.txt . - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: mkxp-z.linux.x86_64.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} path: build/local @@ -175,13 +182,15 @@ jobs: steps: - uses: benjlevesque/short-sha@v2.2 id: short-sha + name: Get Git commit hash with: length: 7 - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/cache@v4 + - name: Restore cache + uses: actions/cache@v4 with: path: | linux/build-${{matrix.arch_mkxpz}} @@ -231,7 +240,8 @@ jobs: cp -r ../../scripts . cp ../../assets/LICENSE.mkxp-z-with-https.txt . - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: mkxp-z.linux.${{matrix.arch_mkxpz}}.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} path: build/local @@ -242,6 +252,7 @@ jobs: steps: - uses: benjlevesque/short-sha@v2.2 id: short-sha + name: Get Git commit hash with: length: 7 @@ -251,7 +262,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/cache@v4 + - name: Restore cache + uses: actions/cache@v4 with: path: | macos/Dependencies/build-macosx-x86_64 @@ -292,6 +304,7 @@ jobs: runs-on: ubuntu-latest steps: - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -300,19 +313,20 @@ jobs: uses: actions/checkout@v4 - id: cache + name: Restore cache uses: actions/cache@v4 with: path: | retro/build/retro-phase1 key: retro-phase1-${{ hashFiles('retro/Makefile', 'retro/ruby-bindings.h', 'retro/sandbox-bindgen.rb') }} - - name: Install apt dependencies + - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' run: | sudo apt update sudo apt install -y git curl build-essential automake libtool binaryen wabt zip universal-ctags - - name: Download WASI SDK + - name: Set up WASI SDK if: steps.cache.outputs.cache-hit != 'true' run: | curl -Lo ${{ runner.temp }}/wasi-sdk.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz @@ -326,7 +340,8 @@ jobs: cd retro make -j $(nproc) WASI_SDK=${{ runner.temp }}/wasi-sdk - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 @@ -336,7 +351,14 @@ jobs: name: LR Windows runs-on: windows-latest steps: + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-meson mingw-w64-x86_64-cmake + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -344,29 +366,29 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - uses: msys2/setup-msys2@v2 - with: - msystem: mingw64 - install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-meson mingw-w64-x86_64-cmake + - name: Configure core + shell: msys2 {0} + run: | + meson setup build --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 - name: Build core shell: msys2 {0} run: | runner_temp="$(cygpath '${{ runner.temp }}')" mkdir "$runner_temp"/retro-phase2 - cp retro/core.info "$runner_temp"/retro-phase2/mkxp-z_libretro.info - meson setup build --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 cd build ninja -v strip libretro-mkxp-z.dll mv libretro-mkxp-z.dll "$runner_temp"/retro-phase2/mkxp-z_libretro.dll - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.windows.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ${{ runner.temp }}/retro-phase2 @@ -407,20 +429,7 @@ jobs: arch_debian: amd64 arch_gcc: x86_64-linux-gnu steps: - - id: short-sha - uses: benjlevesque/short-sha@v2.2 - with: - length: 7 - - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} - path: retro/build/retro-phase1 - - - name: Install apt dependencies + - name: Install dependencies run: | if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ] then @@ -440,10 +449,23 @@ jobs: sudo apt install -y gcc-${{ matrix.arch_gcc }} g++-${{ matrix.arch_gcc }} fi - - name: Build core + - id: short-sha + name: Get Git commit hash + uses: benjlevesque/short-sha@v2.2 + with: + length: 7 + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download phase 1 + uses: actions/download-artifact@v4 + with: + name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} + path: retro/build/retro-phase1 + + - name: Configure core run: | - mkdir ${{ runner.temp }}/retro-phase2 - cp retro/core.info ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.info if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ] then cross_arg='--cross-file linux/meson-${{ matrix.arch_mkxpz }}.txt' @@ -451,6 +473,10 @@ jobs: cross_arg= fi meson setup build $cross_arg --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ${{ runner.temp }}/retro-phase2 cd build ninja -v if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ] @@ -461,7 +487,8 @@ jobs: fi mv libretro-mkxp-z.so ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.so - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.linux-gnu.${{ matrix.arch_mkxpz }}.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ${{ runner.temp }}/retro-phase2 @@ -535,7 +562,13 @@ jobs: cpu: x86_64 endian: little steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y git build-essential clang llvm meson cmake + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -543,16 +576,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install apt dependencies - run: | - sudo apt update - sudo apt install -y git build-essential clang llvm meson cmake - - name: Set up sysroot id: sysroot uses: jirutka/setup-alpine@v1 @@ -561,7 +590,7 @@ jobs: branch: latest-stable packages: build-base - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ${{ runner.temp }}/cross.ini echo "c = ['clang', '--target=${{ matrix.arch_llvm }}', '-fuse-ld=lld', '--sysroot=${{ steps.sysroot.outputs.root-path }}']" | tee -a ${{ runner.temp }}/cross.ini @@ -576,16 +605,18 @@ jobs: echo "[properties]" | tee -a ${{ runner.temp }}/cross.ini echo "sys_root = '${{ steps.sysroot.outputs.root-path }}'" | tee -a ${{ runner.temp }}/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ${{ runner.temp }}/retro-phase2 - cp retro/core.info ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.info meson setup build --cross-file ${{ runner.temp }}/cross.ini --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ${{ runner.temp }}/retro-phase2 cd build ninja -v llvm-strip libretro-mkxp-z.so mv libretro-mkxp-z.so ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.so - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.linux-musl.${{ matrix.arch_mkxpz }}.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ${{ runner.temp }}/retro-phase2 @@ -623,7 +654,20 @@ jobs: cpu: x86_64 endian: little steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y git build-essential llvm meson cmake + + - id: ndk + name: Set up Android NDK + uses: nttld/setup-ndk@v1 + with: + ndk-version: r27c + add-to-path: false + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -631,23 +675,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install apt dependencies - run: | - sudo apt update - sudo apt install -y git build-essential llvm meson cmake - - - id: ndk - uses: nttld/setup-ndk@v1 - with: - ndk-version: r27c - add-to-path: false - - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ${{ runner.temp }}/cross.ini echo "c = '${{ steps.ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.arch_llvm }}-clang'" | tee -a ${{ runner.temp }}/cross.ini @@ -662,16 +696,18 @@ jobs: echo "[cmake]" | tee -a ${{ runner.temp }}/cross.ini echo "CMAKE_SYSTEM_PROCESSOR = '${{ matrix.arch_cmake }}'" | tee -a ${{ runner.temp }}/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ${{ runner.temp }}/retro-phase2 - cp retro/core.info ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.info ANDROID_NDK=${{ steps.ndk.outputs.ndk-path }} meson setup build --cross-file ${{ runner.temp }}/cross.ini --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ${{ runner.temp }}/retro-phase2 cd build ninja -v llvm-strip libretro-mkxp-z.so mv libretro-mkxp-z.so ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.so - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.android.${{ matrix.arch_mkxpz }}.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ${{ runner.temp }}/retro-phase2 @@ -695,7 +731,12 @@ jobs: cpu: x86_64 endian: little steps: + - name: Install dependencies + run: | + brew install -q git gpatch meson cmake + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -703,16 +744,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install dependencies - run: | - brew install -q git gpatch meson cmake - - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ${{ runner.temp }}/cross.ini echo "c = ['clang', '--target=${{ matrix.arch_llvm }}']" | tee -a ${{ runner.temp }}/cross.ini @@ -725,16 +763,18 @@ jobs: echo "cpu = '${{ matrix.cpu }}'" | tee -a ${{ runner.temp }}/cross.ini echo "endian = '${{ matrix.endian }}'" | tee -a ${{ runner.temp }}/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ${{ runner.temp }}/retro-phase2 - cp retro/core.info ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.info PATH="$HOMEBREW_PREFIX/opt/gpatch/libexec/gnubin:$PATH" meson setup build --cross-file ${{ runner.temp }}/cross.ini --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ${{ runner.temp }}/retro-phase2 cd build ninja -v strip -x libretro-mkxp-z.dylib mv libretro-mkxp-z.dylib ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.dylib - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.darwin.${{ matrix.arch_mkxpz }}.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ${{ runner.temp }}/retro-phase2 @@ -744,7 +784,18 @@ jobs: name: LR Emscripten runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y git build-essential meson cmake + + - name: Set up Emscripten SDK + uses: mymindstorm/setup-emsdk@v14 + with: + version: 3.1.46 + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -752,21 +803,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install apt dependencies - run: | - sudo apt update - sudo apt install -y git build-essential meson cmake - - - uses: mymindstorm/setup-emsdk@v14 - with: - version: 3.1.46 - - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ${{ runner.temp }}/cross.ini echo "c = 'emcc'" | tee -a ${{ runner.temp }}/cross.ini @@ -779,10 +822,11 @@ jobs: echo "cpu = 'wasm32'" | tee -a ${{ runner.temp }}/cross.ini echo "endian = 'little'" | tee -a ${{ runner.temp }}/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ${{ runner.temp }}/retro-phase2 - cp retro/core.info ${{ runner.temp }}/retro-phase2/mkxp-z_libretro.info meson setup build --cross-file ${{ runner.temp }}/cross.ini --default-library static --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ${{ runner.temp }}/retro-phase2 cd build ninja -v @@ -811,7 +855,8 @@ jobs: mv mkxp-z_libretro.wasm ${{ runner.temp }}/retro-phase2 mv mkxp-z_libretro.js ${{ runner.temp }}/retro-phase2 - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.emscripten.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ${{ runner.temp }}/retro-phase2 @@ -822,7 +867,13 @@ jobs: runs-on: ubuntu-latest container: vitasdk/vitasdk:latest steps: + - name: Install dependencies + run: | + apk update + apk add git build-base meson cmake + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -830,17 +881,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install dependencies - run: | - apk update - apk add git build-base meson cmake - - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ~/cross.ini echo "c = 'arm-vita-eabi-gcc'" | tee -a ~/cross.ini @@ -852,15 +899,18 @@ jobs: echo "cpu = 'generic-armv7-a'" | tee -a ~/cross.ini echo "endian = 'little'" | tee -a ~/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ~/retro-phase2 - cp retro/core.info ~/retro-phase2/mkxp-z_libretro.info + git config --global --add safe.directory "$(pwd)" meson setup build --cross-file ~/cross.ini --default-library static -Db_staticpic=false --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ~/retro-phase2 cd build ninja -v mv libretro-mkxp-z.a ~/retro-phase2/mkxp-z_libretro.a - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.vita.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ~/retro-phase2 @@ -871,7 +921,15 @@ jobs: runs-on: ubuntu-latest container: devkitpro/devkitppc:latest steps: + - name: Install dependencies + run: | + apt update + apt install -y git build-essential pip ninja-build + apt remove -y meson cmake + pip install meson cmake + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -879,18 +937,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install dependencies - run: | - apt update - apt install -y git build-essential pip ninja-build cmake - pip install meson - - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ~/cross.ini echo "c = '/opt/devkitpro/devkitPPC/bin/powerpc-eabi-gcc'" | tee -a ~/cross.ini @@ -902,15 +955,18 @@ jobs: echo "cpu = 'ppc'" | tee -a ~/cross.ini echo "endian = 'big'" | tee -a ~/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ~/retro-phase2 - cp retro/core.info ~/retro-phase2/mkxp-z_libretro.info + git config --global --add safe.directory "$(pwd)" meson setup build --cross-file ~/cross.ini --default-library static --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ~/retro-phase2 cd build ninja -v mv libretro-mkxp-z.a ~/retro-phase2/mkxp-z_libretro.a - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.wiiu.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ~/retro-phase2 @@ -921,7 +977,15 @@ jobs: runs-on: ubuntu-latest container: devkitpro/devkita64:latest steps: + - name: Install dependencies + run: | + apt update + apt install -y git build-essential pip ninja-build + apt remove -y meson cmake + pip install meson cmake + - id: short-sha + name: Get Git commit hash uses: benjlevesque/short-sha@v2.2 with: length: 7 @@ -929,18 +993,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download phase 1 + uses: actions/download-artifact@v4 with: name: retro-phase1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: retro/build/retro-phase1 - - name: Install dependencies - run: | - apt update - apt install -y git build-essential pip ninja-build cmake - pip install meson - - - name: Build core + - name: Configure core run: | echo "[binaries]" | tee -a ~/cross.ini echo "c = '/opt/devkitpro/devkitA64/bin/aarch64-none-elf-gcc'" | tee -a ~/cross.ini @@ -952,16 +1011,19 @@ jobs: echo "cpu = 'generic-armv8-a'" | tee -a ~/cross.ini echo "endian = 'little'" | tee -a ~/cross.ini echo '--------------------------------------------------------------------------------' - - mkdir ~/retro-phase2 - cp retro/core.info ~/retro-phase2/mkxp-z_libretro.info + git config --global --add safe.directory "$(pwd)" # Enabling LTO with devkitA64 causes "plugin needed to handle lto object" linker error meson setup build --cross-file ~/cross.ini --default-library static --buildtype release -Db_lto=false -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 + + - name: Build core + run: | + mkdir ~/retro-phase2 cd build ninja -v mv libretro-mkxp-z.a ~/retro-phase2/mkxp-z_libretro.a - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: libretro-mkxp-z.switch.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: ~/retro-phase2 diff --git a/meson.build b/meson.build index cfc890b0..d4fce7a5 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ if get_option('retro') == false and host_system == 'darwin' error('\nThis Meson project no longer supports macOS. Please use the Xcode project instead.') endif -git_hash = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip() +git_hash = run_command('git', 'rev-parse', '--short', 'HEAD', check: true).stdout().strip() compilers = {'cpp': meson.get_compiler('cpp')} @@ -148,6 +148,8 @@ if get_option('retro') == true }) retro_defines = [ + '-DMKXPZ_VERSION="@0@"'.format(meson.project_version()), + '-DMKXPZ_GIT_HASH="@0@"'.format(git_hash), '-DWASM_RT_SKIP_SIGNAL_RECOVERY', '-DWASM_RT_TRAP_HANDLER=mkxp_sandbox_trap_handler', '-DMKXPZ_RETRO', diff --git a/retro/core.info b/retro/core.info index ef066ffc..f7bc6995 100644 --- a/retro/core.info +++ b/retro/core.info @@ -6,7 +6,6 @@ corename = "mkxp-z" categories = "Game engine" license = "GPLv2" permissions = "" -display_version = "rolling" # Hardware Information systemname = "RPG Maker XP/VX/VX Ace Game Engine" diff --git a/src/core.cpp b/src/core.cpp index 46c1d1ae..81a5f25d 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -326,7 +326,7 @@ extern "C" RETRO_API unsigned int retro_api_version() { extern "C" RETRO_API void retro_get_system_info(struct retro_system_info *info) { std::memset(info, 0, sizeof *info); info->library_name = "mkxp-z"; - info->library_version = "rolling"; + info->library_version = MKXPZ_VERSION "/" MKXPZ_GIT_HASH; info->valid_extensions = "mkxp|mkxpz|json|ini|rxproj|rvproj|rvproj2"; info->need_fullpath = true; info->block_extract = true;