[Buildroot] [PATCH 1/1] package/gdal: switch to cmake build

Maxim Kochetkov fido_max at inbox.ru
Tue Jan 24 10:31:49 UTC 2023


GDAL autoconf has wrong libgeotiff detection. It uses host's
library if installed instead of buildroot one.
Modern versions of gdal have no autoconf build scripts, just cmake only.

So move to cmake build variant.

Fixes: https://bugs.busybox.net/show_bug.cgi?id=15281
Signed-off-by: Maxim Kochetkov <fido_max at inbox.ru>
---
 package/gdal/gdal.mk | 166 ++++++++++++++++++++++---------------------
 1 file changed, 85 insertions(+), 81 deletions(-)

diff --git a/package/gdal/gdal.mk b/package/gdal/gdal.mk
index 33e7ba724a..a777834083 100644
--- a/package/gdal/gdal.mk
+++ b/package/gdal/gdal.mk
@@ -12,6 +12,13 @@ GDAL_LICENSE_FILES = LICENSE.TXT
 GDAL_CPE_ID_VENDOR = osgeo
 GDAL_INSTALL_STAGING = YES
 GDAL_CONFIG_SCRIPTS = gdal-config
+GDAL_SUPPORTS_IN_SOURCE_BUILD=NO
+
+# Using 'make' with the Makefile generator will not work,
+# as it will try the GNUmakefile.
+# GNUmakefile and autoconf are dropped in 3.6 so may be dropped in future version.
+GDAL_MAKE_OPTS += -f Makefile
+
 # gdal at its core only needs host-pkgconf, libgeotiff, proj and tiff
 # but since by default mrf driver support is enabled, it also needs
 # jpeg, libpng and zlib. By default there are also many other drivers
@@ -20,97 +27,94 @@ GDAL_CONFIG_SCRIPTS = gdal-config
 # respectively needed dependencies.
 GDAL_DEPENDENCIES = host-pkgconf jpeg json-c libgeotiff libpng proj tiff zlib
 
-# Yes, even though they have --with options, these few libraries are
+# Yes, even though they have DGDAL_USE, these few libraries are
 # mandatory. If we don't provide them, bundled versions are used.
 GDAL_CONF_OPTS = \
