distributable:
  url: https://www.gnupg.org/ftp/gcrypt/gnutls/v{{ version.marketing }}/gnutls-{{ version.raw }}.tar.xz
  strip-components: 1

versions:
  gitlab: gnutls/gnutls/tags

dependencies:
  freedesktop.org/p11-kit: '*'
  gnu.org/libidn2: '*'
  gnu.org/libunistring: ^1
  gnu.org/libtasn1: ^4
  gnu.org/nettle: '*'
  gnu.org/gettext: '*'
  gnu.org/gmp: '*'
  unbound.net: ^1
  curl.se/ca-certs: '*'

build:
  dependencies:
    linux:
      gnu.org/gcc: '*'
    freedesktop.org/pkg-config: '*'
  script:
    # clang doesn't like the -march=all flag
    - run: sed -i -e 's/-march=all/-mcpu=generic/' Makefile.am Makefile.in
      if: linux/aarch64
      working-directory: lib/accelerated/aarch64/

    #FIXME: use similar logic to the one in openssl.org/x509_def.c to
    # locate {{deps.curl.se/ca-certs.prefix}}/ssl/cert.pem

    - ./configure --prefix={{ prefix }} --disable-guile
    - make --jobs {{ hw.concurrency }} install
  env:
    darwin:
      CFLAGS: $CFLAGS -Wno-implicit-int

test: gnutls-cli --x509cafile={{deps.curl.se/ca-certs.prefix}}/ssl/cert.pem tea.xyz <<< "GET /"

provides:
  - bin/certtool
  - bin/danetool
  - bin/gnutls-cli
  - bin/gnutls-cli-debug
  - bin/gnutls-serv
  - bin/ocsptool
  - bin/p11tool
  - bin/psktool
