Add meson build system #179
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: GPL-2.0 | |
| # | |
| # Copyright (c) 2021 Canonical Ltd. | |
| # Copyright (c) 2023-2024 Linaro Ltd. | |
| # Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | |
| # <krzk@kernel.org> | |
| # Copyright (c) 2025 Krzysztof Kozlowski <krzk@kernel.org> | |
| # Loosely based on https://github.com/linux-test-project/ltp | |
| # | |
| name: "Builds" | |
| on: | |
| pull_request: | |
| push: | |
| schedule: | |
| # Run at 1:01 AM, every Tuesday | |
| - cron: '1 1 * * 2' | |
| workflow_dispatch: | |
| jobs: | |
| job: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [x86-64] | |
| compiler: [gcc, clang] | |
| container: | |
| - alpine:latest | |
| - archlinux:latest | |
| - debian:testing | |
| - debian:stable | |
| - debian:forky | |
| - debian:trixie | |
| - debian:bookworm | |
| # Fails on configure on GCC and clang (process restrictions?) | |
| # - fedora:rawhide | |
| - fedora:latest | |
| - fedora:44 | |
| - fedora:43 | |
| - ubuntu:latest | |
| - ubuntu:resolute | |
| - ubuntu:noble | |
| - ubuntu:jammy | |
| cross_compile: [""] | |
| mode: [maintainer, no-maintainer] | |
| variant: [""] | |
| include: | |
| # Debian 32-bit builds | |
| - container: "debian:testing" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "debian:testing" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "debian:stable" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "debian:stable" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "debian:trixie" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "debian:trixie" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "debian:forky" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "debian:forky" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "debian:bookworm" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "debian:bookworm" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| # Debian cross compilation builds | |
| - container: "debian:stable" | |
| arch: armhf | |
| compiler: arm-linux-gnueabihf-gcc | |
| cross_compile: arm-linux-gnueabihf | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:stable" | |
| arch: arm64 | |
| compiler: aarch64-linux-gnu-gcc | |
| cross_compile: aarch64-linux-gnu | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:stable" | |
| arch: ppc64el | |
| compiler: powerpc64le-linux-gnu-gcc | |
| cross_compile: powerpc64le-linux-gnu | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:stable" | |
| arch: s390x | |
| compiler: s390x-linux-gnu-gcc | |
| cross_compile: s390x-linux-gnu | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:bookworm" | |
| arch: armhf | |
| compiler: arm-linux-gnueabihf-gcc | |
| cross_compile: arm-linux-gnueabihf | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:bookworm" | |
| arch: arm64 | |
| compiler: aarch64-linux-gnu-gcc | |
| cross_compile: aarch64-linux-gnu | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:bookworm" | |
| arch: ppc64el | |
| compiler: powerpc64le-linux-gnu-gcc | |
| cross_compile: powerpc64le-linux-gnu | |
| mode: maintainer | |
| variant: cross-compile | |
| - container: "debian:bookworm" | |
| arch: s390x | |
| compiler: s390x-linux-gnu-gcc | |
| cross_compile: s390x-linux-gnu | |
| mode: maintainer | |
| variant: cross-compile | |
| # Debian GCC sanitizer builds | |
| - container: "debian:testing" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "debian:stable" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "debian:trixie" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "debian:forky" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "debian:bookworm" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| # Ubuntu 32-bit builds | |
| - container: "ubuntu:latest" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "ubuntu:latest" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "ubuntu:resolute" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "ubuntu:resolute" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "ubuntu:noble" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "ubuntu:noble" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| - container: "ubuntu:jammy" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: maintainer | |
| variant: i386 | |
| - container: "ubuntu:jammy" | |
| arch: i386 | |
| compiler: gcc -m32 | |
| cross_compile: i686-linux-gnu | |
| mode: no-maintainer | |
| variant: i386 | |
| # Ubuntu GCC sanitizer builds | |
| - container: "ubuntu:latest" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "ubuntu:resolute" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "ubuntu:noble" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| - container: "ubuntu:jammy" | |
| arch: x86-64 | |
| compiler: gcc | |
| mode: maintainer | |
| variant: sanitizers | |
| container: | |
| image: ${{ matrix.container }} | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| CC: ${{ matrix.compiler }} | |
| CROSS_COMPILE: ${{ matrix.cross_compile }} | |
| MODE: ${{ matrix.mode }} | |
| VARIANT: ${{ matrix.variant }} | |
| steps: | |
| - name: Show OS | |
| run: cat /etc/os-release | |
| - name: Show env (matrix settings) | |
| run: | | |
| echo "ARCH: $ARCH" | |
| echo "CC: $CC" | |
| echo "CROSS_COMPILE: $CROSS_COMPILE" | |
| echo "MODE: $MODE" | |
| echo "VARIANT: $VARIANT" | |
| - name: Git checkout | |
| uses: actions/checkout@v6 | |
| - name: Install additional packages | |
| run: | | |
| INSTALL=${{ matrix.container }} | |
| INSTALL="${INSTALL%%:*}" | |
| INSTALL="${INSTALL%%/*}" | |
| echo "Running ./ci/$INSTALL.sh" | |
| ./ci/$INSTALL.sh | |
| if [ "$VARIANT" ]; then | |
| echo "Running ./ci/$INSTALL.$VARIANT.sh" | |
| ./ci/$INSTALL.$VARIANT.sh; | |
| fi | |
| - name: Compiler version | |
| run: $CC --version | |
| - name: Display environment and Linux version | |
| run: | | |
| test -f /etc/issue && cat /etc/issue | |
| echo "############################################" | |
| lsb_release -a || true | |
| echo "############################################" | |
| cat /usr/include/linux/version.h | |
| echo "############################################" | |
| uname -a | |
| echo "############################################" | |
| cat /proc/cmdline | |
| echo "############################################" | |
| printenv | |
| - name: Display nfc.h differences between local and Linux kernel headers | |
| run: diff -uBb /usr/include/linux/nfc.h include/nfc_copy.h || true | |
| - name: Configure | |
| id: configure | |
| run: | | |
| echo "Bootstraping in mode: $MODE" | |
| CONFIGURE_ARGS="" | |
| if [ "$VARIANT" = "sanitizers" ]; then | |
| CONFIGURE_ARGS="--enable-asan --enable-lsan --enable-ubsan --enable-pie" | |
| fi | |
| CONFIGURE_CROSS="" | |
| if [ "$CROSS_COMPILE" ]; then | |
| CONFIGURE_CROSS="--host=${CROSS_COMPILE}" | |
| fi | |
| if [ "$MODE" = "maintainer" ]; then | |
| ./bootstrap-configure \ | |
| --disable-silent-rules \ | |
| $CONFIGURE_ARGS | |
| else | |
| CONFIGURE_ARGS="$CONFIGURE_ARGS $CONFIGURE_CROSS" | |
| ./bootstrap && \ | |
| ./configure \ | |
| --disable-systemd \ | |
| --disable-silent-rules \ | |
| --prefix=/usr \ | |
| --enable-ese \ | |
| --sysconfdir=/etc \ | |
| --enable-tools \ | |
| $CONFIGURE_ARGS | |
| fi | |
| - name: Get configure logs | |
| run: cat config.log | |
| if: ${{ always() && ((steps.configure.outcome == 'failure') || | |
| (steps.configure.outcome == 'success')) }} | |
| - name: Compile | |
| run: make -j$(nproc) | |
| - name: Run unit tests | |
| id: unit_tests | |
| run: | | |
| make check | |
| if: ${{ (matrix.arch == 'x86-64') || (matrix.arch == 'i386') }} | |
| - name: Get unit tests logs | |
| run: cat test-suite.log | |
| if: ${{ always() && ((steps.unit_tests.outcome == 'failure') || | |
| (steps.unit_tests.outcome == 'success')) }} | |
| - name: Check final binary | |
| run: | | |
| file src/neard | |
| ARCH_CHECK="$ARCH" | |
| case "$ARCH" in | |
| armhf) ARCH_CHECK="ARM, EABI";; | |
| arm64) ARCH_CHECK="aarch64";; | |
| # Glibc 2.41 seems to use "Intel i386" | |
| i386) ARCH_CHECK="Intel 80386|Intel i386";; | |
| ppc64el) ARCH_CHECK="64-bit PowerPC";; | |
| s390x) ARCH_CHECK="IBM S/390";; | |
| *) ARCH_CHECK="x86-64";; | |
| esac | |
| echo "Checking for built matching architecture: $ARCH_CHECK" | |
| file src/neard | grep -E "$ARCH_CHECK" | |
| if [ "$VARIANT" = "sanitizers" ]; then | |
| echo "Checking for linking against sanitizer libraries" | |
| ldd src/neard | grep libasan.so | |
| # liblsan won't appear if asan is used | |
| ldd src/neard | grep libubsan.so | |
| fi | |
| - name: Install | |
| run: make install | |
| - name: Distribution check | |
| run: make distcheck | |
| # distcheck runs unit tests so no point for cross compile | |
| # TODO: figure out how to re-configure during distcheck with --host for i386 (DISTCHECK_CONFIGURE_FLAGS) | |
| if: ${{ (matrix.arch == 'x86-64')}} |