{% set version = "70.1" %}
{% set version_under = version.replace(".", "_") %}
{% set version_hyphen = version.replace(".", "-") %}

package:
  name: icu
  version: {{ version }}

source:
  - url: https://github.com/unicode-org/icu/releases/download/release-{{ version_hyphen }}/icu4c-{{ version_under }}-src.tgz
    sha256: 8d205428c17bf13bb535300669ed28b338a157b1c01ae66d31d0d3e2d47c3fd5
    patches:
      # Include an extra header when using mingw.
      - icu4c-4_9_1-mingw-w64-mkdir-compatibility.patch  # [win]
      # Omit lib prefix on libraries.
      - icu-config.patch  # [win]
      - mach-port-t.patch  # [osx]

  - url: https://github.com/unicode-org/icu/releases/download/release-{{ version_hyphen }}/icu4c-{{ version_under }}-data.zip
    sha256: c72723ddba3300ffb231d6b09e2a728ea6e89de10ed5927f74bacbd77042336e
    folder: source/data

build:
  number: 0
  run_exports:
    # icu changes their file extension with each major rev.  Default pin OK.
    - {{ pin_subpackage('icu') }}

requirements:
  build:
    - m2-base  # [win]
    - m2-make  # [win]
    - libtool  # [unix]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - make     # [unix]
  host:
  run:

test:
  files:
    # From http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/gb-18030-2000.ucm
    - gb-18030-2000.ucm
    # From ICU's data folder.
    - de.txt
  commands:
    # Libraries
    {% set libs = [
       "libicudata",
       "libicui18n",
       "libicuio",
       "libicutest",
       "libicutu",
       "libicuuc"
     ] %}
    {% for each_lib in libs %}
    - test -f $PREFIX/lib/{{ each_lib }}.a  # [not win]
    - test -f $PREFIX/lib/{{ each_lib }}.{{ version }}.dylib   # [osx]
    - test -f $PREFIX/lib/{{ each_lib }}.so.{{ version }}  # [linux]
    {% endfor %}

    # CLI tests
    - genbrk --help
    - gencfu --help
    - gencnval --help
    - gendict --help
    - icuinfo --help
    - icu-config --help  # [not win]
    - makeconv gb-18030-2000.ucm

about:
  home: http://site.icu-project.org/
  license: MIT
  license_file: LICENSE
  summary: International Components for Unicode.

extra:
  recipe-maintainers:
    - ccordoba12
    - jakirkham
    - msarahan
    - ocefpaf
    - xhochy
