Skip to content

Fix LZMA compilation error on Windows #28

Fix LZMA compilation error on Windows

Fix LZMA compilation error on Windows #28

Workflow file for this run

# I have no idea what I'm doing
name: Automatic Build
on:
push:
branches: ['dev', 'autobuild', 'libretro']
paths-ignore: ['*.md', '*.json', '*.png']
pull_request:
branches: ['dev', 'autobuild', 'libretro']
paths-ignore: ['*.md', '*.json', '*.png']
workflow_dispatch:
jobs:
build-windows:
name: Windows
runs-on: windows-latest
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
# zip is just used for artifact compression at the end.
install: >-
base-devel
git
ruby
vim
mingw-w64-x86_64-cmake
mingw-w64-x86_64-meson
mingw-w64-x86_64-autotools
mingw-w64-x86_64-gcc
zip
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
windows/build-mingw64
windows/downloads
key: win-${{ hashFiles('windows/Makefile') }}
- name: Build all dependencies
shell: msys2 {0}
run: |
cd windows
make
- name: Build exe
shell: msys2 {0}
run: |
source windows/vars.sh
meson setup build
cd build
ninja
strip ./mkxp-z.exe
- name: Prepare archive
shell: msys2 {0}
run: |
mkdir build/artifact
cd build/artifact
cp /mingw64/bin/zlib1.dll .
cp ../../windows/build-mingw64/bin/x64-msvcrt-ruby310.dll .
cp -r ../../windows/build-mingw64/lib/ruby/3.1.0 .
mv ./3.1.0 ./stdlib
cp ../mkxp-z.exe .
cp ../../mkxp.json .
cp -r ../../scripts .
cp ../../assets/LICENSE.mkxp-z-with-https.txt .
cd ..
# Zipping before uploading decreases the upload time considerably.
# Unfortunately this results in double-zipping; tracked at:
# https://github.com/actions/upload-artifact/issues/426
zip -r artifact.zip artifact
- uses: actions/upload-artifact@v3
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.zip
build-linux-native:
name: Ubuntu 22.04 x86_64
runs-on: ubuntu-22.04
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
linux/build-x86_64
linux/downloads
key: lin-x86_64-${{ hashFiles('linux/Makefile') }}
- name: Install apt dependencies
run: |
sudo apt update
sudo apt install git build-essential cmake meson autoconf automake libtool pkg-config ruby bison zlib1g-dev libbz2-dev xorg-dev libgl1-mesa-dev libasound2-dev libpulse-dev -y
- name: Build everything else
run: |
cd linux
make
- name: Build executable
run: |
source linux/vars.sh
meson setup build --bindir=. --prefix=$GITHUB_WORKSPACE/build/local
cd build
ninja
ninja install
- name: Prepare archive
run: |
cd build/local
cp -r ../../linux/build-x86_64/lib/ruby/3.1.0 .
mv ./3.1.0 ./stdlib
cp ../../mkxp.json .
cp -r ../../scripts .
cp ../../assets/LICENSE.mkxp-z-with-https.txt .
cd ..
# Zipping before uploading preserves +x permissions.
# Unfortunately this results in double-zipping; tracked at:
# https://github.com/actions/upload-artifact/issues/426
zip -r local.zip local
- uses: actions/upload-artifact@v3
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.zip
build-linux-cross:
name: Ubuntu 22.04 ${{matrix.arch_mkxpz}}
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- arch_mkxpz: armv6
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
experimental: false
- arch_mkxpz: armv7
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
experimental: false
- arch_mkxpz: armv7-neon
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
experimental: false
- arch_mkxpz: arm64
arch_debian: arm64
arch_gcc: aarch64-linux-gnu
experimental: false
- arch_mkxpz: power8le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
experimental: false
- arch_mkxpz: power9le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
experimental: false
- arch_mkxpz: s390x
arch_debian: s390x
arch_gcc: s390x-linux-gnu
# src/util/serial-util.h errors on big-endian targets.
experimental: true
- arch_mkxpz: riscv64
arch_debian: riscv64
arch_gcc: riscv64-linux-gnu
# libjxl/highway compatibility issue, TODO check if fixed in later SDL_image.
# Also probably an OpenSSL arch name issue, which might be fixed by now.
experimental: true
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
linux/build-${{matrix.arch_mkxpz}}
linux/downloads
key: lin-${{matrix.arch_mkxpz}}-${{ hashFiles('linux/Makefile', 'linux/target*', 'linux/toolchain*') }}
- name: Install apt dependencies
run: |
sudo sed -i "s/deb /deb [arch=amd64] /g" /etc/apt/sources.list
sudo dpkg --add-architecture ${{matrix.arch_debian}}
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-updates main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-updates universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-updates multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install git build-essential cmake meson autoconf automake libtool pkg-config ruby bison -y
sudo apt install libdmx-dev:${{matrix.arch_debian}} libfontenc-dev:${{matrix.arch_debian}} libfs-dev:${{matrix.arch_debian}} libice-dev:${{matrix.arch_debian}} libsm-dev:${{matrix.arch_debian}} libx11-dev:${{matrix.arch_debian}} libxau-dev:${{matrix.arch_debian}} libxaw7-dev:${{matrix.arch_debian}} libxcomposite-dev:${{matrix.arch_debian}} libxcursor-dev:${{matrix.arch_debian}} libxdamage-dev:${{matrix.arch_debian}} libxdmcp-dev:${{matrix.arch_debian}} libxext-dev:${{matrix.arch_debian}} libxfixes-dev:${{matrix.arch_debian}} libxfont-dev:${{matrix.arch_debian}} libxft-dev:${{matrix.arch_debian}} libxi-dev:${{matrix.arch_debian}} libxinerama-dev:${{matrix.arch_debian}} libxkbfile-dev:${{matrix.arch_debian}} libxmu-dev:${{matrix.arch_debian}} libxmuu-dev:${{matrix.arch_debian}} libxpm-dev:${{matrix.arch_debian}} libxrandr-dev:${{matrix.arch_debian}} libxrender-dev:${{matrix.arch_debian}} libxres-dev:${{matrix.arch_debian}} libxss-dev:${{matrix.arch_debian}} libxt-dev:${{matrix.arch_debian}} libxtst-dev:${{matrix.arch_debian}} libxv-dev:${{matrix.arch_debian}} libxvmc-dev:${{matrix.arch_debian}} libxxf86dga-dev:${{matrix.arch_debian}} libxxf86vm-dev:${{matrix.arch_debian}} x11proto-dev:${{matrix.arch_debian}} xserver-xorg-dev:${{matrix.arch_debian}} xtrans-dev:${{matrix.arch_debian}} -y
sudo apt install gcc-${{matrix.arch_gcc}} g++-${{matrix.arch_gcc}} zlib1g-dev:${{matrix.arch_debian}} libbz2-dev:${{matrix.arch_debian}} libgl1-mesa-dev:${{matrix.arch_debian}} libasound2-dev:${{matrix.arch_debian}} libpulse-dev:${{matrix.arch_debian}} -y
- name: Build everything else
run: |
cd linux
source target-${{matrix.arch_mkxpz}}.sh
make
- name: Build executable
run: |
source linux/target-${{matrix.arch_mkxpz}}.sh
source linux/vars.sh
meson setup --cross-file linux/$ARCH_MESON_TOOLCHAIN build --bindir=. --prefix=$GITHUB_WORKSPACE/build/local
cd build
ninja
ninja install
cp "$MKXPZ_PREFIX/lib/$("$ARCH_CONFIGURE-objdump" -p local/mkxp-z* | grep -i NEEDED | grep -Eo 'libruby.so.[0-9\.]+')" local/lib*/
cp "/usr/lib/$ARCH_CONFIGURE/$("$ARCH_CONFIGURE-objdump" -p local/lib*/libruby.so* | grep -i NEEDED | grep -Eo 'libcrypt.so.[0-9\.]+')" local/lib*/
- name: Prepare archive
run: |
cd build/local
cp -r ../../linux/build-${{matrix.arch_mkxpz}}/lib/ruby/3.1.0 .
mv ./3.1.0 ./stdlib
cp ../../mkxp.json .
cp -r ../../scripts .
cp ../../assets/LICENSE.mkxp-z-with-https.txt .
cd ..
zip -r local.zip local
- uses: actions/upload-artifact@v3
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.zip
build-macos:
name: macOS
runs-on: macos-latest
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Remove pre-existing homebrew packages
run: brew remove --force $(brew list)
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
macos/Dependencies/build-macosx-x86_64
macos/Dependencies/build-macosx-arm64
macos/Dependencies/build-macosx-universal
macos/Dependencies/downloads
key: mac-${{ hashFiles('macos/Dependencies/*.make', 'macos/Dependencies/*.sh') }}
- name: Install Homebrew tools
run: |
cd macos/Dependencies
brew bundle
- name: Build all dependencies
run: |
cd macos/Dependencies
./setup.sh
- name: Build app
run: |
cd macos
xcodebuild -project mkxp-z.xcodeproj -configuration "Release" -scheme "Universal" -derivedDataPath "$GITHUB_WORKSPACE/build"
- name: Compress app
run: |
cd build/Build/Products/Release
cp ../../../../assets/LICENSE.mkxp-z-with-https.txt ./Z-universal.app/
ditto -c -k --sequesterRsrc --keepParent Z-universal.app Z-universal.app.zip
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: mkxp-z.macos.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}}
path: build/Build/Products/Release/Z-universal.app.zip
build-retro-phase1:
name: Libretro phase 1
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
retro/build
key: retro-phase1-${{ hashFiles('retro/Makefile', 'retro/extra-ruby-bindings.h') }}
- name: Install apt dependencies
run: |
sudo apt update
sudo apt install git curl build-essential automake libtool binaryen wabt zip -y
- name: Download WASI SDK
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
mkdir ${{ runner.temp }}/wasi-sdk
tar xzf ${{ runner.temp }}/wasi-sdk.tar.gz -C ${{ runner.temp }}/wasi-sdk --strip-components=1
rm ${{ runner.temp }}/wasi-sdk.tar.gz
- name: Build phase 1
run: |
cd retro
make WASI_SDK=${{ runner.temp }}/wasi-sdk
- uses: actions/upload-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
build-retro-phase2-windows:
needs: build-retro-phase1
name: Libretro Windows
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: retro-phase1
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: Build phase 2
shell: msys2 {0}
run: |
runner_temp="$(cygpath "$(python -c 'print(r"${{ runner.temp }}")')")"
mkdir "$runner_temp"/retro-phase2
cp retro/core.info "$runner_temp"/retro-phase2/libretro-mkxp-z.info
meson setup build -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
cd build
ninja -v
mv libretro-mkxp-z.dll "$runner_temp"/retro-phase2
- uses: actions/upload-artifact@v4
with:
name: libretro-mkxp-z.windows
path: ${{ runner.temp }}/retro-phase2
build-retro-phase2-linux:
needs: build-retro-phase1
name: Libretro Linux ${{ matrix.arch_mkxpz }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch_mkxpz: x86_64
arch_debian: amd64
arch_gcc: x86_64-linux-gnu
- arch_mkxpz: armv6
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
- arch_mkxpz: armv7
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
- arch_mkxpz: armv7-neon
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
- arch_mkxpz: arm64
arch_debian: arm64
arch_gcc: aarch64-linux-gnu
- arch_mkxpz: power8le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
- arch_mkxpz: power9le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
- arch_mkxpz: s390x
arch_debian: s390x
arch_gcc: s390x-linux-gnu
- arch_mkxpz: riscv64
arch_debian: riscv64
arch_gcc: riscv64-linux-gnu
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
- name: Install apt dependencies
run: |
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
codename=$(grep VERSION_CODENAME /etc/os-release | cut -f 2 -d '=')
sudo sed -i 's/^Types: deb$/Types: deb\nArchitectures: amd64/g' /etc/apt/sources.list.d/ubuntu.sources
sudo dpkg --add-architecture ${{ matrix.arch_debian }}
echo 'Types: deb' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo "Architectures: ${{ matrix.arch_debian }}" | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo 'URIs: http://ports.ubuntu.com/' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo "Suites: $codename $codename-updates" | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo 'Components: main universe' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
fi
sudo apt update
sudo apt install git build-essential meson cmake -y
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
sudo apt install gcc-${{ matrix.arch_gcc }} g++-${{ matrix.arch_gcc }} -y
fi
- name: Build phase 2
run: |
mkdir ${{ runner.temp }}/retro-phase2
cp retro/core.info ${{ runner.temp }}/retro-phase2/libretro-mkxp-z.info
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
cross_arg='--cross-file linux/meson-${{ matrix.arch_mkxpz }}.txt'
else
cross_arg=
fi
meson setup build $cross_arg -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
cd build
ninja -v
mv libretro-mkxp-z.so ${{ runner.temp }}/retro-phase2
- uses: actions/upload-artifact@v4
with:
name: libretro-mkxp-z.linux.${{ matrix.arch_mkxpz }}
path: ${{ runner.temp }}/retro-phase2
build-retro-phase2-macos:
needs: build-retro-phase1
name: Libretro macOS
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
- name: Install dependencies
run: |
brew install -q git meson cmake
- name: Build phase 2
run: |
mkdir ${{ runner.temp }}/retro-phase2
cp retro/core.info ${{ runner.temp }}/retro-phase2/libretro-mkxp-z.info
meson setup build -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
cd build
ninja -v
mv libretro-mkxp-z.dylib ${{ runner.temp }}/retro-phase2
- uses: actions/upload-artifact@v4
with:
name: libretro-mkxp-z.macos
path: ${{ runner.temp }}/retro-phase2