name: Build (Arch Linux)
on: [push]

env:
  BUILD_TYPE: Release
  CFLAGS: -static -static-libgcc -static-libstdc++
  CXXFLAGS: -static -static-libgcc -static-libstdc++
  CC: /usr/bin/gcc
  CXX: /usr/bin/g++
  AS: /usr/bin/as

jobs:
  build:
    runs-on: archlinux-latest
    steps:
      - name: Install prerequisite packages
        run: pacman -Syu --noconfirm && pacman -S --noconfirm git base-devel cmake ninja rustup nodejs mesa wayland libx11 libxkbcommon libxrandr libxinerama libxcursor libxi
      - name: Install bin2hpp
        run: rustup install stable && cargo install --locked --profile release --root /usr/local/ --git https://github.com/twokilohertz/bin2hpp.git --branch master
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Configure CMake
        run: cmake -B ${{ gitea.workspace }}/build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER=${{ env.CC }} -DCMAKE_CXX_COMPILER=${{ env.CXX }} -DBUILD_SHARED_LIBS=OFF
      - name: Build
        run: cd ${{ gitea.workspace }}/build && ninja
