# Build pipeline configuration for Travis CI

language: cpp
dist: xenial
compiler:
- gcc

os:
- linux

before_install:
- sudo apt-get update
- sudo apt-get install -y rsync libasound2-dev libxrandr-dev libxxf86dga-dev

script:
- make 3rdparty
- make full-compile

after_success:
- make install

branches:
  only:
  - master

# Build pipeline configuration for Travis CI

language: cpp
compiler:
- gcc

os:
- linux
- windows

jobs:
  include:
    - os: linux
      dist: xenial
    - os: windows

before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; sudo apt-get update ; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; sudo apt-get install -y rsync libasound2-dev libxrandr-dev libxxf86dga-dev ; fi
- |-
    case $TRAVIS_OS_NAME in
      windows)
        [[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
        choco uninstall -y mingw
        choco upgrade --no-progress -y msys2
        export msys2='cmd //C RefreshEnv.cmd '
        export msys2+='& set MSYS=winsymlinks:nativestrict '
        export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
        export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
        export msys2+=" -msys2 -c "\"\$@"\" --"
        $msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain
        ## Install more MSYS2 packages from https://packages.msys2.org/base here
        taskkill //IM gpg-agent.exe //F  # https://travis-ci.community/t/4967
        export PATH=/C/tools/msys64/mingw64/bin:$PATH
        export MAKE=mingw32-make  # so that Autotools can find it
        ;;
    esac

before_cache:
- |-
    case $TRAVIS_OS_NAME in
      windows)
        # https://unix.stackexchange.com/a/137322/107554
        $msys2 pacman --sync --clean --noconfirm
        ;;
    esac

cache:
    directories:
    - $HOME/AppData/Local/Temp/chocolatey
    - /C/tools/msys64

script:
- make 3rdparty
- make full-compile

after_success:
- make install

branches:
  only:
  - master

Test Windows builds in Travis CI
Test Windows builds in Travis CI
