{% set version = "3.6.0" %}

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

source:
  url: http://download.osgeo.org/gdal/{{ version }}/gdal-{{ version }}.tar.xz
  sha256: f7afa4aa8d32d0799e011a9f573c6a67e9471f78e70d3d0d0b45b45c8c0c1a94
  patches:
    - 0001-Improve-numpy-fixing.patch
    - 0002-Parquet-make-sure-that-ArrowLayer-destructor-is-avai.patch

build:
  number: 1
  # never be built on s390x
  skip: True  # [linux and s390x]
  skip: True  # [py<36]
  skip_compile_pyc:
    - "share/bash-completion/completions/*.py"
  ignore_run_exports:
    - krb5  # [win]

requirements:
  build:
    - cmake
    - pkg-config >=0.21      # [not win]
    - make                   # [not win]
    - ninja                  # [win]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - sysroot_linux-64 2.17  # [linux64]
    - patch                  # [not win]
    - m2-patch               # [win]

  host:
    - blosc
    - cfitsio
    - expat
    - freexl
    - geos
    - geotiff
    - giflib   # [not win]
    - hdf4
    - hdf5
    - icu
    - jpeg
    - json-c   # [not win]
    - kealib
    - lerc
    - libcurl
    - libdeflate 1.17
    - libiconv
    - libkml
    - libnetcdf
    - libpng
    - libpq
    - libspatialite
    - libtiff
    - libuuid  # [linux]
    - libwebp-base
    - libxml2
    - lz4-c
    - openjpeg
    - openssl
    - pcre2
    - poppler
    - postgresql
    - proj
    - qhull
    - sqlite
    - swig
    - tiledb
    - xerces-c
    - xz
    - 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:
        - cmake
        # ranlib used at install time
        - {{ compiler('c') }}
        - binutils               # [linux]
        # libstdc++ is needed in requirements/run
        - {{ compiler('cxx') }}
        - pkg-config             # [not win]
        - make                   # [unix]
        - ninja                  # [win]
        - sysroot_linux-64 2.17  # [linux and x86_64]

      host:
        - blosc
        - cfitsio
        - expat
        - freexl
        - geos
        - geotiff
        - giflib   # [not win]
        - hdf4
        - hdf5
        - icu
        - jpeg
        - json-c   # [not win]
        - kealib
        - lerc
        - libcurl
        - libdeflate 1.17
        - libiconv
        - libkml
        - libnetcdf
        - libpng
        - libpq
        - libspatialite
        - libtiff
        - libuuid  # [linux]
        - libwebp-base
        - libxml2
        - lz4-c
        - openjpeg
        - openssl
        - pcre2
        - poppler
        - postgresql
        - proj
        - qhull
        - sqlite
        - tiledb
        - xerces-c
        - xz
        - zlib
        - zstd

      run:
        - cfitsio
        - geotiff
        - giflib   # [not win]
        - json-c   # [not win]
        - libiconv
        - libkml
        - libpq
        - libspatialite
        - libuuid  # [linux]
        - libwebp-base
        - libxml2
        - openjpeg
        - poppler
        - postgresql
        - proj
        - qhull
        - tiledb
        - xz
        - zstd

    test:
      files:
        - test_data
        - run_test.bat
        - run_test.sh

    about:
      summary: The Geospatial Data Abstraction Library (GDAL)
      license: MIT
      license_family: MIT
      license_file: LICENSE.TXT

  - name: libgdal-arrow-parquet
    script: build_arrow_parquet.sh  # [unix]
    script: build_arrow_parquet.bat  # [win]
    build:
      # only for libarrow > 10
      skip: True  # [arrow_cpp != "10.0.1"]

    requirements:
      build:
        - cmake
        # ranlib used at install time
        - {{ compiler('c') }}
        - binutils               # [linux]
        # libstdc++ is needed in requirements/run
        - {{ compiler('cxx') }}
        - pkg-config             # [not win]
        - make  # [unix]
        - ninja  # [win]
        - sysroot_linux-64 2.17  # [linux and x86_64]

      host:
        - {{ pin_subpackage('libgdal', max_pin='x.x.x', exact=True) }}
        - blosc
        - cfitsio
        - curl
        - expat
        - freexl
        - geos
        - geotiff
        - giflib   # [not win]
        - hdf4
        - hdf5
        - icu
        - jpeg
        - json-c   # [not win]
        - kealib
        - arrow-cpp
        - libkml
        - libnetcdf
        - libpng
        - libpq
        - libspatialite
        - libtiff
        - libuuid  # [linux]
        - libwebp-base
        - libxml2
        - openjpeg
        - openssl
        - pcre2
        - poppler
        - postgresql
        - proj
        - qhull
        - sqlite
        - tiledb
        - xerces-c
        - xz
        - zlib
        - zstd

      run:
        - {{ pin_subpackage('libgdal', max_pin='x.x.x', exact=True) }}
        - cfitsio
        - geotiff
        - giflib   # [not win]
        - json-c   # [not win]
        - libpq
        - libspatialite
        - libuuid  # [linux]
        - libwebp-base
        - poppler
        - postgresql
        - proj
        - tiledb
        - xz
        - zstd

    test:
      files:
        - test_arrow_parquet.sh   # [unix]
        - test_arrow_parquet.bat  # [win]
      commands:
        - sh test_arrow_parquet.sh   # [unix]
        - test_arrow_parquet.bat  # [win]

    about:
      summary: Arrow and Parquet drivers for the Geospatial Data Abstraction Library (GDAL)
      license: MIT
      license_family: MIT
      license_file: LICENSE.TXT

  - name: gdal
    script: install_python.sh  # [unix]
    script: install_python.bat  # [win]
    build:
      skip_compile_pyc:
        - share/bash-completion/completions/*.py

    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - cmake
        - make   # [unix]
        - ninja  # [win]

      host:
        - python
        - pip
        - setuptools
        - wheel
        - numpy
        - {{ pin_subpackage('libgdal', max_pin='x.x.x', exact=True) }}
        # Workaround to prevent run depending on "libgfortran5 9.3.0" despite "hdf5"
        # having not been migrated yet causing conflicts with the "libgdal" output
        # See: https://github.com/conda-forge/gdal-feedstock/pull/415
        - hdf5
        # Workaround to prevent conflicts seen in
        #  https://github.com/conda-forge/gdal-feedstock/pull/543
        - openssl
        - openjpeg
        - libiconv
        - libxml2
        - blosc
        - cfitsio
        - expat
        - freexl
        - geos
        - geotiff
        - giflib   # [not win]
        - hdf4
      run:
        - python
        - {{ pin_compatible('numpy') }}
        - {{ pin_subpackage('libgdal', max_pin='x.x.x', exact=True) }}

    test:
      files:
        - test_data
        - extra_tests.py
        - run_test.py
      imports:
        - osgeo
        - osgeo.ogr
        - osgeo.gdal
        - osgeo._gdal
        - osgeo._gdalconst
        - osgeo._ogr
        - osgeo._osr
      commands:
        - python run_test.py

      about:
        summary: Python wrapper for the Geospatial Data Abstraction Library (GDAL)
        license: MIT
        license_family: MIT
        license_file: LICENSE.TXT

about:
  home: http://www.gdal.org
  license: MIT
  license_family: MIT
  license_file: LICENSE.TXT
  summary: The Geospatial Data Abstraction Library (GDAL)
  description: |
    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.
  dev_url: https://github.com/OSGeo/gdal
  doc_url: https://gdal.org/tutorials/index.html

extra:
  recipe-maintainers:
    - zklaus
    - akrherz
    - gillins
    - katietz
    - kmuehlbauer
    - mingwandroid
    - msarahan
    - ocefpaf
    - xylar
