diff --git a/recipe/0002-Parquet-make-sure-that-ArrowLayer-destructor-is-avai.patch b/recipe/0002-Parquet-make-sure-that-ArrowLayer-destructor-is-avai.patch new file mode 100644 index 00000000..bc299ca1 --- /dev/null +++ b/recipe/0002-Parquet-make-sure-that-ArrowLayer-destructor-is-avai.patch @@ -0,0 +1,25 @@ +From eee1b439437788e9ecb65b600b8cd33d2012be32 Mon Sep 17 00:00:00 2001 +From: Even Rouault +Date: Fri, 18 Nov 2022 02:09:18 +0100 +Subject: [PATCH] Parquet: make sure that ArrowLayer destructor is available + (for plugin) + +--- + ogr/ogrsf_frmts/parquet/ogrparquetdriver.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ogr/ogrsf_frmts/parquet/ogrparquetdriver.cpp b/ogr/ogrsf_frmts/parquet/ogrparquetdriver.cpp +index ff112586ed..3303f999f4 100644 +--- a/ogr/ogrsf_frmts/parquet/ogrparquetdriver.cpp ++++ b/ogr/ogrsf_frmts/parquet/ogrparquetdriver.cpp +@@ -35,6 +35,7 @@ + #include "../arrow_common/ograrrowrandomaccessfile.h" + #include "../arrow_common/ograrrowwritablefile.h" + #include "../arrow_common/ograrrowdataset.hpp" ++#include "../arrow_common/ograrrowlayer.hpp" // for the destructor + + /************************************************************************/ + /* Identify() */ +-- +2.25.1 + diff --git a/recipe/bld.bat b/recipe/bld.bat index e4e5f518..2905d06d 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -9,6 +9,9 @@ if %vc% GTR 9 set MSVC_VER=1900 if %vc% LEQ 9 set MSVC_TS_VER=90 if %vc% GTR 9 set MSVC_TS_VER=140 +REM Make sure to disable Arrow/Parquet dependencies for now, so they are only +REM used in build_arrow_parquet + cmake -G "Ninja" ^ "%CMAKE_ARGS%" ^ -DMSVC_VERSION="%MSVC_VER%" ^ @@ -27,6 +30,12 @@ cmake -G "Ninja" ^ -DKEA_LIBRARY:PATH="%LIBRARY_LIB%\libkea.lib" ^ -DGDAL_USE_MYSQL:BOOL=OFF ^ -DGDAL_USE_MSSQL_ODBC:BOOL=OFF ^ + -DGDAL_USE_PARQUET=OFF ^ + -DGDAL_USE_ARROW=OFF ^ + -DGDAL_USE_ARROWDATASET=OFF ^ + -DBUILD_PYTHON_BINDINGS:BOOL=OFF ^ + -DBUILD_JAVA_BINDINGS:BOOL=OFF ^ + -DBUILD_CSHARP_BINDINGS:BOOL=OFF ^ "%SRC_DIR%" if errorlevel 1 exit /b 1 diff --git a/recipe/build.sh b/recipe/build.sh index 5c991e4f..5589da14 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -20,6 +20,8 @@ export CXXFLAGS="${CXXFLAGS} -std=c++17 -D_LIBCPP_DISABLE_AVAILABILITY" mkdir build cd build +# Make sure to disable Arrow/Parquet dependencies for now, so they are only +# used in build_arrow_parquet cmake -G "Unix Makefiles" \ ${CMAKE_ARGS} \ -DCMAKE_BUILD_TYPE=Release \ @@ -27,6 +29,9 @@ cmake -G "Unix Makefiles" \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=ON \ + -DGDAL_USE_PARQUET=OFF \ + -DGDAL_USE_ARROW=OFF \ + -DGDAL_USE_ARROWDATASET=OFF \ -DBUILD_PYTHON_BINDINGS:BOOL=OFF \ -DBUILD_JAVA_BINDINGS:BOOL=OFF \ -DBUILD_CSHARP_BINDINGS:BOOL=OFF \ diff --git a/recipe/build_arrow_parquet.bat b/recipe/build_arrow_parquet.bat new file mode 100644 index 00000000..986093c4 --- /dev/null +++ b/recipe/build_arrow_parquet.bat @@ -0,0 +1,21 @@ +cd build +if errorlevel 1 exit 1 + +REM We reuse the same build directory as libgdal, so we just to have to +REM turn on the required dependency and drivers +cmake -DGDAL_USE_PARQUET=ON ^ + -DGDAL_USE_ARROW=ON ^ + -DGDAL_USE_ARROWDATASET=ON ^ + -DOGR_ENABLE_DRIVER_ARROW=ON ^ + -DOGR_ENABLE_DRIVER_ARROW_PLUGIN=ON ^ + -DOGR_ENABLE_DRIVER_PARQUET=ON ^ + -DOGR_ENABLE_DRIVER_PARQUET_PLUGIN=ON ^ + "%SRC_DIR%" + +if errorlevel 1 exit /b 1 + +cmake --build . -j %CPU_COUNT% --verbose --config Release +if errorlevel 1 exit /b 1 + +cmake --build . --target install --config Release +if errorlevel 1 exit /b 1 diff --git a/recipe/build_arrow_parquet.sh b/recipe/build_arrow_parquet.sh new file mode 100644 index 00000000..ae980b97 --- /dev/null +++ b/recipe/build_arrow_parquet.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -ex # Abort on error. + +cd build + +# We reuse the same build directory as libgdal, so we just to have to +# turn on the required dependency and drivers +cmake -DGDAL_USE_PARQUET=ON \ + -DGDAL_USE_ARROW=ON \ + -DGDAL_USE_ARROWDATASET=ON \ + -DOGR_ENABLE_DRIVER_ARROW=ON \ + -DOGR_ENABLE_DRIVER_ARROW_PLUGIN=ON \ + -DOGR_ENABLE_DRIVER_PARQUET=ON \ + -DOGR_ENABLE_DRIVER_PARQUET_PLUGIN=ON \ + ${SRC_DIR} + +cmake --build . -j ${CPU_COUNT} --config Release +cmake --build . --target install diff --git a/recipe/install_python.bat b/recipe/install_python.bat index c380cd1d..8bc8401b 100644 --- a/recipe/install_python.bat +++ b/recipe/install_python.bat @@ -21,12 +21,9 @@ cmake -G "Ninja" ^ -DBUILD_SHARED_LIBS=ON ^ -DPython_EXECUTABLE="%PYTHON%" ^ -DBUILD_PYTHON_BINDINGS:BOOL=ON ^ - -DBUILD_JAVA_BINDINGS:BOOL=OFF ^ - -DBUILD_CSHARP_BINDINGS:BOOL=OFF ^ - -DGDAL_USE_KEA:BOOL=ON ^ - -DKEA_INCLUDE_DIR:PATH="%LIBRARY_INC%" ^ - -DKEA_LIBRARY:PATH="%LIBRARY_LIB%\libkea.lib" ^ - -DGDAL_USE_MYSQL:BOOL=OFF ^ + -DGDAL_USE_EXTERNAL_LIBS=OFF ^ + -DGDAL_BUILD_OPTIONAL_DRIVERS:BOOL=OFF ^ + -DOGR_BUILD_OPTIONAL_DRIVERS:BOOL=OFF ^ "%SRC_DIR%" if errorlevel 1 exit /b 1 diff --git a/recipe/install_python.sh b/recipe/install_python.sh index d99e0910..43827d1c 100644 --- a/recipe/install_python.sh +++ b/recipe/install_python.sh @@ -10,6 +10,7 @@ export CXXFLAGS="${CXXFLAGS} -std=c++17 -D_LIBCPP_DISABLE_AVAILABILITY" mkdir pybuild_${PKG_HASH} pushd pybuild_${PKG_HASH} +# Do a minimum build of libgdal cmake -G "Unix Makefiles" \ ${CMAKE_ARGS} \ -DCMAKE_BUILD_TYPE=Release \ @@ -21,6 +22,9 @@ cmake -G "Unix Makefiles" \ -DBUILD_PYTHON_BINDINGS:BOOL=ON \ -DBUILD_JAVA_BINDINGS:BOOL=OFF \ -DBUILD_CSHARP_BINDINGS:BOOL=OFF \ + -DGDAL_USE_EXTERNAL_LIBS=OFF \ + -DGDAL_BUILD_OPTIONAL_DRIVERS:BOOL=OFF \ + -DOGR_BUILD_OPTIONAL_DRIVERS:BOOL=OFF \ ${SRC_DIR} || (cat CMakeFiles/CMakeError.log;false) @@ -32,7 +36,7 @@ requires = ["setuptools>=40.8.0", "wheel"] build-backend = "setuptools.build_meta" EOF -cmake --build . --target python_wheel +cmake --build . --target python_wheel -j ${CPU_COUNT} $PYTHON -m pip install --no-deps --ignore-installed . diff --git a/recipe/meta.yaml b/recipe/meta.yaml index c975137a..de6adb3c 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -9,9 +9,10 @@ source: sha256: f7afa4aa8d32d0799e011a9f573c6a67e9471f78e70d3d0d0b45b45c8c0c1a94 patches: - 0001-Improve-numpy-fixing.patch + - 0002-Parquet-make-sure-that-ArrowLayer-destructor-is-avai.patch build: - number: 3 + number: 4 skip_compile_pyc: - "share/bash-completion/completions/*.py" @@ -50,6 +51,7 @@ requirements: - libxml2 - openjpeg - openssl + - parquet-cpp - pcre2 - poppler - postgresql @@ -142,6 +144,88 @@ outputs: license: MIT license_file: LICENSE.TXT + - name: libgdal-arrow-parquet + script: build_arrow_parquet.sh # [unix] + script: build_arrow_parquet.bat # [win] + requirements: + build: + - cmake + # ranlib used at install time + - {{ compiler('c') }} + # libstdc++ is needed in requirements/run + - {{ compiler('cxx') }} + - pkg-config # [not win] + - make # [unix] + - ninja # [win] + - sysroot_linux-64 2.17 # [linux64] + host: + - {{ pin_subpackage('libgdal', exact=True) }} + - blosc + - cfitsio + - curl + - expat + - freexl + - geos + - geotiff + - giflib # [not win] + - hdf4 + - hdf5 + - icu + - jpeg + - json-c # [not win] + - kealib + - libkml + - libnetcdf + - libpng + - libpq + - libspatialite + - libtiff + - libuuid # [linux] + - libwebp-base + - libxml2 + - openjpeg + - openssl + - parquet-cpp + - pcre2 + - poppler + - postgresql + - proj + - sqlite + - tiledb + - xerces-c + - xz + - zlib + - zstd + run: + - {{ pin_subpackage('libgdal', exact=True) }} + - arrow-cpp + - cfitsio + - geotiff + - giflib # [not win] + - json-c # [not win] + - libpq + - libspatialite + - libuuid # [linux] + - libwebp-base + - parquet-cpp + - 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_file: LICENSE.TXT + - name: gdal script: install_python.sh # [unix] script: install_python.bat # [win] diff --git a/recipe/test_arrow_parquet.bat b/recipe/test_arrow_parquet.bat new file mode 100644 index 00000000..ffacfab1 --- /dev/null +++ b/recipe/test_arrow_parquet.bat @@ -0,0 +1,5 @@ +ogrinfo --format Arrow +if errorlevel 1 exit 1 + +ogrinfo --format Parquet +if errorlevel 1 exit 1 diff --git a/recipe/test_arrow_parquet.sh b/recipe/test_arrow_parquet.sh new file mode 100644 index 00000000..7fe267cd --- /dev/null +++ b/recipe/test_arrow_parquet.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# exit when any command fails +set -e +# print all commands +set -x + +test -f ${PREFIX}/lib/gdalplugins/ogr_Arrow${SHLIB_EXT} +test -f ${PREFIX}/lib/gdalplugins/ogr_Parquet${SHLIB_EXT} + +ogrinfo --format Arrow +ogrinfo --format Parquet