From e62b97d61cd1f2da2ca36e9c22e9aa8f181c5c9c Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Mon, 14 Oct 2024 17:40:08 +0200 Subject: [PATCH] Added MacOS CI tests --- .github/workflows/build_macos.yml | 37 ++++++++++++++++++++++++++++++ .github/workflows/build_shared.yml | 3 +++ autogen.sh | 29 ++++++++++++----------- configure.ac | 26 ++++++++++----------- m4/common.m4 | 4 ++-- 5 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/build_macos.yml diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml new file mode 100644 index 0000000..c0d808d --- /dev/null +++ b/.github/workflows/build_macos.yml @@ -0,0 +1,37 @@ +# Build from source. +name: build_macos +on: [push, pull_request] +permissions: read-all +jobs: + build_ubuntu: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-12 + configure_options: '' + - os: macos-13 + configure_options: '' + - os: macos-14 + configure_options: '' + - os: macos-15 + configure_options: '' + steps: + - uses: actions/checkout@v4 + - name: Install build dependencies + run: | + brew update -q + brew install -q autoconf automake gettext gnu-sed libtool pkg-config || true + brew link --force gettext + ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize + - name: Download test data + run: | + if test -x "synctestdata.sh"; then ./synctestdata.sh; fi + - name: Building from source + env: + CC: ${{ matrix.compiler }} + run: | + tests/build.sh ${{ matrix.configure_options }} + - name: Run tests + run: | + tests/runtests.sh diff --git a/.github/workflows/build_shared.yml b/.github/workflows/build_shared.yml index 66d9b25..44031f0 100644 --- a/.github/workflows/build_shared.yml +++ b/.github/workflows/build_shared.yml @@ -10,6 +10,9 @@ jobs: strategy: matrix: include: + - architecture: 'x64' + compiler: 'gcc' + configure_options: '' - architecture: 'x64' compiler: 'gcc' configure_options: '--enable-wide-character-type' diff --git a/autogen.sh b/autogen.sh index 83f54ea..bd307d2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,32 +1,38 @@ #!/bin/sh -# Script to generate ./configure using the autotools +# Script to generate configure and Makefile using the autotools. # -# Version: 20230405 +# Version: 20241013 EXIT_SUCCESS=0; EXIT_FAILURE=1; -BINDIR="/usr/bin"; +BINDIR=`which aclocal`; +BINDIR=`dirname ${BINDIR}`; -if ! test -x "${BINDIR}/aclocal"; +if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/usr/bin"; then - BINDIR="/usr/local/bin"; + BINDIR="/usr/bin"; fi -if ! test -x "${BINDIR}/aclocal"; +if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/usr/local/bin"; then BINDIR="/usr/local/bin"; fi -if ! test -x "${BINDIR}/aclocal"; +if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/opt/local/bin"; then # Default location of MacPorts installed binaries. BINDIR="/opt/local/bin"; fi -if ! test -x "${BINDIR}/aclocal"; +if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/opt/homebrew/bin"; +then + # Default location of Homebrew installed binaries. + BINDIR="/opt/homebrew/bin"; +fi +if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/mingw32/bin"; then # Default location of 32-bit MSYS2-MinGW installed binaries. BINDIR="/mingw32/bin"; fi -if ! test -x "${BINDIR}/aclocal"; +if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/mingw64/bin"; then # Default location of 64-bit MSYS2-MinGW installed binaries. BINDIR="/mingw64/bin"; @@ -91,35 +97,30 @@ else exit ${EXIT_FAILURE}; fi - if ! test -x "${AUTOCONF}"; then echo "Unable to find: autoconf"; exit ${EXIT_FAILURE}; fi - if ! test -x "${AUTOHEADER}"; then echo "Unable to find: autoheader"; exit ${EXIT_FAILURE}; fi - if ! test -x "${AUTOMAKE}"; then echo "Unable to find: automake"; exit ${EXIT_FAILURE}; fi - if ! test -x "${AUTOPOINT}"; then echo "Unable to find: autopoint"; exit ${EXIT_FAILURE}; fi - if ! test -x "${LIBTOOLIZE}"; then echo "Unable to find: libtoolize"; diff --git a/configure.ac b/configure.ac index 016ae46..8734a1e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,12 +1,12 @@ AC_PREREQ([2.71]) AC_INIT( - [libbfio], - [20240614], - [joachim.metz@gmail.com]) + [libbfio], + [20241014], + [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( - [include/libbfio.h.in]) + [include/libbfio.h.in]) AM_INIT_AUTOMAKE([gnu 1.6 tar-ustar]) AM_EXTRA_RECURSIVE_TARGETS([sources splint]) @@ -104,21 +104,21 @@ CFLAGS="$CFLAGS -Wall"; dnl Check if requires and build requires should be set in spec file AS_IF( - [test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libclocale" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libcsplit" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libcfile" = xyes || test "x$ac_cv_libcpath" = xyes], - [AC_SUBST( - [libbfio_spec_requires], - [Requires:]) - ]) + [test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libclocale" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libcsplit" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libcfile" = xyes || test "x$ac_cv_libcpath" = xyes], + [AC_SUBST( + [libbfio_spec_requires], + [Requires:]) + ]) dnl Set the date for the dpkg files AC_SUBST( - [DPKG_DATE], - [`date -R 2> /dev/null`]) + [DPKG_DATE], + [`date -R 2> /dev/null`]) dnl Set the date for the spec file AC_SUBST( - [SPEC_DATE], - [`date +"%a %b %e %Y" 2> /dev/null`]) + [SPEC_DATE], + [`date +"%a %b %e %Y" 2> /dev/null`]) dnl Generate Makefiles AC_CONFIG_FILES([Makefile]) diff --git a/m4/common.m4 b/m4/common.m4 index c2ea816..c229b79 100644 --- a/m4/common.m4 +++ b/m4/common.m4 @@ -1,6 +1,6 @@ dnl Checks for common headers and functions dnl -dnl Version: 20240513 +dnl Version: 20241013 dnl Function to test if a certain feature was disabled AC_DEFUN([AX_COMMON_ARG_DISABLE], @@ -113,7 +113,7 @@ AC_DEFUN([AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT], ac_cv_enable_verbose_output=yes]) ]) -dnl Function to detect whether static executables support should be enabled +dnl Function to detect whether wide character type support should be enabled AC_DEFUN([AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE], [AX_COMMON_ARG_ENABLE( [wide-character-type],