{% set version = "2.2.2" %}

package:
  name: libgdal
  version: {{ version }}

source:
  url: http://download.osgeo.org/gdal/{{ version }}/gdal-{{ version }}.tar.gz
  sha256: 14c1f78a60f429ad51c08d75cbf49771f1e6b20e7385c6e8379b40e8dfa39544
  patches:
    # Fixes compilation problems with JPEG.
    # https://lists.osgeo.org/pipermail/gdal-dev/2016-January/043443.html
    - disable_jpeg12.patch
    # BUILT_AS_DYNAMIC_LIB.
    - windowshdf5.patch
    # Use multiple cores on Windows.
    - multiprocessor.patch

build:
  number: 1
  run_exports:
    # no idea, going with minor pin
    - {{ pin_subpackage('libgdal', max_pin='x.x') }}

requirements:
  build:
    # pins removed here because they are provided by name matching in conda_build_config.yaml
    - cmake  # [win]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    # - {{ cdt('libxrender-devel') }}  # [linux]
    # - {{ cdt('libxext-devel') }}     # [linux]
    # - {{ cdt('libxau-devel') }}      # [linux]
  host:
    - curl
    - expat
    - freexl
    - geos
    - giflib  # [not win]
    - hdf4
    - hdf5
    - jpeg
    - json-c  # [not win]
    - kealib
    - libdap4  # [not win]
    - libkml
    - libnetcdf
    - libpng
    - libspatialite
    - libtiff
    - openjpeg
    - pkg-config  # [not win]
    - poppler  # [not win]
    - postgresql
    - proj4
    - sqlite
    - xerces-c
    - zlib
    - xz  # [not win or vc>=14]

  run:
    - curl
    # - expat
    # - freexl
    # geos removed here because package has run_exports for itself
    #    https://github.com/AnacondaRecipes/geos-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - geos
    # giflib removed here because package has run_exports for itself
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    #    https://github.com/AnacondaRecipes/giflib-feedstock/pull/1
    #  - giflib 5.1.*  # [not win]
    # hdf4 removed here because package has run_exports for itself
    #    https://github.com/AnacondaRecipes/hdf4-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - hdf4
    # hdf5 removed here because hdf5 package has run_exports for itself
    #    https://github.com/AnacondaRecipes/hdf5-feedstock/pull/1/files#diff-e178b687b10a71a3348107ae3154e44cR31
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - hdf5
    # jpeg removed here because package has run_exports for itself
    #    https://github.com/AnacondaRecipes/jpeg-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - jpeg
    # - json-c  # [not win]
    # - kealib
    # libdap4 removed here because package has run_exports for itself
    #     https://github.com/AnacondaRecipes/libdap4-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - libdap4 3.18.*  # [not win]
    # libkml removed here because package has run_exports for itself
    #     https://github.com/AnacondaRecipes/libdap4-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - libkml  1.3.0  # [not win]
    # libnetcdf removed here because package has run_exports for itself
    #    https://github.com/AnacondaRecipes/libnetcdf-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - libnetcdf 4.4.*
    # libpng removed here because package has run_exports for itself
    #    https://github.com/AnacondaRecipes/libpng-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - libpng >=1.6.28,<1.7
    # - libpq
    # - libspatialite
    # libtiff removed here because package has run_exports for itself
    #    https://github.com/AnacondaRecipes/libtiff-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - libtiff 4.0.*
    # - openjpeg
    # - poppler  # [not win]
    # proj4 removed here because proj4 package has run_exports for itself
    #   https://github.com/AnacondaRecipes/proj.4-feedstock/pull/1
    # - proj4
    # sqlite removed here because sqlite package has run_exports for itself
    #   https://github.com/AnacondaRecipes/sqlite-feedstock/pull/1
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - sqlite
    # - xerces-c
    # zlib removed here because zlib package has run_exports for itself
    #    https://github.com/AnacondaRecipes/zlib-feedstock/pull/2
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - zlib
    # xz removed here because xz package has run_exports for itself
    #    https://github.com/AnacondaRecipes/xz-feedstock/pull/2
    # this req isn't actually necessary, as run_exports will add it.  Left here for reference.
    # - xz

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]
    - conda inspect linkages -p $PREFIX libgdal  # [not win]
    - conda inspect objects -p $PREFIX libgdal  # [osx]

about:
  home: http://www.gdal.org/
  license: MIT
  license_file: LICENSE.TXT
  summary: 'The Geospatial Data Abstraction Library (GDAL).'

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