diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..deea442a --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,73 @@ +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 does not have libinotify package + 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 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 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: | + # 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 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 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