task:
  freebsd_instance:
      matrix:
        image: freebsd-11-2-release-amd64
        image: freebsd-12-0-release-amd64

  install_script:
    - pkg install -y cmake
    - pkg install -y git
    - pkg install -y ninja
    - pkg install -y yajl

  script:
    - mkdir build && cd build
    - cmake -GNinja -DPLUGINS='ALL' -DBINDINGS='ALL' -DTARGET_PLUGIN_FOLDER="" -DCMAKE_SKIP_INSTALL_RPATH=ON ..
    - ninja
    - output="$(ninja install 2>&1)" || printf '%s' "$output"

  tests_script:
    # Work around stalled process plugin and library problems on FreeBSD: https://issues.libelektra.org/2323
    - sudo mount -t fdescfs fdesc /dev/fd
    - cd build && ninja run_all
    - kdb run_all

task:
  matrix:

    - freebsd_instance:
        image: freebsd-11-2-release-amd64

    - freebsd_instance:
        image: freebsd-12-0-release-amd64
      env:
        # We use `PLUGINS_KDB` instead of `PLUGINS`, since `pkg` interprets the environment variable `PLUGINS`.
        PLUGINS_KDB: 'ALL;-iconv' # Building the test for the iconv plugin fails: https://cirrus-ci.com/task/4923537438539776

  install_script:
    - pkg install -y cmake
    - pkg install -y git
    - pkg install -y ninja
    - pkg install -y yajl

  script:
    - mkdir build && cd build
    - cmake -GNinja -DPLUGINS="${PLUGINS_KDB:-ALL}" -DBINDINGS='ALL' -DTARGET_PLUGIN_FOLDER="" -DCMAKE_SKIP_INSTALL_RPATH=ON ..
    - ninja
    - output="$(ninja install 2>&1)" || printf '%s' "$output"

  tests_script:
    # Work around stalled process plugin and library problems on FreeBSD: https://issues.libelektra.org/2323
    - sudo mount -t fdescfs fdesc /dev/fd
    - cd build && ninja run_all
    - kdb run_all

Exclude iconv plugin from FreeBSD 12 build
Cirrus: Exclude iconv plugin from FreeBSD 12 build
