{% set version = "3.0.4" %}

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

source:
  url: http://download.osgeo.org/gdal/{{ version }}/gdal-{{ version }}.tar.xz
  sha256: 5569a4daa1abcbba47a9d535172fc335194d9214fdb96cd0f139bb57329ae277
  patches:
    # Use multiple cores on Windows.
    - patches/multiprocessor.patch  # [win]
    # disable 12 bit jpeg on Windows as we aren't using internal jpeg
    - patches/disable_jpeg12.patch  # [win]

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

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

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:
        - cfitsio
        - curl
        - expat
        - freexl
        - geos
        - geotiff
        - giflib  # [not win]
        - hdf4
        - hdf5
        - icu
        - jpeg
        - json-c  # [not win]
        - kealib
        - libdap4  # [not win]
        - libkml
        - libnetcdf
        - libpng
        - libpq
        - libspatialite
        - libtiff
        - libuuid  # [linux]
        - libwebp
        - libxml2
        - m2w64-xz  # [win]
        - openjpeg
        - openssl
        - pcre
        - poppler
        - postgresql
        - proj
        - sqlite
        - tiledb
        - xerces-c
        - xz  # [not win or vc>=14]
        - zlib
        - zstd
      run:
        - cfitsio
        - geotiff
        - giflib  # [not win]
        - json-c  # [not win]
        - libdap4  # [not win]
        - libpq
        - libspatialite
        - libuuid  # [linux]
        - libwebp
        - m2w64-xz  # [win]
        - poppler
        - postgresql
        - proj
        - tiledb
        - xz  # [not win or vc>=14]
        - zstd
    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]
        - {{ RECIPE_DIR }}/run_test.bat  # [win]
        - bash {{ RECIPE_DIR }}/run_test.sh  # [not win]
    about:
      summary: 'The Geospatial Data Abstraction Library (GDAL)'

  - name: gdal
    script: install_python.sh
    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - cmake  # [win]
      host:
        - python
        - pip
        - numpy
        - {{ pin_subpackage('libgdal', exact=True) }}
      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
      commands:
        - python {{ RECIPE_DIR }}/run_test.py
      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
