# default in trusty is GCC 4.8, Clang 3.5, cmake 3.2
# https://github.com/travis-ci/apt-source-whitelist

language: cpp
#dist: trusty
dist: xenial
sudo: false

env:
  global:
    - CROSS_COMPILE32=0
    - BUNDLED_LIBS=1
    - BUNDLED_SDL=1
    - BUNDLED_ZLIB=1
    - BUNDLED_MINIZIP=1
    - BUNDLED_JPEG=1
    - BUNDLED_PNG=1
    - BUNDLED_LUA=1
    - BUNDLED_OGG=1
    - INSTALL_EXTRA=0

matrix:
  include:

# 32 bit

# FIXME: enable this when ubuntu/dist is able to install fglrx
#    - os: linux
#      compiler: gcc
#      env:
#        - RELEASE_TYPE=release
#        - CROSS_COMPILE32=1
#      addons:
#        sources:
#        - ubuntu-toolchain-r-test
#        apt:
#          packages:
#          - g++-4.8-multilib 
#          - gcc-multilib
#          - gcc-4.9-base:i386
#          - nasm:i386
#          - libx11-6:i386
#          - libx11-dev:i386
#          - libgcc1:i386
#          - libglib2.0-dev:i386
#          - fglrx:i386
#          - fglrx-dev:i386
#          - libasound2-dev:i386
#          - pulseaudio:i386
#          - libpulse-dev:i386

# 64 bit

    - os: linux
      env: RELEASE_TYPE=release
      compiler: gcc
      addons:
        sources:
        - ubuntu-toolchain-r-test
        apt:
          packages:
          - nasm

          - libwayland-dev
          - wayland-protocols
          - libgl1-mesa-dev
          - libglu1-mesa-dev  

          - libasound2-dev
          - pulseaudio
          - libpulse-dev

    - os: linux
      compiler: gcc
      env: RELEASE_TYPE=debug
      addons:
        sources:
        - ubuntu-toolchain-r-test
        apt:
          packages:
          - nasm

          - libwayland-dev
          - wayland-protocols
          - libgl1-mesa-dev
          - libglu1-mesa-dev 

          - libasound2-dev
          - pulseaudio
          - libpulse-dev

    - os: linux
      env: RELEASE_TYPE=release
      compiler: clang
      addons:
        sources:
        - llvm-toolchain-trusty
        apt:
          packages:
          - nasm

          - libwayland-dev
          - wayland-protocols
          - libgl1-mesa-dev
          - libglu1-mesa-dev 

          - libasound2-dev
          - pulseaudio
          - libpulse-dev

    - os: linux
      env: RELEASE_TYPE=debug
      compiler: clang
      addons:
        sources:
        - llvm-toolchain-trusty
        apt:
          packages:
          - nasm

          - libwayland-dev
          - wayland-protocols
          - libgl1-mesa-dev
          - libglu1-mesa-dev 

          - libasound2-dev
          - pulseaudio
          - libpulse-dev
          
    #- os: osx
    #  osx_image: xcode8.3
    #  before_install:
    #    - brew update
    #    - brew install gnu-sed nasm
    #    - brew outdated automake || brew upgrade automake
    #    - brew outdated autoconf || brew upgrade autoconf
    #  env:
    #    - CXX=clang++ CC=clang
    #    - CXXFLAGS="-g -lstdc++"

install:
  ############################################################################
  # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
  ############################################################################
  - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
  - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
  - |
    if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
      CMAKE_URL="https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz"
      mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
      export PATH=${DEPS_DIR}/cmake/bin:${PATH}
    fi
  - cmake --version
  - cd ${TRAVIS_BUILD_DIR}

script:
  - ./easybuild.sh

notifications:
  irc:
    template:
      - "%{repository}#%{build_number} %{commit} %{author}: %{message} %{build_url}"
    channels:
      - "irc.freenode.org#etlegacy"
    use_notice: true
    skip_join: true
  webhooks:
    urls:
      - https://webhooks.gitter.im/e/5a93d4b59447e6129a58
    on_success: change
    on_failure: always
    on_start: never
