Skip to content

.github/workflows: add build actions (ffglitch-0.10.2) #19

.github/workflows: add build actions (ffglitch-0.10.2)

.github/workflows: add build actions (ffglitch-0.10.2) #19

name: windows-x86_64 build
on:
push:
branches:
- ffedit-0.10.2-gha
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 mingw-w64-tools nasm
- name: Create mingw-w64_toolchain.cmake
run: |
cat <<EOF > mingw-w64_toolchain.cmake
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
set(CMAKE_C_COMPILER \${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER \${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER \${TOOLCHAIN_PREFIX}-windres)
set(CMAKE_FIND_ROOT_PATH /usr/\${TOOLCHAIN_PREFIX} /usr/lib/gcc/\${TOOLCHAIN_PREFIX}/12-posix)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_INSTALL_PREFIX /usr/\${TOOLCHAIN_PREFIX} CACHE FILEPATH "install path prefix")
EOF
shell: bash
- name: Build static zlib-ng
run: |
ZLIB_NG_VERSION="2.2.2"
curl -L "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/${ZLIB_NG_VERSION}.tar.gz" -o zlib-ng.tar.gz
tar xf zlib-ng.tar.gz
cd zlib-ng-${ZLIB_NG_VERSION}
mkdir build
cd build
cmake .. -DZLIB_COMPAT=ON -DWITH_GTEST=OFF -DBUILD_SHARED_LIBS=OFF -DZLIB_ENABLE_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE=../mingw-w64_toolchain.cmake
make -j$(nproc)
sudo make install
- name: Build static SDL2
run: |
SDL2_VERSION="2.30.8"
curl -L "https://github.com/libsdl-org/SDL/releases/download/release-${SDL2_VERSION}/SDL2-${SDL2_VERSION}.tar.gz" -o SDL2.tar.gz
tar xf SDL2.tar.gz
cd SDL2-${SDL2_VERSION}
mkdir build
cd build
../configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 --enable-static --disable-shared
make -j$(nproc)
sudo make install
- name: Build project
run: |
mkdir build
cd build
../configure --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw64 --extra-ldflags=-static --pkg-config-flags=--static --disable-doc --enable-gpl --enable-static --disable-shared --disable-autodetect --disable-iconv --enable-zlib --enable-libxvid --enable-rtmidi --enable-libzmq --enable-sdl2
make -j$(nproc)
make -j$(nproc) qjs.exe
- name: Package binaries
run: |
VERSION=$(cat FFGLITCH_VERSION)
VERSION_NUMBERS=$(echo "${VERSION}" | sed 's/^[^-]*-//')
FULL_NAME="${VERSION}-windows-x86_64"
OUTPUT_FILE="${FULL_NAME}.zip"
ZLIB_NG_VERSION="2.2.2"
SDL2_VERSION="$(x86_64-w64-mingw32-pkg-config --modversion sdl2)"
sed s/FFGLITCH_VERSION/"${VERSION_NUMBERS}"/g -i ffglitch_readme.txt
sed s/PLATFORM/Windows/g -i ffglitch_readme.txt
sed s/ARCH/x86_64/g -i ffglitch_readme.txt
sed s/ZLIB_NG_VERSION/"${ZLIB_NG_VERSION}"/g -i ffglitch_readme.txt
sed s/SDL2_VERSION/"${SDL2_VERSION}"/g -i ffglitch_readme.txt
cd build
mkdir "${FULL_NAME}"
cp ffedit.exe ffgac.exe fflive.exe qjs.exe "${FULL_NAME}"
cp ../ffglitch_readme.txt "${FULL_NAME}"/readme.txt
zip -9 -r "../${OUTPUT_FILE}" "${FULL_NAME}"
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: "${{ github.workspace }}/ffglitch-*-windows-x86_64.zip"