Add Meson build system #1301
This file contains 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
# If Github does not properly accept this YAML file, try | |
# https://rhysd.github.io/actionlint/ from | |
# https://github.com/rhysd/actionlint. | |
name: 'CI build' | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
LC_ALL: C | |
COMMON_CONFIGURE_FLAGS: >- | |
--enable-vusb | |
--with-camlibs=everything | |
SLEEP=no | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
name: '${{ matrix.os }}' | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Determine number of cores to build on (Linux)' | |
if: runner.os == 'Linux' | |
run: echo NPROC=$(nproc) >> $GITHUB_ENV | |
- name: 'Determine number of cores to build on (macOS)' | |
if: runner.os == 'macOS' | |
run: echo NPROC=$(sysctl -n hw.logicalcpu) >> $GITHUB_ENV | |
# Setting MAKE interferes with Makefile{,.in,.am} using $(MAKE) internally | |
- name: 'Prepare concurrent make' | |
run: if test "x$NPROC" = x; then echo ci_MAKE="make" >> $GITHUB_ENV; echo "NPROC must be set"; exit 1; else echo ci_MAKE="make -j${NPROC} -l${NPROC}" >> $GITHUB_ENV; fi | |
- name: 'Update software database (Linux)' | |
if: runner.os == 'Linux' | |
run: sudo apt-get update | |
- name: 'Update software database (macOS)' | |
if: runner.os == 'macOS' | |
run: brew update | |
- name: 'Work around apt-get 3rd party repo libgd-dev dependency (Linux)' | |
if: runner.os == 'Linux' | |
run: sudo apt-get remove nginx libgd3 | |
- name: 'Install build requirements (Linux)' | |
if: runner.os == 'Linux' | |
run: sudo apt-get install -y autopoint gettext libusb-1.0-0-dev libcurl4-openssl-dev libgd-dev libltdl-dev | |
- name: 'Install build requirements (macOS)' | |
if: runner.os == 'macOS' | |
run: brew install automake gd gettext libexif libtool libusb | |
- name: 'OS specific build flags (Linux)' | |
if: runner.os == 'Linux' | |
run: echo OS_SPECIFIC_CPPFLAGS="" >> $GITHUB_ENV | |
# FIXME: Fix source to build without the -D_DARWIN_C_SOURCE here | |
- name: 'OS specific build flags (macOS)' | |
if: runner.os == 'macOS' | |
run: echo OS_SPECIFIC_CPPFLAGS="-D_DARWIN_C_SOURCE -I$(brew --prefix)/include" >> $GITHUB_ENV | |
- name: 'autoreconf' | |
run: autoreconf -i -f | |
- name: 'configure' | |
run: ./configure ${COMMON_CONFIGURE_FLAGS} --prefix=$PWD/__prefix | |
- name: 'make' | |
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" | |
- name: 'make check' | |
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" check | |
# FIXME: fix make distcheck to run on macOS | |
- name: 'make distcheck (non-macOS)' | |
if: runner.os != 'macOS' | |
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" DISTCHECK_CONFIGURE_FLAGS="${COMMON_CONFIGURE_FLAGS}" distcheck | |
- name: 'make install' | |
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install | |
- name: 'make installcheck' | |
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" installcheck | |
- name: 'find ldd replacement (MacOS)' | |
if: runner.os == 'macOS' | |
run: echo 'LDD=otool -L' >> $GITHUB_ENV | |
- name: 'find ldd replacement (Linux)' | |
if: runner.os == 'Linux' | |
run: echo 'LDD=ldd' >> $GITHUB_ENV | |
- name: 'Build and run example libgphoto2 frontend (ambs-lgp2-frontend)' | |
run: | | |
set -x | |
exec 2>&1 | |
abs_top_builddir="$PWD" | |
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig" | |
export LD_LIBRARY_PATH="${abs_top_builddir}/__prefix/lib" | |
cd examples/ambs-lgp2-frontend | |
autoreconf -vis | |
./configure --prefix="$PWD/__pref" | |
make | |
${LDD-false} ambs-lgp2-frontend | |
./ambs-lgp2-frontend | |
make install | |
${LDD-false} __pref/bin/ambs-lgp2-frontend | |
__pref/bin/ambs-lgp2-frontend |