{% set version = "8.45" %}

package:
  name: pcre
  version: {{ version }}

source:
  url: https://ftp.pcre.org/pub/pcre/pcre-{{ version }}.tar.gz
  sha256: 4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09
  patches:
    - 0001-Define-snprintf-for-old-VS.patch

build:
  number: 0
  run_exports:
    # mostly OK, but some scary symbol removal.  Let's try for trusting them.
    #    https://abi-laboratory.pro/tracker/timeline/pcre/
    - {{ pin_subpackage('pcre', max_pin='x') }}

requirements:
  build:
    - libtool  # [unix]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake        # [win]
    - pkg-config   # [not win]
    - libtool      # [not win]
    - make         # [unix]

test:
  commands:
    # CLI tests.
    - pcre-config --version                             # [not win]
    - pcregrep --help
    - pcretest --help

    # Verify headers.
    - test -f "${PREFIX}/include/pcre.h"  # [not win]
    - test -f "${PREFIX}/include/pcre_scanner.h"  # [not win]
    - test -f "${PREFIX}/include/pcre_stringpiece.h"  # [not win]
    - test -f "${PREFIX}/include/pcrecpp.h"  # [not win]
    - test -f "${PREFIX}/include/pcrecpparg.h"  # [not win]
    - test -f "${PREFIX}/include/pcreposix.h"  # [not win]
    - if not exist %LIBRARY_INC%\pcre.h exit 1  # [win]
    - if not exist %LIBRARY_INC%\pcre_scanner.h exit 1  # [win]
    - if not exist %LIBRARY_INC%\pcre_stringpiece.h exit 1  # [win]
    - if not exist %LIBRARY_INC%\pcrecpp.h exit 1  # [win]
    - if not exist %LIBRARY_INC%\pcrecpparg.h exit 1  # [win]
    - if not exist %LIBRARY_INC%\pcreposix.h exit 1  # [win]

    # Verify libraries.
    - test -f "${PREFIX}/lib/libpcre.a"  # [not win]
    - test -f "${PREFIX}/lib/libpcre${SHLIB_EXT}"  # [not win]
    - test -f "${PREFIX}/lib/libpcrecpp.a"  # [not win]
    - test -f "${PREFIX}/lib/libpcrecpp${SHLIB_EXT}"  # [not win]
    - test -f "${PREFIX}/lib/libpcreposix.a"  # [not win]
    - test -f "${PREFIX}/lib/libpcreposix${SHLIB_EXT}"  # [not win]
    - if not exist %LIBRARY_LIB%\pcre.lib exit 1  # [win]
    - if not exist %LIBRARY_BIN%\pcre.dll exit 1  # [win]
    - if not exist %LIBRARY_LIB%\pcreposix.lib exit 1  # [win]
    - if not exist %LIBRARY_BIN%\pcreposix.dll exit 1  # [win]
    - if not exist %LIBRARY_LIB%\pcrecpp.lib exit 1  # [win]
    - if not exist %LIBRARY_BIN%\pcrecpp.dll exit 1  # [win]

about:
  home: http://www.pcre.org/
  license: BSD-3-Clause
  license_file: LICENCE
  summary: Regular expression pattern matching using the same syntax and semantics as Perl 5.

extra:
  recipe-maintainers:
    - jakirkham
    - scopatz
    - sebastian-luna-valero
    - saraedum
    - ocefpaf
