{% set name = "lcms2" %}
{% set version = "2.16" %}

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

source:
  url: https://github.com/mm2/Little-CMS/releases/download/lcms{{ version }}/lcms2-{{ version }}.tar.gz
  sha256: d873d34ad8b9b4cea010631f1a6228d2087475e4dc5e763eb81acc23d9d45a51
  patches:
    - 0001_windows_linux_compat.patch          # [win]
    - 0002_change_windows_sdk_version.patch    # [win]
    - 0003_fix_a_bug_in_planar_half16_formatter.patch

build:
  number: 0
  skip: true  # [win and vc<14]
  run_exports:
    - {{ pin_subpackage("lcms2") }}

requirements:
  build:
    - {{ compiler('c') }}
    - make      # [not win]
    - libtool   # [unix]
    - m2-patch  # [win]
    - patch     # [not win]
  host:
    - jpeg {{ jpeg }}
    - libtiff {{ libtiff }}

test:
  commands:
    - jpgicc
    - tificc
    - linkicc
    - transicc
    - psicc
    - test -f ${PREFIX}/include/lcms2.h  # [not win]
    - test -f ${PREFIX}/include/lcms2_plugin.h  # [not win]
    - test ! -f ${PREFIX}/lib/liblcms2.a  # [not win]
    - test -f ${PREFIX}/lib/liblcms2${SHLIB_EXT}  # [not win]
    - test -f ${PREFIX}/lib/pkgconfig/lcms2.pc  # [not win]
    - if not exist %LIBRARY_INC%\\lcms2_plugin.h exit 1  # [win]
    - if not exist %LIBRARY_INC%\\lcms2.h exit 1  # [win]
    - if not exist %LIBRARY_LIB%\\lcms2.lib exit 1  # [win]
    - if not exist %LIBRARY_BIN%\\lcms2.dll exit 1  # [win]

about:
  home: https://www.littlecms.com/
  dev_url: https://github.com/mm2/Little-CMS
  doc_url: https://github.com/mm2/Little-CMS/tree/master/doc
  license: MIT
  license_family: MIT
  license_file: LICENSE
  summary: Open Source Color Management Engine
  description: |
    Little CMS intends to be an OPEN SOURCE small-footprint color management engine,
    with special focus on accuracy and performance.
    It uses the International Color Consortium standard (ICC),
    which is the modern standard when regarding to color management.
    The ICC specification is widely used and is referred to in many International
    and other de-facto standards. It was approved as an International Standard, ISO 15076-1, in 2005.

extra:
  recipe-maintainers:
    - isuruf
    - hmaarrfk