-	--with-geotiff \
-	--with-jpeg \
-	--with-libjson-c=$(STAGING_DIR)/usr \
-	--with-libtool \
-	--with-libz \
-	--with-png \
-	--with-proj \
-	--without-armadillo \
-	--without-blosc \
-	--without-brunsli \
-	--without-cfitsio \
-	--without-crypto \
-	--without-cryptopp \
-	--without-curl \
-	--without-dds \
-	--without-ecw \
-	--without-expat \
-	--without-exr \
-	--without-fgdb \
-	--without-freexl \
-	--without-geos \
-	--without-gnm \
-	--without-libkml \
-	--without-lz4 \
-	--without-gta \
-	--without-hdf4 \
-	--without-hdf5 \
-	--without-hdfs \
-	--without-heif \
-	--without-idb \
-	--without-jp2lura \
-	--without-java \
-	--without-jpeg12 \
-	--without-jxl \
-	--without-kakadu \
-	--without-kea \
-	--without-lerc \
-	--without-gif \
-	--without-liblzma \
-	--without-libdeflate \
-	--without-mongocxxv3 \
-	--without-mrsid \
-	--without-jp2mrsid \
-	--without-macosx-framework \
-	--without-msg \
-	--without-mysql \
-	--without-netcdf \
-	--without-null \
-	--without-oci \
-	--without-odbc \
-	--without-ogdi \
-	--without-opencl \
-	--without-openjpeg \
-	--without-pam \
-	--without-pcidsk \
-	--without-pcraster \
-	--without-pcre \
-	--without-pcre2 \
-	--without-pdfium \
-	--without-podofo \
-	--without-poppler \
-	--without-python \
-	--without-qhull \
-	--without-rasdaman \
-	--without-rasterlite2 \
-	--without-rdb \
-	--without-sfcgal \
-	--without-sosi \
-	--without-spatialite \
-	--without-sqlite3 \
-	--without-teigha \
-	--without-tiledb \
-	--without-webp \
-	--without-xerces \
-	--without-zstd
+	-DGDAL_USE_GEOTIFF=ON \
+	-DGDAL_USE_JPEG=ON \
+	-DGDAL_USE_JSONC=ON \
+	-DGDAL_USE_ZLIB=ON \
+	-DGDAL_USE_PNG=ON \
+	-DGDAL_USE_ARMADILLO=OFF \
+	-DGDAL_USE_BLOSC=OFF \
+	-DGDAL_USE_BRUNSLI=OFF \
+	-DGDAL_USE_CFITSIO=OFF \
+	-DGDAL_USE_OPENSSL=OFF \
+	-DGDAL_USE_CRYPTOPP=OFF \
+	-DGDAL_USE_CRNLIB=OFF \
+	-DGDAL_USE_CURL=OFF \
+	-DGDAL_USE_ECW=OFF \
+	-DGDAL_USE_EXPAT=OFF \
+	-DGDAL_USE_FILEGDB=OFF \
+	-DGDAL_USE_FREEXL=OFF \
+	-DGDAL_USE_GEOS=OFF \
+	-DGDAL_USE_LIBKML=OFF \
+	-DGDAL_USE_LZ4=OFF \
+	-DGDAL_USE_GTA=OFF \
+	-DGDAL_USE_HDF4=OFF \
+	-DGDAL_USE_HDF5=OFF \
+	-DGDAL_USE_HDFS=OFF \
+	-DGDAL_USE_HEIF=OFF \
+	-DGDAL_USE_IDB=OFF \
+	-DGDAL_USE_LURATECH=OFF \
+	-DGDAL_USE_JPEG12_INTERNAL=OFF \
+	-DGDAL_USE_JXL=OFF \
+	-DGDAL_USE_KDU=OFF \
+	-DGDAL_USE_KEA=OFF \
+	-DGDAL_USE_LERC=OFF \
+	-DGDAL_USE_GIF=OFF \
+	-DGDAL_USE_LIBLZMA=OFF \
+	-DGDAL_USE_DEFLATE=OFF \
+	-DGDAL_USE_MONGOCXX=OFF \
+	-DGDAL_USE_MRSID=OFF \
+	-DGDAL_USE_PUBLICDECOMPWT=OFF \
+	-DGDAL_USE_MYSQL=OFF \
+	-DGDAL_USE_NETCDF=OFF \
+	-DGDAL_USE_ORACLE=OFF \
+	-DGDAL_USE_ODBC=OFF \
+	-DGDAL_USE_OGDI=OFF \
+	-DGDAL_USE_OPENCL=OFF \
+	-DGDAL_USE_OPENEXR=OFF \
+	-DGDAL_USE_OPENJPEG=OFF \
+	-DGDAL_USE_PCRE=OFF \
+	-DGDAL_USE_PCRE2=OFF \
+	-DGDAL_USE_PDFIUM=OFF \
+	-DGDAL_USE_PODOFO=OFF \
+	-DGDAL_USE_POPPLER=OFF \
+	-DGDAL_USE_QHULL=OFF \
+	-DGDAL_USE_RASDAMAN=OFF \
+	-DGDAL_USE_RASTERLITE2=OFF \
+	-DGDAL_USE_RDB=OFF \
+	-DGDAL_USE_SFCGAL=OFF \
+	-DGDAL_USE_FYBA=OFF \
+	-DGDAL_USE_SPATIALITE=OFF \
+	-DGDAL_USE_SQLITE3=OFF \
+	-DGDAL_USE_TEIGHA=OFF \
+	-DGDAL_USE_TILEDB=OFF \
+	-DGDAL_USE_WEBP=OFF \
+	-DGDAL_USE_XERCESC=OFF \
+	-DGDAL_USE_ZSTD=OFF \
+	-DGDAL_ENABLE_DRIVER_PCIDSK=OFF \
+	-DGDAL_ENABLE_DRIVER_PCRASTER=OFF \
+	-DGDAL_ENABLE_DRIVER_NULL=OFF \
+	-DGDAL_ENABLE_MACOSX_FRAMEWORK=OFF \
+	-DENABLE_GNM=OFF \
+	-DENABLE_PAM=OFF \
+	-DBUILD_JAVA_BINDINGS=OFF \
+	-DBUILD_PYTHON_BINDINGS=OFF
 
 ifeq ($(BR2_PACKAGE_LIBXML2),y)
 GDAL_DEPENDENCIES += libxml2
-GDAL_CONF_OPTS += --with-xml2
+GDAL_CONF_OPTS += -DGDAL_USE_LIBXML2=ON
 else
-GDAL_CONF_OPTS += --without-xml2
+GDAL_CONF_OPTS += -DGDAL_USE_LIBXML2=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
 GDAL_DEPENDENCIES += postgresql
-GDAL_CONF_OPTS += --with-pg
+GDAL_CONF_OPTS += -DGDAL_USE_POSTGRESQL=ON
 else
-GDAL_CONF_OPTS += --without-pg
+GDAL_CONF_OPTS += -DGDAL_USE_POSTGRESQL=OFF
 endif
 
-$(eval $(autotools-package))
+$(eval $(cmake-package))
-- 
2.38.1




More information about the buildroot mailing list