{% set version = "14.2.4" %}
{% set sha_hash = "55c780f7faa5c8cabd83ebbb84b68e5e0e09732de70a129f6b3c801e905415dd" %}
{% set build_number = 2 %}


package:
  name: reproc
  version: '{{ version }}'

source:
  - url: https://github.com/DaanDeMeyer/reproc/archive/v{{ version }}.tar.gz
    sha256: {{ sha_hash }}
    patches:
      - apple_gettime.patch  # [osx]

build:
  number: {{ build_number }}
  missing_dso_whitelist:  # [s390x]
    - $RPATH/ld64.so.1    # [s390x]  Something is slightly amiss in the s390x build process.

requirements:
  build:
    - {{ compiler("c") }}
    - {{ compiler("cxx") }}
    - cmake
    - ninja

outputs:
  - name: reproc
    script: build_c.sh  # [unix]
    script: bld_c.bat   # [win]
    build:
      run_exports:
        - "{{ pin_subpackage('reproc', 'x.x') }}"
    requirements:
      build:
        - {{ compiler("c") }}
        - cmake
        - ninja
    test:
      commands:
        - test -f ${PREFIX}/include/reproc/run.h                          # [unix]
        - test -f ${PREFIX}/lib/libreproc${SHLIB_EXT}                     # [unix]
        - test -f ${PREFIX}/lib/cmake/reproc/reproc-config-version.cmake  # [unix]
        - test ! -f ${PREFIX}/lib/libreproc.a                             # [unix]
        - if exist %LIBRARY_PREFIX%\include\reproc\run.h (exit 0) else (exit 1)  # [win]
        - if exist %LIBRARY_PREFIX%\lib\cmake\reproc\reproc-config-version.cmake (exit 0) else (exit 1)  # [win]
        - if exist %LIBRARY_PREFIX%\lib\reproc.lib (exit 0) else (exit 1)  # [win]
        - if exist %LIBRARY_PREFIX%\bin\reproc.dll (exit 0) else (exit 1)  # [win]

  - name: reproc-cpp
    script: build_cpp.sh  # [unix]
    script: bld_cpp.bat   # [win]
    build:
      run_exports:
        - {{ pin_subpackage('reproc-cpp', 'x.x') }}
    requirements:
      build:
        - {{ compiler("c") }}
        - {{ compiler("cxx") }}
        - cmake
        - ninja
      host:
        - {{ pin_subpackage('reproc', exact=True ) }}
      run:
        - {{ pin_subpackage('reproc', exact=True ) }}
    test:
      commands:
        - test -f ${PREFIX}/include/reproc++/reproc.hpp               # [unix]
        - test -f ${PREFIX}/lib/libreproc++${SHLIB_EXT}               # [unix]
        - test -f ${PREFIX}/lib/cmake/reproc++/reproc++-config.cmake  # [unix]
        - test ! -f ${PREFIX}/lib/libreproc++.a                       # [unix]
        - if exist %LIBRARY_PREFIX%\include\reproc++\reproc.hpp (exit 0) else (exit 1)  # [win]
        - if exist %LIBRARY_PREFIX%\lib\cmake\reproc++\reproc++-config.cmake (exit 0) else (exit 1)  # [win]
        - if exist %LIBRARY_PREFIX%\lib\reproc++.lib (exit 0) else (exit 1)  # [win]
        - if exist %LIBRARY_PREFIX%\bin\reproc++.dll (exit 0) else (exit 1)  # [win]

  - name: reproc-static
    script: build_c.sh  # [unix]
    script: bld_c.bat  # [win]
    build:
      ignore_run_exports:
        - reproc
    requirements:
      build:
        - {{ compiler("c") }}
        - cmake
        - ninja
      host:
        - {{ pin_subpackage('reproc', exact=True ) }}
    test:
      commands:
        - test ! -f ${PREFIX}/include/reproc/run.h                          # [unix]
        - test ! -f ${PREFIX}/lib/libreproc${SHLIB_EXT}                     # [unix]
        - test ! -f ${PREFIX}/lib/cmake/reproc/reproc-config-version.cmake  # [unix]
        - test -f ${PREFIX}/lib/libreproc.a                                 # [unix]
        - if exist %LIBRARY_PREFIX%\lib\reproc_static.lib (exit 0) else (exit 1)  # [win]

  - name: reproc-cpp-static
    script: build_cpp.sh  # [unix]
    script: bld_cpp.bat   # [win]
    build:
      ignore_run_exports:
        - reproc
        - reproc-cpp
    requirements:
      build:
        - {{ compiler("c") }}
        - {{ compiler("cxx") }}
        - cmake
        - ninja
      host:
        - {{ pin_subpackage('reproc', exact=True ) }}
        - {{ pin_subpackage('reproc-static', exact=True ) }}
        - {{ pin_subpackage('reproc-cpp', exact=True ) }}
    test:
      commands:
        - test ! -f ${PREFIX}/include/reproc++/reproc.hpp                # [unix]
        - test ! -f ${PREFIX}/lib/libreproc++${SHLIB_EXT}                # [unix]
        - test ! -f ${PREFIX}/lib/cmake/reproc++/reproc++-config.cmake   # [unix]
        - test -f ${PREFIX}/lib/libreproc++.a                            # [unix]
        - if exist %LIBRARY_PREFIX%\lib\reproc++_static.lib (exit 0) else (exit 1)  # [win]

about:
  home: https://github.com/DaanDeMeyer/reproc
  license_file: LICENSE
  license: MIT
  license_family: MIT
  summary: reproc (Redirected Process) is a cross-platform C/C++ library that simplifies starting, stopping and communicating with external programs.
  dev_url: https://github.com/DaanDeMeyer/reproc
  doc_url: https://github.com/DaanDeMeyer/reproc#reproc
  doc_src_url: https://github.com/DaanDeMeyer/reproc

extra:
  recipe-maintainers:
    - wolfv
    - DaanDeMeyer
