FreeBSD_task:
  freebsd_instance:
    image_family: freebsd-13-1
  env:
    PREFIX: ${HOME}/opt
    PATH: ${PREFIX}/bin:${PATH}
    OPENSSL_BRANCH: OpenSSL_1_1_1r
  install_script:
    - pkg install -y git cmake p5-App-cpanminus gdb pkgconf
    - sudo cpanm --notest Test2::V0
  script:
    - git clone --depth 1 -b ${OPENSSL_BRANCH} https://github.com/openssl/openssl.git
    - cd openssl
    - patch -p0 < ../patches/openssl_111r.diff
    - patch -p0 < ../patches/openssl_111r_obj.diff
    - patch -p0 < ../patches/openssl_111r_tls13.diff
    - ./config shared -d --prefix=${PREFIX} --openssldir=${PREFIX} -Wl,-rpath=${PREFIX}/lib && make all install_sw > build.log 2>&1 || (cat build.log && exit 1)
    - cd ..
    - mkdir build
    - cd build
    - cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib -DOPENSSL_ENGINES_DIR=${PREFIX}/engines ..
    - make
    - make test CTEST_OUTPUT_ON_FAILURE=1
