# Use container system
sudo: false

# Add APT dependencies
addons:
  apt:
    packages:
    - git
    - pkg-config
    - libssl-dev

# Cache OpenSSL build
cache:
  directories:
  - $HOME/build/dependencies/openssl-*

# Build matrix
language: c

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

dist:
  - trusty
  - precise

# TODO: Re-enable once Travis upgraded to OpenSSL >= 1.0.2
#env:
#  - ENFORCE_OPENSSL=0
#  - ENFORCE_OPENSSL=1

# Make dependencies
install:
  - ./make-dependencies.sh

# Set environment vars
before_script:
  - export PKG_CONFIG_PATH=${HOME}/build/prefix/lib/pkgconfig:${PKG_CONFIG_PATH}
  - export LD_LIBRARY_PATH=${HOME}/build/prefix/lib:${LD_LIBRARY_PATH}
  - export PATH=${HOME}/build/prefix/bin:${PATH}

# Install library and run tests
script:
  - cd build
  - cmake -DCMAKE_INSTALL_PREFIX=${HOME}/build/prefix ..
  - make install
  - echo TODO: make test
#  - make test

# Use container system
sudo: false

# Cache OpenSSL build
cache:
  directories:
  - $HOME/build/dependencies/openssl-*

# Build matrix
language: c

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

matrix:
  include:
    - os: linux
      dist: trusty

env:
  - ENFORCE_OPENSSL=0
  - ENFORCE_OPENSSL=1

# Linux dependencies
addons:
  apt:
    packages:
    - git
    - pkg-config
    - libssl-dev

# OSX dependencies
before_install:
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install git pkg-config openssl; fi

# Make dependencies
install:
  - ./make-dependencies.sh

# Set environment vars
before_script:
  - export PKG_CONFIG_PATH=${HOME}/build/prefix/lib/pkgconfig:${PKG_CONFIG_PATH}
  - export LD_LIBRARY_PATH=${HOME}/build/prefix/lib:${LD_LIBRARY_PATH}
  - export PATH=${HOME}/build/prefix/bin:${PATH}

# Install library and run tests
script:
  - cd build
  - cmake -DCMAKE_INSTALL_PREFIX=${HOME}/build/prefix ..
  - make install
  - echo TODO: make test
#  - make test

Fix build on trusty Fix dependencies for OSX Re-add environments
Fix build on trusty
Fix dependencies for OSX
Re-add environments
