name: build

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        image: ["debian:trixie-slim", "ubuntu:noble", "ubuntu:jammy", "ubuntu:focal"]
    container:
      image: ${{ matrix.image }}
    env:
      DEBIAN_FRONTEND: noninteractive
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: Install dependencies
      run: |
        apt-get update -qq
        apt-get install -y --no-install-recommends libgtk2.0-dev libgtk-3-dev libvte-dev libvte-2.91-dev libgtk-layer-shell-dev gcc pkg-config bison flex meson autoconf automake make texinfo
    - name: Copy source
      run: |
        cp -r `pwd` ../gtk3-meson
        cp -r `pwd` ../gtk3-autotools
        cp -r `pwd` ../gtk2-autotools
    - name: Meson build
      run: |
        meson --buildtype=release -Dgtkver=2 build
        ninja -C build
        DESTDIR=/tmp/meson-gtk2 ninja -C build install
        cd ../gtk3-meson
        meson --buildtype=release build
        ninja -C build
        meson configure build -Dbash=true
        ninja -C build
        DESTDIR=/tmp/meson-gtk3 ninja -C build install
    - name: Autotools build
      run: |
        cd ../gtk2-autotools
        ./autogen.sh --prefix=/usr
        make -j`nproc`
        DESTDIR=/tmp/autotools-gtk2 make install
        cd ../gtk3-autotools
        ./autogen.sh --prefix=/usr --enable-gtk3
        make -j`nproc`
        DESTDIR=/tmp/autotools-gtk3 make install
