language: cpp
compiler:
  - clang
  - gcc

env:
  # Lua versions to test against
  - LUA_VERSION=5.3.2
  - LUA_VERSION=5.2.4
  - LUA_VERSION=5.1.5

install:
  # Select compiler
  - if [[ "$CXX" = "g++" ]]; then export CXX="g++-5"; fi
  - if [[ "$CXX" = "clang++" ]]; then export CXX="clang++-3.7"; fi

  # Build Lua
  - wget "http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz"
  - tar xvfz "lua-$LUA_VERSION.tar.gz"
  - pushd "lua-$LUA_VERSION/src"
  - make LUA_A=liblua-custom.a linux
  - export "LUA_SOURCE_PATH=$(pwd)"
  - popd

script:
  - make "LUA_LIBDIR=$LUA_SOURCE_PATH" "LUA_INCDIR=$LUA_SOURCE_PATH" LUA_LIBNAME=lua-custom all

addons:
  apt:
    sources:
      - llvm-toolchain-precise-3.7
      - ubuntu-toolchain-r-test
    packages:
      - clang-3.7
      - g++-5
      - make
      - wget

language: cpp
compiler:
  - clang
  - gcc

env:
  # Lua versions to test against
  - LUA_VERSION=5.3.2
  - LUA_VERSION=5.2.4
  - LUA_VERSION=5.1.5

cache:
  directories:
    - lua-$LUA_VERSION

install:
  # Select compiler
  - if [[ "$CXX" = "g++" ]]; then export CXX="g++-5"; fi
  - if [[ "$CXX" = "clang++" ]]; then export CXX="clang++-3.7"; fi

  # Build Lua
  - test -e "lua-$LUA_VERSION/src" || (wget "http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz" && tar xvfz "lua-$LUA_VERSION.tar.gz")
  - pushd "lua-$LUA_VERSION/src"
  - test -e liblua-custom.a || make LUA_A=liblua-custom.a linux
  - export "LUA_SOURCE_PATH=$(pwd)"
  - popd

script:
  - make "LUA_LIBDIR=$LUA_SOURCE_PATH" "LUA_INCDIR=$LUA_SOURCE_PATH" LUA_LIBNAME=lua-custom all

addons:
  apt:
    sources:
      - llvm-toolchain-precise-3.7
      - ubuntu-toolchain-r-test
    packages:
      - clang-3.7
      - g++-5
      - make
      - wget

Allow Travis to cache the Lua directory
build: Allow Travis to cache the Lua directory
