Add automated build + fix macos #5
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
| name: Build cliap2 for all supported platforms | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| jobs: | |
| linux-x86_64: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Apply FFmpeg 8.0 compatibility patch | |
| run: | | |
| cat > /tmp/ffmpeg8.patch << 'EOF' | |
| --- a/owntone-server/src/transcode.c | |
| +++ b/owntone-server/src/transcode.c | |
| @@ -1441,8 +1441,10 @@ transcode_decode_setup_raw(enum transcode_profile profile, struct media_quality | |
| // If the source has REPLAYGAIN_TRACK_GAIN metadata, this will inject the | |
| // values into the the next packet's side data (as AV_FRAME_DATA_REPLAYGAIN), | |
| // which has the effect that a volume replaygain filter works. Note that | |
| // ffmpeg itself uses another method in process_input() in ffmpeg.c. | |
| +#if LIBAVFORMAT_VERSION_MAJOR < 60 | |
| av_format_inject_global_side_data(ctx->ifmt_ctx); | |
| +#endif | |
| ret = avformat_find_stream_info(ctx->ifmt_ctx, NULL); | |
| if (ret < 0) | |
| EOF | |
| patch -p1 < /tmp/ffmpeg8.patch | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential git autotools-dev autoconf automake libtool gettext gawk gperf \ | |
| libconfuse-dev libunistring-dev \ | |
| libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev \ | |
| libasound2-dev libxml2-dev libgcrypt20-dev zlib1g-dev \ | |
| libevent-dev libplist-dev libsodium-dev libjson-c-dev \ | |
| libcurl4-openssl-dev libprotobuf-c-dev pkg-config bison flex | |
| - name: Build for x86_64 | |
| run: | | |
| autoreconf -fi | |
| ./configure | |
| make -j$(nproc) | |
| mkdir -p release | |
| cp src/cliap2 release/cliap2-linux-x86_64 | |
| chmod +x release/cliap2-linux-x86_64 | |
| # Show file type and dependencies | |
| file release/cliap2-linux-x86_64 | |
| ldd release/cliap2-linux-x86_64 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cliap2-linux-x86_64 | |
| path: release/ | |
| linux-aarch64: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Apply FFmpeg 8.0 compatibility patch | |
| run: | | |
| cat > /tmp/ffmpeg8.patch << 'EOF' | |
| --- a/owntone-server/src/transcode.c | |
| +++ b/owntone-server/src/transcode.c | |
| @@ -1441,8 +1441,10 @@ transcode_decode_setup_raw(enum transcode_profile profile, struct media_quality | |
| // If the source has REPLAYGAIN_TRACK_GAIN metadata, this will inject the | |
| // values into the the next packet's side data (as AV_FRAME_DATA_REPLAYGAIN), | |
| // which has the effect that a volume replaygain filter works. Note that | |
| // ffmpeg itself uses another method in process_input() in ffmpeg.c. | |
| +#if LIBAVFORMAT_VERSION_MAJOR < 60 | |
| av_format_inject_global_side_data(ctx->ifmt_ctx); | |
| +#endif | |
| ret = avformat_find_stream_info(ctx->ifmt_ctx, NULL); | |
| if (ret < 0) | |
| EOF | |
| patch -p1 < /tmp/ffmpeg8.patch | |
| - name: Setup ARM64 cross-compilation | |
| run: | | |
| sudo dpkg --add-architecture arm64 | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential git autotools-dev autoconf automake libtool gettext gawk gperf \ | |
| gcc-aarch64-linux-gnu g++-aarch64-linux-gnu pkg-config bison flex | |
| - name: Install ARM64 libraries | |
| run: | | |
| sudo apt-get install -y \ | |
| libconfuse-dev:arm64 libunistring-dev:arm64 \ | |
| libavcodec-dev:arm64 libavformat-dev:arm64 libavfilter-dev:arm64 libswscale-dev:arm64 libavutil-dev:arm64 \ | |
| libasound2-dev:arm64 libxml2-dev:arm64 libgcrypt20-dev:arm64 zlib1g-dev:arm64 \ | |
| libevent-dev:arm64 libplist-dev:arm64 libsodium-dev:arm64 libjson-c-dev:arm64 \ | |
| libcurl4-openssl-dev:arm64 libprotobuf-c-dev:arm64 | |
| - name: Build for ARM64 | |
| run: | | |
| # Set up cross-compilation environment | |
| export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig | |
| export PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig | |
| autoreconf -fi | |
| ./configure --host=aarch64-linux-gnu \ | |
| CC=aarch64-linux-gnu-gcc \ | |
| CXX=aarch64-linux-gnu-g++ \ | |
| PKG_CONFIG_PATH=$PKG_CONFIG_PATH \ | |
| PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR | |
| make -j$(nproc) | |
| mkdir -p release | |
| cp src/cliap2 release/cliap2-linux-aarch64 | |
| chmod +x release/cliap2-linux-aarch64 | |
| # Show file type | |
| file release/cliap2-linux-aarch64 | |
| aarch64-linux-gnu-readelf -d src/cliap2 | grep NEEDED || true | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cliap2-linux-aarch64 | |
| path: release/ | |
| macos: | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Apply FFmpeg 8.0 compatibility patch | |
| run: | | |
| cat > /tmp/ffmpeg8.patch << 'EOF' | |
| --- a/owntone-server/src/transcode.c | |
| +++ b/owntone-server/src/transcode.c | |
| @@ -1441,8 +1441,10 @@ transcode_decode_setup_raw(enum transcode_profile profile, struct media_quality | |
| // If the source has REPLAYGAIN_TRACK_GAIN metadata, this will inject the | |
| // values into the the next packet's side data (as AV_FRAME_DATA_REPLAYGAIN), | |
| // which has the effect that a volume replaygain filter works. Note that | |
| // ffmpeg itself uses another method in process_input() in ffmpeg.c. | |
| +#if LIBAVFORMAT_VERSION_MAJOR < 60 | |
| av_format_inject_global_side_data(ctx->ifmt_ctx); | |
| +#endif | |
| ret = avformat_find_stream_info(ctx->ifmt_ctx, NULL); | |
| if (ret < 0) | |
| EOF | |
| patch -p1 < /tmp/ffmpeg8.patch | |
| - name: Install build dependencies | |
| run: | | |
| brew install \ | |
| autoconf automake libtool gettext gawk pkg-config \ | |
| confuse libunistring ffmpeg libxml2 libgcrypt zlib libevent libplist \ | |
| libsodium json-c curl openssl@3 protobuf-c bison libiconv | |
| - name: Build for macOS ARM64 | |
| run: | | |
| export PATH="$(brew --prefix bison)/bin:$PATH" | |
| export OPENSSL_PREFIX="$(brew --prefix openssl@3)" | |
| export LIBXML2_PREFIX="$(brew --prefix libxml2)" | |
| export ZLIB_PREFIX="$(brew --prefix zlib)" | |
| export LIBGCRYPT_PREFIX="$(brew --prefix libgcrypt)" | |
| export LIBGPG_ERROR_PREFIX="$(brew --prefix libgpg-error)" | |
| export LIBUNISTRING_PREFIX="$(brew --prefix libunistring)" | |
| export LIBICONV_PREFIX="$(brew --prefix libiconv)" | |
| export PKG_CONFIG_PATH="$OPENSSL_PREFIX/lib/pkgconfig:$LIBXML2_PREFIX/lib/pkgconfig:$ZLIB_PREFIX/lib/pkgconfig:$LIBGCRYPT_PREFIX/lib/pkgconfig:$LIBGPG_ERROR_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" | |
| export LDFLAGS="-L$OPENSSL_PREFIX/lib -L$LIBXML2_PREFIX/lib -L$ZLIB_PREFIX/lib -L$LIBGCRYPT_PREFIX/lib -L$LIBGPG_ERROR_PREFIX/lib -L$LIBICONV_PREFIX/lib" | |
| export CPPFLAGS="-I$OPENSSL_PREFIX/include -I$LIBXML2_PREFIX/include -I$ZLIB_PREFIX/include -I$LIBGCRYPT_PREFIX/include -I$LIBGPG_ERROR_PREFIX/include -I$LIBICONV_PREFIX/include" | |
| export LIBUNISTRING_CFLAGS="-I$LIBUNISTRING_PREFIX/include" | |
| export LIBUNISTRING_LIBS="-L$LIBUNISTRING_PREFIX/lib -lunistring -L$LIBICONV_PREFIX/lib -liconv" | |
| autoreconf -fi | |
| ./configure || { echo "Configure failed, showing config.log:"; tail -100 config.log; exit 1; } | |
| make -j$(sysctl -n hw.ncpu) | |
| mkdir -p release | |
| cp src/cliap2 release/cliap2-macos-arm64 | |
| chmod +x release/cliap2-macos-arm64 | |
| # Show dependencies | |
| otool -L release/cliap2-macos-arm64 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cliap2-macos-arm64 | |
| path: release/ | |
| create-release: | |
| needs: [linux-x86_64, linux-aarch64, macos] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: build-${{ github.sha }} | |
| name: Automated Build ${{ github.sha }} | |
| draft: false | |
| prerelease: true | |
| files: | | |
| artifacts/cliap2-linux-x86_64/* | |
| artifacts/cliap2-linux-aarch64/* | |
| artifacts/cliap2-macos-arm64/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |