{% set version = "1.42.0" %}

package:
  name: libuv
  version: {{ version }}

source:
  url: https://github.com/libuv/libuv/archive/v{{ version }}.tar.gz
  sha256: 371e5419708f6aaeb8656671f89400b92a9bba6443369af1bb70bcd6e4b3c764
  patches:
    - 0001-Use-Unix-install-logic-for-MSVC.patch
    - test-udp-join-1.31.patch  # [osx]

build:
  number: 0

requirements:
  build:
    - {{ compiler('c') }}
    - automake             # [unix]
    - autoconf             # [unix]
    - libtool              # [unix]
    - make                 # [unix]
    - sed                  # [osx]
    - cmake                # [win]

test:
  commands:
    - test -f "$PREFIX/include/uv.h"    # [unix]
    - test -f "$PREFIX/lib/libuv.a"     # [unix]
    - test -f "$PREFIX/lib/libuv.so.1"  # [linux]
    - test -f "$PREFIX/lib/libuv.1.dylib"  # [osx]
    - test -f "$PREFIX/lib/libuv${SHLIB_EXT}"  # [not win]
    - test -f "$PREFIX/lib/pkgconfig/libuv.pc"  # [not win]
    - if not exist %LIBRARY_INC%\uv.h (exit 1)      # [win]
    - if not exist %LIBRARY_LIB%\uv.lib (exit 1)    # [win]
    - if not exist %LIBRARY_BIN%\uv.dll (exit 1)    # [win]
    - if not exist %LIBRARY_LIB%\uv_a.lib (exit 1)  # [win]
    - if not exist %LIBRARY_LIB%\pkgconfig/libuv-static.pc (exit 1)  # [win]
    - if not exist %LIBRARY_LIB%\pkgconfig/libuv.pc (exit 1)         # [win]

about:
  home: http://libuv.org/
  license: MIT
  license_family: MIT
  license_file: LICENSE
  summary: Cross-platform asynchronous I/O
  description: |
    libuv is a multi-platform support library with a focus on asynchronous I/O.
    It was primarily developed for use by Node.js, but it's also used by Luvit,
    Julia, pyuv, and others.
  doc_url: http://docs.libuv.org/
  dev_url: https://github.com/libuv/libuv

extra:
  recipe-maintainers:
    - frol
    - mariusvniekerk
