distributable:
  url: https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-{{version}}.tar.gz
  strip-components: 1

versions:
  url: https://ftp.gnu.org/gnu/libmicrohttpd/
  match: /libmicrohttpd-\d+\.\d+\.\d+\.tar\.gz/
  strip:
    - /^libmicrohttpd-/
    - /\.tar\.gz$/

dependencies:
  gnu.org/libunistring: ^1

build:
  script:
    - ./configure $ARGS
    - make --jobs {{ hw.concurrency }} install
  env:
    ARGS:
      - --disable-dependency-tracking
      - --disable-silent-rules
      - --prefix={{prefix}}

test:
  dependencies:
    curl.se: '*'
  script:
    - cc test.c -lmicrohttpd -o test
    - ./test &
    - echo $! > test.pid
    - sleep 1
    - curl -L http://localhost:8888/ | grep 'namepost'
    - kill $(cat test.pid)
