---
language: python
python: nightly
dist: xenial
os: linux

jobs:
  include:
    - env: JOB=linux

      addons:
        apt:
          packages:
            - libalut-dev
            - libconfig-dev
            - libnotify-dev
            - libopenal-dev
            - libopus-dev
            - libqrencode-dev
            - libvpx-dev

      cache:
        directories:
          - $HOME/cache

      install:
        # Where to find libraries.
        - export LD_LIBRARY_PATH=$HOME/cache/usr/lib
        - export PKG_CONFIG_PATH=$HOME/cache/usr/lib/pkgconfig
        # c-sodium
        - git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium
        - test -f $HOME/cache/usr/lib/libsodium.so || (cd ../libsodium && ./configure --prefix=$HOME/cache/usr && make install -j$(nproc))
        # c-toxcore
        - git clone --depth=1 https://github.com/TokTok/c-toxcore ../c-toxcore
        - test -f $HOME/cache/usr/lib/libtoxcore.so || (cd ../c-toxcore && cmake -B_build -H. -DCMAKE_INSTALL_PREFIX:PATH=$HOME/cache/usr && make -C_build install -j$(nproc))

      script:
        - make ENABLE_PYTHON=1 -j$(nproc)

    - env: JOB=macos
      os: macos
      language: c

      cache:
        directories:
          - $HOME/cache

      install:
        - brew install
          freealut
          libconfig
          libqrencode
          libsodium
          openal-soft
        - export LDFLAGS="-L/usr/local/Cellar/openal-soft/1.21.0/lib"
        - git clone --depth=1 https://github.com/TokTok/c-toxcore ../c-toxcore
        - test -f /usr/local/lib/libtoxcore.dylib || (cd ../c-toxcore && cmake -B_build -H. && make -C_build install -j$(nproc))

      script:
        - make ENABLE_PYTHON=1 DISABLE_DESKTOP_NOTIFY=1 DISABLE_X11=1 DISABLE_AV=1 DISABLE_SOUND_NOTIFY=1 -j$(nproc)
