task:
  matrix:

    - name: 😈 FreeBSD 11
      freebsd_instance:
        image: freebsd-11-2-release-amd64

    - name: 😈 FreeBSD 12
      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;-filecheck' # Linking the iconv library 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

task:
  matrix:

    - name: 😈 FreeBSD 11
      freebsd_instance:
        image: freebsd-11-2-release-amd64

    - name: 😈 FreeBSD 12
      freebsd_instance:
        image: freebsd-12-0-release-amd64
      env:
        PLUGINS: 'ALL;-iconv;-filecheck' # Linking the iconv library fails: https://cirrus-ci.com/task/4923537438539776

  install_script:
    - PLUGINS_KDB="$PLUGINS"; unset PLUGINS # `pkg` tries to load modules from the environment variable `PLUGINS`
    - >
      pkg install -y
      cmake
      git
      ninja
      yajl
    - export PLUGINS="$PLUGINS_KDB"; unset PLUGINS_KDB

  script:
    - mkdir build && cd build
    - cmake -GNinja -DPLUGINS="${PLUGINS:-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

Improve name of environment variable
Cirrus: Improve name of environment variable
