maomaowm/.github/workflows/build.yml
copilot-swe-agent[bot] 304832e4da Improve version checking logic and documentation
Co-authored-by: squassina <8495707+squassina@users.noreply.github.com>
2026-02-18 10:36:52 +00:00

152 lines
4.8 KiB
YAML

name: Build
on:
push:
branches: [main, master]
paths:
- '**.c'
- '**.h'
- '**.cpp'
- '**.scm'
- 'meson.build'
- 'meson_options.txt'
- 'flake.nix'
- 'protocols/**'
- '.github/workflows/build.yml'
pull_request:
branches: [main, master]
paths:
- '**.c'
- '**.h'
- '**.cpp'
- '**.scm'
- 'meson.build'
- 'meson_options.txt'
- 'flake.nix'
- 'protocols/**'
- '.github/workflows/build.yml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
meson \
ninja-build \
wayland-protocols \
libinput-dev \
libxkbcommon-dev \
libpcre2-dev \
libpixman-1-dev \
libdrm-dev \
libxcb1-dev \
libxcb-icccm4-dev \
xwayland \
hwdata \
libliftoff-dev \
libdisplay-info-dev \
libseat-dev \
libffi-dev \
libexpat1-dev \
libxml2-dev \
pkg-config
- name: Install wayland (try apt first, build from source if needed)
run: |
# Try to install wayland from apt
if sudo apt-get install -y libwayland-dev 2>/dev/null; then
# Check if pkg-config can find wayland-server
if WAYLAND_VERSION=$(pkg-config --modversion wayland-server 2>/dev/null); then
echo "Installed wayland version: $WAYLAND_VERSION"
# Check if version meets requirement (>= 1.23.1)
if dpkg --compare-versions "$WAYLAND_VERSION" ge "1.23.1"; then
echo "✅ wayland $WAYLAND_VERSION from apt meets requirements"
exit 0
else
echo "⚠️ wayland $WAYLAND_VERSION from apt is too old, building from source..."
fi
else
echo "⚠️ pkg-config cannot find wayland-server, building from source..."
fi
else
echo "⚠️ wayland not available in apt, building from source..."
fi
# Build from source if apt package is unavailable or too old
git clone https://gitlab.freedesktop.org/wayland/wayland.git
cd wayland
git checkout 1.23.1
meson setup build/ --prefix=/usr -Ddocumentation=false
sudo ninja -C build/ install
sudo ldconfig
cd ..
echo "✅ Built wayland 1.23.1 from source"
- name: Install wlroots (try apt first, build from source if needed)
run: |
# Try to install wlroots from apt
if sudo apt-get install -y libwlroots-dev 2>/dev/null; then
# Check if pkg-config can find wlroots
if WLROOTS_VERSION=$(pkg-config --modversion wlroots 2>/dev/null); then
echo "Installed wlroots version: $WLROOTS_VERSION"
# Check if version meets requirement (>= 0.19.0)
if dpkg --compare-versions "$WLROOTS_VERSION" ge "0.19.0"; then
echo "✅ wlroots $WLROOTS_VERSION from apt meets requirements"
exit 0
else
echo "⚠️ wlroots $WLROOTS_VERSION from apt is too old, building from source..."
fi
else
echo "⚠️ pkg-config cannot find wlroots, building from source..."
fi
else
echo "⚠️ wlroots not available in apt, building from source..."
fi
# Build from source if apt package is unavailable or too old
git clone https://gitlab.freedesktop.org/wlroots/wlroots.git
cd wlroots
git checkout 0.19.0
meson setup build/ --prefix=/usr
sudo ninja -C build/ install
sudo ldconfig
cd ..
echo "✅ Built wlroots 0.19.0 from source"
- name: Install scenefx (build from source - not in apt)
run: |
# scenefx is not available in Ubuntu apt repositories
# Build from source
git clone -b 0.4.1 https://github.com/wlrfx/scenefx.git
cd scenefx
meson setup build/ --prefix=/usr
sudo ninja -C build/ install
sudo ldconfig
cd ..
echo "✅ Built scenefx 0.4.1 from source"
- name: Configure meson
run: |
meson setup build/ --prefix=/usr
- name: Build project
run: |
ninja -C build/
- name: Build summary
run: |
echo "✅ Build completed successfully!"
echo "Built executables:"
ls -lh build/mango build/mmsg