{% set version = "2.3.3" %}

package:
  name: gdal-split
  version: {{ version }}

source:
  url: http://download.osgeo.org/gdal/{{ version }}/gdal-{{ version }}.tar.xz
  sha256: c3635e41766a648f945d235b922e3c5306e26a2ee5bbd730d2181e242f5f46fe
  patches:
    # BUILT_AS_DYNAMIC_LIB.
    - 0001-windowshdf5.patch
    # Use multiple cores on Windows.
    - 0002-multiprocessor.patch
    # ensure that our search path on windows includes our Library\bin folder.  Not sure this is necessary?
    - 0003-prepend-dll.patch

build:
  number: 0
  skip: True  # [win and vc<14]

requirements:
  build:
    - cmake  # [win]
    - pkg-config >=0.21  # [not win]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
  host:
    - expat
    - freexl
    - geos
    - giflib  # [not win]
    - hdf4
    - hdf5
    - icu
    - jpeg
    - json-c  # [not win]
    - kealib
    - libcurl
    - libdap4  # [not win]
    - libkml
    - libnetcdf
    - libpng
    - libpq
    - libspatialite
    - libtiff
    - libuuid  # [linux]
    - libxml2
    - openjpeg  # [not win]
    - openssl
    - pcre
    - poppler  # [not win]
    - postgresql
    - proj4
    - sqlite
    - xerces-c
    - xz  # [not win or vc>=14]
    - m2w64-xz  # [win]
    - zlib

outputs:
  - name: libgdal
    script: install_lib.sh   # [unix]
    script: install_lib.bat  # [win]
    build:
      run_exports:
        # no idea, going with minor pin
        - {{ pin_subpackage('libgdal', max_pin='x.x') }}
    requirements:
      build:
        # ranlib used at install time
        - {{ compiler('c') }}
        # libstdc++ is needed in requirements/run
        - {{ compiler('cxx') }}
        - pkg-config  # [not win]
      host:
        - expat
        - freexl
        - geos
        - giflib  # [not win]
        - hdf4
        - hdf5
        - jpeg
        - json-c  # [not win]
        - icu
        - kealib
        - libcurl
        - libdap4  # [not win]
        - libiconv  # [osx]
        - libkml
        - libnetcdf
        - libpng
        - libpq
        - libspatialite
        - libtiff
        - libuuid  # [linux]
        - libxml2
        - openjpeg  # [not win]
        - openssl
        - pcre
        - poppler  # [not win]
        - postgresql
        - proj4
        - sqlite
        - xerces-c
        - xz  # [not win or vc>=14]
        - m2w64-xz  # [win]
        - zlib
    test:
      files:
        - test_data
      commands:
        - gdal_grid --version
        - gdal_rasterize --version
        - gdal_translate --version
        - gdaladdo --version
        - gdalenhance --version
        - gdalwarp --version
        - gdalinfo --formats
        - gdalinfo http://thredds.nersc.no/thredds/dodsC/greenpath/Model/topaz  # [not win]
    about:
      summary: 'The Geospatial Data Abstraction Library (GDAL)'

  - name: gdal
    script: install_python.sh   # [unix]
    script: install_python.bat  # [win]
    build:
      ignore_run_exports:
        - openssl
        - hdf5
    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - cmake  # [win]
      host:
        - python
        - pip
        - numpy
        - {{ pin_subpackage('libgdal', exact=True) }}
        # openssl and hdf5 are dependencies from libgdal but are included here
        # as conda-build tried to use incompatible versions if they are not
        # explicitiy listed.  Ignore the run exports using ignore_run_exports.
        # see https://github.com/conda/conda-build/issues/3308
        - openssl
        - hdf5
      run:
        - python
        - {{ pin_compatible('numpy') }}
        - {{ pin_subpackage('libgdal', exact=True) }}
    test:
      files:
        - test_data
        - extra_tests.py
      imports:
        - osr
        - gdal
        - gdalconst
        - osgeo
        - osgeo.ogr
        - osgeo.gdal
        - osgeo._gdal
        - osgeo._gdalconst
        - osgeo._ogr
        - osgeo._osr
      about:
        summary: 'Python wrapper for the Geospatial Data Abstraction Library (GDAL)'

about:
  home: http://www.gdal.org
  license: MIT
  license_file: LICENSE.TXT
  summary: |
    GDAL is a translator library for raster and vector geospatial data formats that is released under an
    X/MIT style Open Source license by the Open Source Geospatial Foundation. 

extra:
  recipe-maintainers:
    - gillins
    - kmuehlbauer
    - mingwandroid
    - msarahan
    - ocefpaf
