distributable:
  url: https://github.com/google/woff2/archive/v{{version}}.tar.gz
  strip-components: 1
versions:
  github: google/woff2
dependencies:
  github.com/google/brotli: '*'
  linux:
    gnu.org/gcc: '*'
build:
  dependencies:
    cmake.org: '*'
  script:
    - cmake . $CMAKE_ARGS
    - make --jobs {{ hw.concurrency }} install
    - mkdir -p {{prefix}}/bin
    - install woff2_info woff2_decompress woff2_compress {{prefix}}/bin/
  env:
    CMAKE_ARGS:
      - -DCMAKE_INSTALL_PREFIX={{prefix}}
      - -DCMAKE_INSTALL_LIBDIR={{prefix}}/lib
      - -DCMAKE_BUILD_TYPE=Release
      - -DCMAKE_FIND_FRAMEWORK=LAST
      - -DCMAKE_VERBOSE_MAKEFILE=ON
      - -Wno-dev
      - -DBUILD_TESTING=OFF
      - -DCMAKE_INSTALL_NAME_DIR={{prefix}}/lib
      - -DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON
    linux:
      CMAKE_ARGS:
        - -DCMAKE_C_COMPILER=gcc
        - -DCMAKE_CXX_COMPILER=g++
provides:
  - bin/woff2_info
  - bin/woff2_decompress
  - bin/woff2_compress
test:
  dependencies:
    gnu.org/wget: '*'
    linux:
      darwinsys.com/file: '*'
  script:
    - wget "$roboto_1"
    - wget "$roboto_2"
    - woff2_compress KFOmCnqEu92Fr1Mu4mxP.ttf
    - woff2_info KFOmCnqEu92Fr1Mu4mxP.woff2
    - woff2_decompress KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2
    - file --brief KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.ttf
  env:
    roboto_1: https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxP.ttf
    roboto_2: https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2
