---
addons:
  apt:
    packages:
      - aspcud
      - opam
      - libffi-dev
    sources:
      - avsm

before_cache:
  - rm -rf ~/.opam/log/

cache:
  directories:
    - $HOME/.opam
env:
  - OCAML_VERSION=4.05.0 COQ_VERSION=8.7.2 OPAMYES=yes OCB_VERSION=0.12.0

matrix:
    include:
        - os: osx
          env: LIB_EXT=dylib
        - os: linux
          env: LIB_EXT=so

before_install:
  - if [[ $TRAVIS_OS_NAME == 'osx' ]];
    then
      brew update;
      brew install libffi;
      (brew outdated "pkg-config" || brew upgrade "pkg-config");
      brew install opam;
      export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH;
    fi

install:
  - opam init -n --comp $OCAML_VERSION
  - opam update
  - opam install coq.$COQ_VERSION
  - opam install ocamlbuild.$OCB_VERSION
  - eval $(opam config env)
  - ./configure.sh
  - cd libhsem
  - ./configure.sh

language: c

script:
  - cd "$TRAVIS_BUILD_DIR"
  - make
  - cd libhsem
  - make
  - ocamlbuild lib/libhsem.${LIB_EXT}; find _build/lib
  - make test

os:
  - linux
  - osx

---
addons:
  apt:
    packages:
      - aspcud
      - opam
      - libffi-dev
    sources:
      - avsm

before_cache:
  - rm -rf ~/.opam/log/

cache:
  directories:
    - $HOME/.opam
env:
  - OCAML_VERSION=4.05.0 COQ_VERSION=8.7.2 OPAMYES=yes OCB_VERSION=0.12.0

before_install:
  - if [[ $TRAVIS_OS_NAME == 'osx' ]];
    then
      brew update;
      brew install libffi;
      (brew outdated "pkg-config" || brew upgrade "pkg-config");
      brew install opam;
      export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH;
    fi

install:
  - opam init -n --comp $OCAML_VERSION
  - opam update
  - opam install coq.$COQ_VERSION
  - opam install ocamlbuild.$OCB_VERSION
  - eval $(opam config env)
  - ./configure.sh
  - cd libhsem
  - ./configure.sh

language: c

script:
  - cd "$TRAVIS_BUILD_DIR"
  - make
  - cd libhsem
  - make
  - [[ $TRAVIS_OS_NAME == 'osx' ]] && export LIB_EXT=dylib
  - [[ $TRAVIS_OS_NAME == 'linux' ]] && export LIB_EXT=so
  - ocamlbuild lib/libhsem.${LIB_EXT}; find _build/lib
  - make test

os:
  - linux
  - osx

Simplify the way we generate extensions.
Simplify the way we generate extensions.
