{% set version = "9.1.1" %}

package:
  name: proj
  version: {{ version }}

source:
  url: https://download.osgeo.org/proj/proj-{{ version }}.tar.gz
  sha256: 003cd4010e52bb5eb8f7de1c143753aa830c8902b6ed01209f294846e40e6d39
  patches:
    - 0001-disable-geodsigntest.patch
    - 0002-add-proj-networking-state-cache-inf.patch

build:
  number: 2
  run_exports:
    # so name changes in bugfix revisions.  Pin to bugfix revision.
    #    https://abi-laboratory.pro/tracker/timeline/proj/
    - {{ pin_subpackage('proj', max_pin='x.x.x') }}

requirements:
  build:
    - cmake
    - make  # [not win]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - sqlite     # [build_platform != target_platform]
  host:
    - sqlite
    - libtiff
    - libcurl
  run:
    - sqlite
    - libtiff
    - libcurl
  run_constrained:
    - proj4 ==999999999999

test:
  commands:
    - test -f ${PREFIX}/lib/libproj${SHLIB_EXT}  # [unix]
    - test ! -f ${PREFIX}/lib/libproj.a          # [unix]
    - if not exist %LIBRARY_LIB%\\proj.lib exit 1  # [win]
    - echo -105 40 | proj +proj=utm +zone=13 +ellps=WGS84
    - echo -117 30 | cs2cs +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83
    - echo -105 40 | cs2cs +init=epsg:4326 +to +init=epsg:2975

about:
  home: https://proj.org/
  license: MIT
  license_file: COPYING
  summary: Cartographic Projections and Coordinate Transformations Library

extra:
  recipe-maintainers:
    - hobu
    - msarahan
    - mwtoews
    - ocefpaf
    - pelson
    - snowman2
    - xylar