Build cliap2 for all supported platforms #24
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-24.04-arm | |
| 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 ARM64 | |
| run: | | |
| autoreconf -fi | |
| ./configure | |
| make -j$(nproc) | |
| mkdir -p release | |
| cp src/cliap2 release/cliap2-linux-aarch64 | |
| chmod +x release/cliap2-linux-aarch64 | |
| # Show file type and dependencies | |
| file release/cliap2-linux-aarch64 | |
| ldd release/cliap2-linux-aarch64 | |
| - 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 reinstall \ | |
| 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)" | |
| # Static linking for OpenSSL | |
| export PKG_CONFIG_PATH="$LIBXML2_PREFIX/lib/pkgconfig:$ZLIB_PREFIX/lib/pkgconfig:$LIBGCRYPT_PREFIX/lib/pkgconfig:$LIBGPG_ERROR_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" | |
| export LDFLAGS="-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" | |
| # Add static OpenSSL libraries to LIBS | |
| export LIBS="$OPENSSL_PREFIX/lib/libssl.a $OPENSSL_PREFIX/lib/libcrypto.a" | |
| 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 - verify OpenSSL is statically linked | |
| echo "=== Binary dependencies ===" | |
| otool -L release/cliap2-macos-arm64 | |
| echo "=== Checking for OpenSSL symbols ===" | |
| nm release/cliap2-macos-arm64 | grep -i ssl | head -10 || echo "OpenSSL symbols found (statically linked)" | |
| - 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 }} |