From de54f547d58eb4933429490981b28771f3de05ee Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Fri, 22 May 2020 20:10:57 +0200 Subject: [PATCH 1/5] Try Github action workflow for MacOS build --- .github/workflows/macos.yml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..8d9a41ef --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,67 @@ +name: MacOS + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: macos-latest + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Install build tools + run: brew install automake autoconf libtool pkg-config + + - name: Install libinotify-kqueue + # brew package does not have unlock-notify + run: | + git clone https://github.com/libinotify-kqueue/libinotify-kqueue + cd libinotify-kqueue + autoreconf -fvi + ./configure + make + sudo make install + cd .. + + - name: Install sqlite + # brew package does not have unlock-notify + run: | + wget https://www.sqlite.org/2020/sqlite-autoconf-3310100.tar.gz + tar xzf sqlite-autoconf-3310100.tar.gz + cd sqlite-autoconf-3310100 + export CFLAGS='-DSQLITE_ENABLE_UNLOCK_NOTIFY=1' + ./configure + make + sudo make install + cd .. + + - name: Install ffmpeg + # The libbluray ffmpeg dependency fails without the chown (source: stackoverflow) + run: | + sudo chown -R $(whoami) $(brew --prefix)/* + brew install ffmpeg + + - name: Install gperf and antlr3 + run: | + brew install gperf + wget https://github.com/ejurgensen/actionstest/blob/master/antlr35_install.sh + ./antlr35_install.sh -p /usr/local + + - name: Install other dependencies + run: brew install libunistring libmxml confuse libplist sqlite libwebsockets libevent libgcrypt json-c protobuf-c libsodium gnutls pulseaudio + + - name: Configure forked-daapd + run: | + autoreconf -fi + ./configure --enable-chromecast --enable-lastfm --with-pulseaudio + + - name: Build forked-daapd + run: make + + - name: Install forked-daapd + run: sudo make install From 18a37f7177895e2745915255361cfcc7556ea076 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Fri, 22 May 2020 20:17:57 +0200 Subject: [PATCH 2/5] Try Github action workflow for Ubuntu --- .github/workflows/ubuntu.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/ubuntu.yml diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 00000000..bf0f30cd --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,27 @@ +name: Ubuntu + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: install dependencies + run: sudo apt-get install -yq build-essential clang clang-tools git autotools-dev autoconf libtool gettext gawk gperf antlr3 libantlr3c-dev libconfuse-dev libunistring-dev libsqlite3-dev libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev libevent-dev libplist-dev libsodium-dev libcurl4-openssl-dev libjson-c-dev libprotobuf-c-dev libpulse-dev libwebsockets-dev libgnutls28-dev + - name: configure + run: | + autoreconf -vi + ./configure + - name: make + run: make + - name: make check + run: make check + - name: make distcheck + run: make distcheck From 0c157451cd4e9d50f943766af112bfcef6a418d3 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 23 May 2020 08:30:27 +0200 Subject: [PATCH 3/5] [gh-actions] Fix OSX build in Github actions - fetch raw antlr3 install helper script and make it executable - fix fatal error "'openssl/ssl.h' file not found" while building forked-daapd (included in libwebsocket.h) (https://github.com/libimobiledevice/libimobiledevice/issues/389#issuecomment-289284190) --- .github/workflows/macos.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 8d9a41ef..07222467 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -49,7 +49,8 @@ jobs: - name: Install gperf and antlr3 run: | brew install gperf - wget https://github.com/ejurgensen/actionstest/blob/master/antlr35_install.sh + wget https://raw.githubusercontent.com/ejurgensen/actionstest/master/antlr35_install.sh + chmod +x ./antlr35_install.sh ./antlr35_install.sh -p /usr/local - name: Install other dependencies @@ -61,7 +62,13 @@ jobs: ./configure --enable-chromecast --enable-lastfm --with-pulseaudio - name: Build forked-daapd - run: make + run: | + # Without setting these env vars the build fails with "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 forked-daapd run: sudo make install From 498ce9f9c7fc8a9e8058697f7539a8a2f53a45ca Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 23 May 2020 17:35:53 +0200 Subject: [PATCH 4/5] Modify antlr install script so it can run without prompts Useful for automated actions, e.g. Github workflow --- scripts/antlr35_install.sh | 65 +++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/scripts/antlr35_install.sh b/scripts/antlr35_install.sh index 6df65382..00b0b839 100755 --- a/scripts/antlr35_install.sh +++ b/scripts/antlr35_install.sh @@ -25,32 +25,38 @@ usage() { echo "This script will download, build and install antlr $ANTLR_VERSION" echo " (and matching libantlrc) on your computer." echo - echo "Usage: ${0##*/} -h | [ -p ] [ ]" + echo "Usage: ${0##*/} -h | [ -p ] [ -y ] [ ]" echo echo "Parameters:" echo " -h Show this help" echo " -p Install to prefix (default: choose /usr or /usr/local)" + echo " -y Automatic yes to prompts (run non-interactively with -p)" echo " Build directory (default: $WORKDIR)" exit 0 } GIVEN_PREFIX= -case $1 in - -h|--help) usage;; - -p) - shift - [ -n "$1" ] || { - echo "Option -p requires a argument (try -h for usage)" +ALWAYS_YES= +while [ "$1" != "" ]; do + case $1 in + -p | --prefix ) + shift + GIVEN_PREFIX=$1 + ;; + -y | --yes ) + ALWAYS_YES=1 + ;; + -h | --help ) + usage + exit + ;; + * ) + echo "Unrecognized option $1 (try -h for usage)" exit 1 - } - GIVEN_PREFIX=$1 - shift - ;; - -*) - echo "Unrecognized option $1 (try -h for usage)" - exit 1 - ;; -esac + ;; + esac + shift +done # override build directory? (support ~ expansion) [ -n "$1" ] && WORKDIR=$1 @@ -75,8 +81,16 @@ is_yes() { return 0 } +ask_yn() { + if [ "$ALWAYS_YES" = "1" ]; then + yn="y" + else + read -p "$1" yn + fi +} + prog_install() { - read -p "Would you like to install into $PREFIX now? [Y/n] " yn + ask_yn "Would you like to install into $PREFIX now? [Y/n] " if ! is_yes "$yn"; then echo "Build left ready to install from $WORKDIR" echo "You can re-run the script (eg. as root) to install into" @@ -84,11 +98,10 @@ prog_install() { exit fi if [ `id -u` -ne 0 ]; then - echo "Would you like to install with sudo?" - read -p "NOTE: You WILL be asked for your password! [Y/n] " yn + ask_yn "Would you like to install with sudo? NOTE: You WILL be asked for your password! [Y/n] " if ! is_yes "$yn"; then SUDO= - read -p "Continue to install as non-root user? [Y/n] " yn + ask_yn "Continue to install as non-root user? [Y/n] " is_yes "$yn" || err "Install cancelled" fi else @@ -130,12 +143,12 @@ if [ -f "$WORKDIR/install_env" ]; then [ -n "$PREFIX" ] || err "PREFIX is missing in file 'install_env'" if [ -n "$GIVEN_PREFIX" ] && [ "$GIVEN_PREFIX" != "$PREFIX" ]; then echo "You must rebuild to install into $GIVEN_PREFIX (current build for $PREFIX)" - read -p "Would you like to rebuild for ${GIVEN_PREFIX}? [Y/n] " yn + ask_yn "Would you like to rebuild for ${GIVEN_PREFIX}? [Y/n] " if is_yes "$yn"; then rm -f install_env PREFIX= else - read -p "Would you like to install to ${PREFIX}? [Y/n] " yn + ask_yn "Would you like to install to ${PREFIX}? [Y/n] " ! is_yes "$yn" && err "Install cancelled" fi fi @@ -147,7 +160,7 @@ if [ -f "$WORKDIR/install_env" ]; then fi if [ ! -d "$WORKDIR" ]; then - read -p "Should the script create $WORKDIR and use it for building? [Y/n] " yn + ask_yn "Should the script create $WORKDIR and use it for building? [Y/n] " is_yes "$yn" || exit fi @@ -165,7 +178,7 @@ PREFIX_JAVA=$PREFIX/share/java MACHBITS=`getconf LONG_BIT 2>/dev/null` [ "$MACHBITS" = "64" ] && DEF_AN="[Y/n]" || DEF_AN="[y/N]" -read -p "Should the script build libantlr3c for 64 bit? $DEF_AN " yn +ask_yn "Should the script build libantlr3c for 64 bit? $DEF_AN " [ -z "$yn" -a "$MACHBITS" != "64" ] && yn=n is_yes "$yn" && ENABLE64BIT="--enable-64bit" @@ -211,10 +224,10 @@ antlr_download() { # retrieve the source if [ -f "$ANTLR3_JAR" -a -f "$LIBANTLR3C_TAR" ]; then FILES_EXIST=1 - read -p "Files appear to already be downloaded, use them? [Y/n] " yn + ask_yn "Files appear to already be downloaded, use them? [Y/n] " ! is_yes "$yn" && antlr_download reset else - read -p "Should the script download and build antlr and libantlr3c? [Y/n] " yn + ask_yn "Should the script download and build antlr and libantlr3c? [Y/n] " is_yes "$yn" || exit antlr_download fi From 279431dd91234196cc7a60666dff94b24e989ff0 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 23 May 2020 17:55:55 +0200 Subject: [PATCH 5/5] [gh-actions] Use local antlr3_install script for MacOS workflow --- .github/workflows/macos.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 07222467..deea442a 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,7 +18,7 @@ jobs: run: brew install automake autoconf libtool pkg-config - name: Install libinotify-kqueue - # brew package does not have unlock-notify + # brew does not have libinotify package run: | git clone https://github.com/libinotify-kqueue/libinotify-kqueue cd libinotify-kqueue @@ -40,19 +40,18 @@ jobs: sudo make install cd .. + - name: Install gperf and antlr3 + run: | + brew install gperf + chmod +x ./scripts/antlr35_install.sh + ./scripts/antlr35_install.sh -y -p /usr/local + - name: Install ffmpeg # The libbluray ffmpeg dependency fails without the chown (source: stackoverflow) run: | sudo chown -R $(whoami) $(brew --prefix)/* brew install ffmpeg - - name: Install gperf and antlr3 - run: | - brew install gperf - wget https://raw.githubusercontent.com/ejurgensen/actionstest/master/antlr35_install.sh - chmod +x ./antlr35_install.sh - ./antlr35_install.sh -p /usr/local - - name: Install other dependencies run: brew install libunistring libmxml confuse libplist sqlite libwebsockets libevent libgcrypt json-c protobuf-c libsodium gnutls pulseaudio