language: c

# sudo: false
sudo: true
dist: trusty

compiler:
  - gcc

env:
  global:
    - "PATH=${HOME}/bin:${PATH}"
  matrix:
    - EMULATE_READER=1

cache:
  apt: true
  directories:
    - "${HOME}/bin"
    # compiled luarocks binaries
    - "${TRAVIS_BUILD_DIR}/install"
    # base build
    - "${TRAVIS_BUILD_DIR}/base"
    - "${HOME}/.ccache"
    - "${HOME}/.luarocks"
before_cache:
  # don't quote like you normally would or it won't expand
  - rm -frv ${TRAVIS_BUILD_DIR}/base/build/*/cache/*
  # don't cache unit tests
  - rm -frv ${TRAVIS_BUILD_DIR}/base/build/*/spec

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - g++-4.8
      - libsdl1.2-dev
      # luasec dependencies
      - libssl1.0.0
      - nasm
      # OpenSSL likes this (package contains makedepend)
      - xutils-dev

before_install: .ci/before_install.sh
install: .ci/install.sh
script: .ci/script.sh
after_success: .ci/after_success.sh
