From 9439bcc60ce82c99ee1db78c51f44ae04e2d8e99 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 4 Jun 2024 16:58:43 +0200 Subject: [PATCH] [gh-actions] Fix building for macos-latest (Mac OS 14 Sonoma) --- .github/workflows/macos.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f8a10b9773..54d55040e4 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,7 +19,7 @@ on: jobs: build: - runs-on: macos-12 + runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -28,15 +28,15 @@ jobs: run: brew install automake autoconf libtool pkg-config - name: Install gperf, bison and flex - # MacOS comes with an ancient bison, we need a newer version. Homebrew's - # bison and flex are keg-only, which means they are not symlinked into - # /usr/local because macOS already provides this software. Homebrew tells - # you to adjust the $PATH, but I couldn't make that work, and I think - # symlinking is a better solution for simple binaries. + # Mac OS has ancient versions of bison and flex, so we need a newer from + # Homebrew. The new versions are installed keg-only, so we must tell + # configure/make where to look. Adjusting $PATH doesn't work (maybe + # because make invokes the two via ylwrap), so instead symlink the two + # into /usr/local/bin. run: | brew install gperf bison flex - sudo ln -s /usr/local/opt/bison/bin/bison /usr/local/bin/bison - sudo ln -s /usr/local/opt/flex/bin/flex /usr/local/bin/flex + sudo ln -s "$(brew --prefix)/opt/bison/bin/bison" /usr/local/bin/bison + sudo ln -s "$(brew --prefix)/opt/flex/bin/flex" /usr/local/bin/flex - name: Install libinotify-kqueue # brew does not have libinotify package @@ -69,23 +69,21 @@ jobs: brew install ffmpeg - name: Install other dependencies + # libxml2 is included with Mac OS run: | - brew install libxml2 libunistring confuse libplist libwebsockets libevent libgcrypt json-c protobuf-c libsodium gnutls pulseaudio openssl + brew install libunistring confuse libplist libwebsockets libevent libgcrypt json-c protobuf-c libsodium gnutls pulseaudio openssl - name: Configure # We configure a non-privileged setup, since how to add a "owntone" system # user in MacOS isn't clear to me (useradd etc. isn't available) run: | + export CFLAGS="-I$(brew --prefix)/include" + export LDFLAGS="-L$(brew --prefix)/lib" autoreconf -fi ./configure --prefix=$HOME/owntone_data/usr --sysconfdir=$HOME/owntone_data/etc --localstatedir=$HOME/owntone_data/var --enable-chromecast --with-pulseaudio - name: Build run: | - # Without setting these env vars the build fails with e.g. "fatal error: 'openssl/ssl.h' file not found" - # (Solution taken from https://github.com/libimobiledevice/libimobiledevice/issues/389#issuecomment-289284190) - export LD_LIBRARY_PATH=$(brew --prefix openssl)/lib - export CPATH=$(brew --prefix openssl)/include - export PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig make - name: Install