distributable:
  url: https://c-ares.org/download/c-ares-{{version}}.tar.gz
  strip-components: 1

versions:
  url: https://c-ares.org/download
  match: /c-ares-\d+\.\d+\.\d+\.tar\.gz/
  strip:
    - /c-ares-/
    - /.tar.gz/

build:
  dependencies:
    cmake.org: ^3
  working-directory: build
  script: |
    cmake .. -DCMAKE_INSTALL_PREFIX="{{prefix}}" -DCMAKE_BUILD_TYPE=Release
    make --jobs {{hw.concurrency}} install

test:
  fixture: |
    #include <stdio.h>
    #include <ares.h>
    int main() {
      ares_library_init(ARES_LIB_INIT_ALL);
      ares_library_cleanup();
      return 0;
    }
  script: |
    mv $FIXTURE b.c
    cc b.c -lcares
    ./a.out
