{% set name = "s2n" %}
{% set version = "1.0.10" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/awslabs/{{ name }}/archive/v{{ version }}.tar.gz
  sha256: 15a1d9dc8f498cfd54c3c25aa9c4b4876bb7fdab6b7888968e8eddc3a66eacef
  patches:
    - ppc64le_support.patch

build:
  number: 0
  skip: true  # [win]
  run_exports:
    - {{ pin_subpackage("s2n", max_pin="x.x.x") }}

outputs:
  - name: s2n
    script: build-shared.sh  # [unix]
    script: bld-shared.bat  # [win]
    build:
      activate_in_script: true
      run_exports:
        - {{ pin_subpackage("s2n", max_pin="x.x.x") }}
    requirements:
      build:
        - cmake
        - {{ compiler('c') }}
        - ninja
      host:
        - openssl
    test:
      commands:
        - test -f $PREFIX/lib/libs2n${SHLIB_EXT}  # [unix]
        - test ! -f $PREFIX/lib/libs2n.a  # [unix]
        - test -f $PREFIX/include/s2n.h  # [unix]
  - name: s2n-static
    script: build-static.sh  # [unix]
    script: bld-static.bat  # [win]
    build:
      activate_in_script: true
    requirements:
      build:
        - cmake
        - {{ compiler('c') }}
        - ninja
      host:
        - libopenssl-static
        - {{ pin_subpackage("s2n", exact=True) }}
    test:
      commands:
        - test -f $PREFIX/lib/libs2n.a  # [unix]

about:
  home: https://github.com/awslabs/s2n
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE
  summary: an implementation of the TLS/SSL protocols

extra:
  recipe-maintainers:
    - xhochy
    - davidbrochart
