From 63cf69b672c606946fc6e6b7d9a3b62ff1b29b5a Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Sun, 11 Sep 2022 14:17:20 +0200 Subject: [PATCH 1/4] [GDAL] Use NetCDF and HDF5 when available. --- G/GDAL/build_tarballs.jl | 60 ++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index 32188bcfdb7..bd690a686c9 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -6,8 +6,8 @@ name = "GDAL" upstream_version = v"3.5.1" version_offset = v"0.0.1" version = VersionNumber(upstream_version.major * 100 + version_offset.major, - upstream_version.minor * 100 + version_offset.minor, - upstream_version.patch * 100 + version_offset.patch) + upstream_version.minor * 100 + version_offset.minor, + upstream_version.patch * 100 + version_offset.patch) # Collection of sources required to build GDAL sources = [ @@ -28,25 +28,41 @@ if [[ "${target}" == *-freebsd* ]]; then export LDFLAGS="-undefined" fi -cmake -DCMAKE_INSTALL_PREFIX=${prefix} \ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ - -DCMAKE_PREFIX_PATH=${prefix} \ - -DCMAKE_FIND_ROOT_PATH=${prefix} \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_PYTHON_BINDINGS=OFF \ - -DBUILD_JAVA_BINDINGS=OFF \ - -DBUILD_CSHARP_BINDINGS=OFF \ - -DGDAL_USE_CURL=ON \ - -DGDAL_USE_EXPAT=ON \ - -DGDAL_USE_GEOTIFF=ON \ - -DGDAL_USE_GEOS=ON \ - -DGDAL_USE_OPENJPEG=ON \ - -DGDAL_USE_SQLITE3=ON \ - -DGDAL_USE_TIFF=ON \ - -DGDAL_USE_ZLIB=ON \ - -DGDAL_USE_ZSTD=ON \ - .. +CMAKE_FLAGS=(-DCMAKE_INSTALL_PREFIX=${prefix} +-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} +-DCMAKE_PREFIX_PATH=${prefix} +-DCMAKE_FIND_ROOT_PATH=${prefix} +-DCMAKE_BUILD_TYPE=Release +-DBUILD_PYTHON_BINDINGS=OFF +-DBUILD_JAVA_BINDINGS=OFF +-DBUILD_CSHARP_BINDINGS=OFF +-DGDAL_USE_CURL=ON +-DGDAL_USE_EXPAT=ON +-DGDAL_USE_GEOTIFF=ON +-DGDAL_USE_GEOS=ON +-DGDAL_USE_OPENJPEG=ON +-DGDAL_USE_SQLITE3=ON +-DGDAL_USE_TIFF=ON +-DGDAL_USE_ZLIB=ON +-DGDAL_USE_ZSTD=ON) +# NetCDF is the most restrictive dependency as far as platform availability, so we'll use it where applicable but disable it otherwise +if ! find ${libdir} -name "libnetcdf*.${dlext}" -exec false '{}' +; then + CMAKE_FLAGS+=(-DGDAL_USE_NETCDF=ON) +else + echo "Disabling NetCDF support" + CMAKE_FLAGS+=(-DGDAL_USE_NETCDF=OFF) +fi + +# HDF5 is also a restrictive dependency as far as platform availability, so we'll use it where applicable but disable it otherwise +if ! find ${libdir} -name "libhdf5*.${dlext}" -exec false '{}' +; then + CMAKE_FLAGS+=(-DGDAL_USE_HDF5=ON) +else + echo "Disabling HDF5 support" + CMAKE_FLAGS+=(-DGDAL_USE_HDF5=OFF) +fi + +cmake .. ${CMAKE_FLAGS[@]} cmake --build . -j${nproc} cmake --build . -j${nproc} --target install """ @@ -91,8 +107,10 @@ dependencies = [ Dependency("Libtiff_jll"; compat="4.3"), Dependency("libgeotiff_jll"; compat="100.700.100"), Dependency("LibCURL_jll"; compat="7.73"), + Dependency("NetCDF_jll"; compat="400.902.5"), + Dependency("HDF5_jll") ] # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version=v"8") + julia_compat="1.6", preferred_gcc_version=v"8") From 4e49ad57c33fc7acea0c5dd938b8120ff76ae98e Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Sun, 11 Sep 2022 14:42:18 +0200 Subject: [PATCH 2/4] Fix review comments. --- G/GDAL/build_tarballs.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index bd690a686c9..a18c803c0b1 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -6,8 +6,8 @@ name = "GDAL" upstream_version = v"3.5.1" version_offset = v"0.0.1" version = VersionNumber(upstream_version.major * 100 + version_offset.major, - upstream_version.minor * 100 + version_offset.minor, - upstream_version.patch * 100 + version_offset.patch) + upstream_version.minor * 100 + version_offset.minor, + upstream_version.patch * 100 + version_offset.patch) # Collection of sources required to build GDAL sources = [ @@ -108,9 +108,9 @@ dependencies = [ Dependency("libgeotiff_jll"; compat="100.700.100"), Dependency("LibCURL_jll"; compat="7.73"), Dependency("NetCDF_jll"; compat="400.902.5"), - Dependency("HDF5_jll") + Dependency("HDF5_jll"), ] # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version=v"8") + julia_compat="1.6", preferred_gcc_version=v"8") From 1b95fd0f5102e7625a2006ba92a47b8125e4703c Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Sun, 11 Sep 2022 14:46:44 +0200 Subject: [PATCH 3/4] Changed version offset. --- G/GDAL/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index a18c803c0b1..a5ccf944683 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -4,7 +4,7 @@ using BinaryBuilder, Pkg name = "GDAL" upstream_version = v"3.5.1" -version_offset = v"0.0.1" +version_offset = v"0.0.2" version = VersionNumber(upstream_version.major * 100 + version_offset.major, upstream_version.minor * 100 + version_offset.minor, upstream_version.patch * 100 + version_offset.patch) From 6c01029f1bb3fdae0d2edef357ab2eb11175d33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sun, 11 Sep 2022 22:05:14 +0100 Subject: [PATCH 4/4] [GDAL] Require HDF5/NetCDF only when available --- G/GDAL/build_tarballs.jl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index a5ccf944683..b4498b35a49 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -95,6 +95,16 @@ products = [ ExecutableProduct("ogrtindex", :ogrtindex_path), ] +hdf5_platforms = [ + Platform("x86_64", "linux"), + Platform("aarch64", "linux"; libc="glibc"), + Platform("x86_64", "macos"), + Platform("x86_64", "windows"), + Platform("i686", "windows"), + Platform("aarch64", "macos"), +] +hdf5_platforms = expand_cxxstring_abis(hdf5_platforms) + # Dependencies that must be installed before this package can be built dependencies = [ Dependency("GEOS_jll"; compat="~3.11"), @@ -107,8 +117,8 @@ dependencies = [ Dependency("Libtiff_jll"; compat="4.3"), Dependency("libgeotiff_jll"; compat="100.700.100"), Dependency("LibCURL_jll"; compat="7.73"), - Dependency("NetCDF_jll"; compat="400.902.5"), - Dependency("HDF5_jll"), + Dependency("NetCDF_jll"; compat="400.902.5", platforms=hdf5_platforms), + Dependency("HDF5_jll"; platforms=hdf5_platforms), ] # Build the tarballs, and possibly a `build.jl` as well.