sci-libs/gdal: add 3.11.3

* muparser enabled by default as recommended by upstream.
* headless java fixed upstream.
* Remove automagic and add new use flags.
* Correctly use mysql-connector-c instead of virtual/mysql
* Build shapelib support unconditionally with the internal
implementation (external implementation discouraged upstream).
* Use PEP517 backend for python bindings.

Bug: https://bugs.gentoo.org/666056
Bug: https://bugs.gentoo.org/926500
Bug: https://bugs.gentoo.org/935567
Bug: https://bugs.gentoo.org/938364
Bug: https://bugs.gentoo.org/959583
Closes: https://bugs.gentoo.org/957887
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43244
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Alfred Wingate
2025-07-19 00:57:59 +03:00
committed by Sam James
parent d4648aeb88
commit e2e0bbbc68
8 changed files with 684 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ dev-libs/mongo-c-driver test
dev-php/pecl-mongodb test
dev-python/pymongo test-full
net-analyzer/zmap mongo
sci-libs/gdal mongodb
# Nowa Ammerlaan <nowa@gentoo.org> (2024-04-25)
# No Level-Zero on musl

View File

@@ -78,6 +78,7 @@ sys-kernel/installkernel efistub
dev-python/botocore test
dev-python/ipython nbconvert test
dev-python/sphinx-autodoc-typehints test
>=sci-libs/gdal-3.11.3 python
# Michał Górny <mgorny@gentoo.org> (2024-02-01)
# Need dev-python/trio.

View File

@@ -1,2 +1,4 @@
DIST gdal-3.11.3.tar.xz 9313768 BLAKE2B 11929ec250e328733363d8e04e713870764024711beaf8ba3479bbcbc8cc3cd486bf69f224eb5d2cbe4a197acf45eae71db36116173f2d7e66d091282a750fb6 SHA512 27fac6e7883a3298a814482315ab42e8846689a9adea88131986422f2c48b3382ffdb69c4028af45f6f96937476b2d5e75081814940192f339517294f466d7a1
DIST gdal-3.9.3.tar.xz 9110460 BLAKE2B 0ae536ff832a3659dd9e56d32f2695b9428c24b1a0d75845c860ce7c78eb462cf78df7e821d814287f4c37ccf79f938256fe662a09c4bd936843a75157f29c8c SHA512 e8d4c8c97946a68775d03ecf1f192d950bf01b7a40ff7bf35a6f535dd08b370a26d5646da84179e4864aa59ebfbceae7e77bbb04b745bdd26fde555f6ae0708e
DIST gdalautotest-3.11.3.tar.gz 18571907 BLAKE2B ae80a1b787060dae110612a16c3c7f6dd9449eb21c51c04798b3df47604f1f6e61a6e5d37c1223d9f0dae6c822cd8a7da0442608750674f337dcf224a55d0c12 SHA512 b7a42317c02e0cd268c77bb77e2c8e2742d4611f228a1f8a7cd8c6f27c0d854249ec6410af2a9848cdc18b7080b29cd6ff15478ab78f2eb6b3ecd2183f3a0d69
DIST gdalautotest-3.9.3.tar.gz 17239532 BLAKE2B 991e24ac3181e1ab4837933183520828fc4f5416ce0f3e6e13a12052db301286898eaecd80f8b6765f19876be786b95854c1efef6cccfe02cacedae5f00302e6 SHA512 a9f44065bb5817cdc32995cd57f65f8a588dfaea77d4a5bc2d9ea361ef1423843358d7e31be2e27505b6e991d07b18f0f5c3fd9526cf697c74bc88f558205d61

View File

@@ -0,0 +1,70 @@
https://bugs.gentoo.org/925307
https://github.com/OSGeo/gdal/pull/12772
https://github.com/OSGeo/gdal/commit/2f6793bb31ec69cf6d99714cbfec343784c499f6
https://github.com/OSGeo/gdal/commit/6cc5573c0f7e7cb426f172aafb51d2d51217ec46
From 2f6793bb31ec69cf6d99714cbfec343784c499f6 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Tue, 22 Jul 2025 00:42:15 +0300
Subject: [PATCH 1/2] CMake: install missing completions
gdal-bash-completion.sh has the completions, just the symlinks are
missing.
Bug: https://bugs.gentoo.org/925307
See-Also: a20b3e7e290cb12b62031745d13990f303bec2e4
--- a/scripts/install_bash_completions.cmake.in
+++ b/scripts/install_bash_completions.cmake.in
@@ -29,6 +29,7 @@ set(PROGRAMS
gdalsrsinfo
gdaltindex
gdaltransform
+ gdal_footprint
gdal_translate
gdalwarp
ogr2ogr
@@ -36,8 +37,10 @@ set(PROGRAMS
ogrlineref
ogrmerge.py
ogrtindex
+ ogr_layer_algebra.py
gdal_viewshed
- gdal_create)
+ gdal_create
+ sozip)
set(INSTALL_DIR "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@BASH_COMPLETIONS_DIR@")
From 6cc5573c0f7e7cb426f172aafb51d2d51217ec46 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Tue, 22 Jul 2025 00:44:16 +0300
Subject: [PATCH 2/2] CMake: Don't install completion symlinks for scripts that
are no longer installed
The completions themselves were already removed, only the symlinks
persist.
Bug: https://bugs.gentoo.org/925307
See-Also: be12e900c1d78b591cbabd0f4ac53719cdbb32be
See-Also: 2af3a35aca1d53a691f0d8d88f3ea55f2488ba41
See-Also: ffccab1ee20b5151e9bd45f1a2c46245a74f1f56
--- a/scripts/install_bash_completions.cmake.in
+++ b/scripts/install_bash_completions.cmake.in
@@ -6,7 +6,6 @@ set(PROGRAMS
gdaladdo
gdalbuildvrt
gdal_calc.py
- gdalchksum.py
gdalcompare.py
gdal-config
gdal_contour
@@ -15,8 +14,6 @@ set(PROGRAMS
gdalenhance
gdal_fillnodata.py
gdal_grid
- gdalident.py
- gdalimport.py
gdallocationinfo
gdalmanage
gdal_merge.py

View File

@@ -0,0 +1,38 @@
https://bugs.gentoo.org/948810
https://github.com/OSGeo/gdal/pull/12773
https://github.com/OSGeo/gdal/commit/66f9bf01cfcb58499f69df2670a3ec9d7b77ad5a
From 66f9bf01cfcb58499f69df2670a3ec9d7b77ad5a Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Tue, 22 Jul 2025 17:04:59 +0300
Subject: [PATCH] CMake Java: restore -fno-strict-aliasing
This was dropped with the move to cmake.
But swig still struggles with this in java.
> If you are going to use optimisations turned on with gcc (for example -O2),
> ensure you also compile with -fno-strict-aliasing. The GCC optimisations have
> become more aggressive from gcc-4.0 onwards and will result in code that fails
> with strict aliasing optimisations turned on.
Bug: https://bugs.gentoo.org/948810
See-Also: cd39be5322d5731ae6327b1cec1e54015ab6bc1e
See-Also: 211263036085ddb44663137d359e3d99fee77bd7
--- a/swig/java/CMakeLists.txt
+++ b/swig/java/CMakeLists.txt
@@ -5,6 +5,14 @@ if (CMAKE_CXX_FLAGS)
string(REPLACE "/WX " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
endif ()
+# Do not remove -fno-strict-aliasing while SWIG generates weird code in upcast methods
+# http://trac.osgeo.org/gdal/changeset/16006
+#
+# https://swig.org//Doc4.3/Java.html#Java_compiling_dynamic
+if (NOT MSVC)
+ add_compile_options("-fno-strict-aliasing")
+endif()
+
list(APPEND GDAL_SWIG_COMMON_INTERFACE_FILES
${PROJECT_SOURCE_DIR}/swig/include/java/callback.i
${PROJECT_SOURCE_DIR}/swig/include/java/gdalconst_java.i

View File

@@ -0,0 +1,62 @@
https://bugs.gentoo.org/925072
https://github.com/OSGeo/gdal/pull/12771
https://github.com/OSGeo/gdal/commit/68a6868877f3dc661f1e843b0bfc290a4b9ec3ed
From 68a6868877f3dc661f1e843b0bfc290a4b9ec3ed Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Tue, 22 Jul 2025 00:41:59 +0300
Subject: [PATCH] CMake: fix checks for CMAKE_SYSTEM_PROCESSOR on non Windows
platforms
Linux and macOS match (x86|AMD64) due to a partial match on x86_64.
On Windows the valid values are AMD64/IA64/x86/ARM64
For Linux and macOS the output from uname -m is used instead.
macOS and Linux x86 -> i386/i486/i586/i686
(i386 and i486 irrelevent for SIMD)
macOS and Linux amd64 -> x86_64
macOS and Linux arm -> armv[567]
macos arm64 -> arm64
Linux arm64 -> aarch64
https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_PROCESSOR.html
https://cmake.org/cmake/help/latest/variable/CMAKE_HOST_SYSTEM_PROCESSOR.html
A better defined variable in the future could be CMAKE_CXX_COMPILER_ARCHITECTURE_ID,
but values for Apple and UNIX platforms are new for the unreleased cmake-4.1.
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID.html
Bug: https://bugs.gentoo.org/925072
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,7 +48,7 @@ endif()
include(Ccache)
#
-if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|AMD64)")
+if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i586|i686|x86|AMD64)")
check_compiler_machine_option(flag SSE)
if (NOT ${flag} STREQUAL "")
set(HAVE_SSE_AT_COMPILE_TIME 1)
--- a/cmake/helpers/CheckCompilerMachineOption.cmake
+++ b/cmake/helpers/CheckCompilerMachineOption.cmake
@@ -31,7 +31,7 @@ function(check_compiler_machine_option outvar feature)
endmacro()
set(_FLAGS)
- if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|AMD64)")
+ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i586|i686|x86|AMD64)")
if(MSVC AND (${feature} MATCHES "SSE"))
# SSE2 and SSE are default on
set(_FLAGS " ")
@@ -100,7 +100,7 @@ function(check_compiler_machine_option outvar feature)
endif()
endif()
endif()
- elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(ARM|aarch64)")
+ elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(arm|ARM|aarch64)")
if(MSVC)
# TODO implement me
elseif(CMAKE_CXX_COMPILER MATCHES "/(icpc|icc)$") # ICC (on Linux)

View File

@@ -0,0 +1,500 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
PYTHON_COMPAT=( python3_{11..13} )
inherit cmake distutils-r1 flag-o-matic java-pkg-opt-2
DESCRIPTION="Translator library for raster geospatial data formats (includes OGR support)"
HOMEPAGE="https://gdal.org/"
SRC_URI="
https://download.osgeo.org/${PN}/${PV}/${P}.tar.xz
test? ( https://download.osgeo.org/${PN}/${PV}/${PN}autotest-${PV}.tar.gz )
"
LICENSE="BSD Info-ZIP MIT"
SLOT="0/37" # subslot is libgdal.so.<SONAME> (and GDAL_SOVERSION in gdal.cmake)
KEYWORDS="~amd64"
IUSE="
archive armadillo avif blosc cryptopp +curl cpu_flags_arm_neon cpu_flags_x86_avx
cpu_flags_x86_avx2 cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse4_1
cpu_flags_x86_ssse3 exprtk fits geos gif gml hdf5 heif java jpeg jpeg2k jpegxl
lerc libaec libdeflate lz4 lzma mongodb +muparser mysql netcdf odbc openexr
oracle parquet pdf png postgres python qhull spatialite sqlite test +tools webp
xls zstd
"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
spatialite? ( sqlite )
"
RESTRICT="!test? ( test )"
COMMON_DEPEND="
dev-libs/expat
dev-libs/json-c:=
dev-libs/libxml2:2=
dev-libs/openssl:=
media-libs/tiff:=
>=sci-libs/libgeotiff-1.5.1-r1:=
>=sci-libs/proj-6.0.0:=
sys-libs/zlib[minizip(+)]
archive? ( app-arch/libarchive:= )
armadillo? ( sci-libs/armadillo:=[lapack] )
avif? ( media-libs/libavif:= )
blosc? ( dev-libs/c-blosc:= )
cryptopp? ( dev-libs/crypto++:= )
curl? ( net-misc/curl )
fits? ( sci-libs/cfitsio:= )
geos? ( >=sci-libs/geos-3.8.0 )
gif? ( media-libs/giflib:= )
gml? ( >=dev-libs/xerces-c-3.1:= )
heif? ( media-libs/libheif:= )
hdf5? ( >=sci-libs/hdf5-1.6.4:=[cxx,szip] )
java? (
>=virtual/jdk-1.8:*
)
jpeg? ( media-libs/libjpeg-turbo:= )
jpeg2k? ( media-libs/openjpeg:2= )
jpegxl? ( media-libs/libjxl:= )
lerc? ( media-libs/lerc:= )
libaec? ( sci-libs/libaec:= )
libdeflate? ( app-arch/libdeflate )
lz4? ( app-arch/lz4:= )
lzma? ( || (
app-arch/xz-utils
app-arch/lzma
) )
mongodb? ( dev-db/mongodb:= )
muparser? ( dev-cpp/muParser:= )
mysql? ( dev-db/mysql-connector-c:= )
netcdf? ( sci-libs/netcdf:= )
odbc? ( dev-db/unixODBC )
openexr? ( media-libs/openexr:= )
oracle? ( dev-db/oracle-instantclient:= )
parquet? ( dev-libs/apache-arrow:=[compute,dataset,parquet,lz4?,zlib,zstd?] )
pdf? ( app-text/poppler:= )
png? ( media-libs/libpng:= )
postgres? ( >=dev-db/postgresql-8.4:= )
qhull? ( media-libs/qhull:= )
spatialite? ( dev-db/spatialite )
sqlite? (
>=dev-db/sqlite-3.31:3
dev-libs/libpcre2:=
)
webp? ( media-libs/libwebp:= )
xls? ( dev-libs/freexl )
zstd? ( app-arch/zstd:= )
"
RDEPEND="${COMMON_DEPEND}
java? ( >=virtual/jre-1.8:* )
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
')
)
"
DEPEND="${COMMON_DEPEND}
exprtk? ( dev-cpp/exprtk )
test? ( dev-cpp/gtest )
"
BDEPEND="
virtual/pkgconfig
java? (
>=dev-java/ant-1.10.14-r3:0
dev-lang/swig
)
python? (
${DISTUTILS_DEPS}
dev-lang/swig
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
test? (
dev-python/filelock[${PYTHON_USEDEP}]
dev-python/jsonschema[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
>=dev-python/pytest-6.0.0[${PYTHON_USEDEP}]
dev-python/pytest-env[${PYTHON_USEDEP}]
dev-python/pytest-rerunfailures[${PYTHON_USEDEP}]
parquet? ( dev-python/pyarrow[parquet,${PYTHON_USEDEP}] )
)
')
)
"
QA_CONFIG_IMPL_DECL_SKIP=(
_wstat64 # Windows LFS
)
EPYTEST_PLUGINS=( pytest-env )
EPYTEST_RERUNS=5
EPYTEST_XDIST=1
# distutils_enable_tests unconditionally touches BDEPEND
PATCHES=(
"${FILESDIR}"/gdal-3.11.3-x86.patch
"${FILESDIR}"/gdal-3.11.3-java-no-strict-aliasing.patch
"${FILESDIR}"/gdal-3.11.3-fix-completions.patch
)
pkg_setup() {
use java && java-pkg-opt-2_pkg_setup
}
src_prepare() {
if use test ; then
mv "${WORKDIR}"/gdalautotest-${PV} "${S}"/autotest || die
fi
java-pkg-opt-2_src_prepare
cmake_src_prepare
}
python_configure_all() {
local -x BUILD_DIR="${S}_python"
# Generate required files with cmake and then use distutils-r1 to generate wheels
# https://github.com/OSGeo/gdal/issues/9965#issuecomment-2159222393
mycmakeargs+=( -DBUILD_PYTHON_BINDINGS=ON )
cmake_src_configure
cmake_build python_generated_files
cmake_build generate_gdal_version_h
sed -E -e "/(library_dirs|include_dirs) =/ { s|${BUILD_DIR}|${cmake_build_dir}| } " \
-i "${BUILD_DIR}/swig/python/setup.py" || die
}
src_configure() {
# sanity check subslot to give a friendly reminder to would-be drive by bumpers
local detected_soversion
detected_soversion="$(sed -n -e 's/set(GDAL_SOVERSION \(.*\))/\1/p' gdal.cmake)"
if [[ "${SLOT#0/}" != "${detected_soversion}" ]]; then
die "Subslot ${SLOT#0/} doesn't match upstream specified set(GDAL_SOVERSION ${detected_soversion}) in gdal.cmake."
fi
# ODR violations
filter-lto
local mycmakeargs=(
# https://gdal.org/en/stable/development/building_from_source.html
-DBUILD_APPS=$(usex tools)
-DBUILD_TESTING=$(usex test)
-DENABLE_GNM=ON
-DENABLE_IPO=OFF
-DENABLE_PAM=ON # Persistent Auxiliary Metadata (not Pluggable Authentication Modules!)
-DOGR_ENABLE_DRIVER_SQLITE=$(usex sqlite)
-DGDAL_ENABLE_PLUGINS=OFF
-DGDAL_ENABLE_PLUGINS_NO_DEPS=OFF
-DGDAL_BUILD_OPTIONAL_DRIVERS=ON
-DOGR_BUILD_OPTIONAL_DRIVERS=ON
-DGDAL_USE_EXTERNAL_LIBS=ON
-DGDAL_USE_INTERNAL_LIBS=OFF
-DUSE_CCACHE=OFF
-DUSE_PRECOMPILED_HEADERS=OFF
# bug #844874 and bug #845150
-DCMAKE_INSTALL_INCLUDEDIR="include/gdal"
-DGDAL_FIND_PACKAGE_PROJ_MODE=CONFIG
# Options here are generally off because of one of:
# - Not yet packaged dependencies
#
# - Off for autotools build and didn't want more churn by
# enabling during port to CMake. Feel free to request them
# being turned on if useful for you.
#
# See cmake/helpers/CheckDependentLibraries.cmake for options
# *_*_package(Option) -> GDAL_USE_OPTION
-DGDAL_USE_ADBCDRIVERMANAGER=OFF
-DGDAL_USE_ARCHIVE=$(usex archive)
-DGDAL_USE_ARMADILLO=$(usex armadillo)
-DGDAL_USE_AVIF=$(usex avif)
-DGDAL_USE_ARROW=$(usex parquet)
-DGDAL_USE_BASISU=OFF
-DGDAL_USE_BLOSC=$(usex blosc)
-DGDAL_USE_BRUNSLI=OFF
-DGDAL_USE_CRNLIB=OFF
-DGDAL_USE_CFITSIO=$(usex fits)
-DGDAL_USE_CURL=$(usex curl)
-DGDAL_USE_CRYPTOPP=$(usex cryptopp)
-DGDAL_USE_DEFLATE=$(usex libdeflate) # complements zlib
-DGDAL_USE_ECW=OFF
-DGDAL_USE_EXPAT=ON
-DGDAL_USE_EXPRTK=$(usex exprtk)
-DGDAL_USE_FILEGDB=OFF
-DGDAL_USE_FREEXL=$(usex xls)
-DGDAL_USE_FYBA=OFF
-DGDAL_USE_GEOTIFF=ON
-DGDAL_USE_GEOS=$(usex geos)
-DGDAL_USE_GIF=$(usex gif)
-DGDAL_USE_GTA=OFF
-DGDAL_USE_HEIF=$(usex heif)
-DGDAL_USE_HDF4=OFF
-DGDAL_USE_HDF5=$(usex hdf5)
-DGDAL_USE_HDFS=OFF
-DGDAL_USE_ICONV=ON # TODO dep
-DGDAL_USE_IDB=OFF
# Enable internal implementation so that tests pass with the use disabled
-DGDAL_USE_JPEG=$(usex jpeg)
-DGDAL_USE_JPEG_INTERNAL=$(usex !jpeg)
# https://gdal.org/build_hints.html#jpeg12
# Independent of whether using system libjpeg
-DGDAL_USE_JPEG12_INTERNAL=ON
-DGDAL_USE_JSONC=ON
-DGDAL_USE_JXL=$(usex jpegxl)
-DGDAL_USE_JXL_THREADS=$(usex jpegxl)
-DGDAL_USE_KDU=OFF
-DGDAL_USE_KEA=OFF
-DGDAL_USE_LERC=$(usex lerc)
-DGDAL_USE_LIBAEC=$(usex libaec)
-DGDAL_USE_LIBKML=OFF
-DGDAL_USE_LIBLZMA=$(usex lzma)
-DGDAL_USE_LIBQB3=OFF
-DGDAL_USE_LIBXML2=ON
-DGDAL_USE_LZ4=$(usex lz4) # FIXME
-DGDAL_USE_MONGOCXX=$(usex mongodb)
-DGDAL_USE_MRSID=OFF
-DGDAL_USE_MSSQL_NCLI=OFF
-DGDAL_USE_MSSQL_ODBC=OFF
-DGDAL_USE_MUPARSER=$(usex muparser)
-DGDAL_USE_MYSQL=$(usex mysql)
-DGDAL_USE_NETCDF=$(usex netcdf)
-DGDAL_USE_ODBC=$(usex odbc)
-DGDAL_USE_ODBCCPP=OFF
# unpackaged
-DGDAL_USE_OPENCAD=OFF
-DGDAL_USE_OPENCAD_INTERNAL=ON
-DGDAL_USE_OPENDRIVE=OFF
-DGDAL_USE_OPENEXR=$(usex openexr)
-DGDAL_USE_OPENJPEG=$(usex jpeg2k)
-DGDAL_USE_OPENSSL=ON
-DGDAL_USE_ORACLE=$(usex oracle)
-DGDAL_USE_PARQUET=$(usex parquet)
-DGDAL_USE_PCRE2=ON
-DGDAL_USE_PDFIUM=OFF
# Enable internal implementation so that tests pass with the use disabled
-DGDAL_USE_PNG=$(usex png)
-DGDAL_USE_PNG_INTERNAL=$(usex !png)
-DGDAL_USE_PODOFO=OFF
-DGDAL_USE_POPPLER=$(usex pdf)
-DGDAL_USE_POSTGRESQL=$(usex postgres)
-DGDAL_USE_QHULL=$(usex qhull)
-DGDAL_USE_RASTERLITE2=OFF
# upstream recommends using the internal implementation
# bug #935567
-DGDAL_USE_SHAPELIB=OFF
-DGDAL_USE_SHAPELIB_INTERNAL=ON
-DGDAL_USE_SPATIALITE=$(usex spatialite)
-DGDAL_USE_SQLITE3=$(usex sqlite)
-DGDAL_USE_SFCGAL=OFF
-DGDAL_USE_TEIGHA=OFF
-DGDAL_USE_TIFF=ON
-DGDAL_USE_WEBP=$(usex webp)
-DGDAL_USE_XERCESC=$(usex gml)
-DGDAL_USE_ZLIB=ON
-DGDAL_USE_ZSTD=$(usex zstd)
# Bindings
-DBUILD_PYTHON_BINDINGS=OFF # handled separately
-DBUILD_JAVA_BINDINGS=$(usex java)
# bug #845369
-DBUILD_CSHARP_BINDINGS=OFF
# Handled differently from x86
# First checks if the platform supports neon and if it supports the option will be available
# See SSE2NEON_COMPILES in CMakeLists.txt and gdal.cmake
-DGDAL_ENABLE_ARM_NEON_OPTIMIZATIONS=$(usex cpu_flags_arm_neon)
)
if use x86 || use amd64 ; then
mycmakeargs+=(
# Check work/gdal-3.5.0_build/CMakeCache.txt after configure
# and https://github.com/OSGeo/gdal/blob/master/cmake/helpers/CheckCompilerMachineOption.cmake#L71
# Commented out: not (yet?) implemented upstream.
#
# check_compiler_machine_option(flag <instruction set>) -> -Dtest_<instruction set>
-Dtest_avx=$(usex cpu_flags_x86_avx)
-Dtest_avx2=$(usex cpu_flags_x86_avx2)
-Dtest_sse=$(usex cpu_flags_x86_sse)
-Dtest_sse2=$(usex cpu_flags_x86_sse2)
#-Dtest_sse3=$(usex cpu_flags_x86_sse3)
-Dtest_sse4.1=$(usex cpu_flags_x86_sse4_1)
#-Dtest_sse4.2=$(usex cpu_flags_x86_sse4_2)
#-Dtest_sse4a=$(usex cpu_flags_x86_sse4a)
-Dtest_ssse3=$(usex cpu_flags_x86_ssse3)
#-Dtest_fma4=$(usex cpu_flags_x86_fma4)
#-Dtest_xop=$(usex cpu_flags_x86_xop)
)
fi
if use test ; then
mycmakeargs+=( -DUSE_EXTERNAL_GTEST=ON )
fi
cmake_src_configure
local cmake_build_dir="${BUILD_DIR}"
use python && distutils-r1_src_configure
}
python_compile() {
pushd "${S}_python/swig/python" >/dev/null || die
distutils-r1_python_compile
popd >/dev/null || die
}
src_compile() {
cmake_src_compile
use python && distutils-r1_src_compile
}
python_test() {
local -x GDAL_DATA="${S}/data"
# note: testpaths in pytest.ini will fight EPYTEST_IGNORE
EPYTEST_IGNORE=(
# network-sandbox and deselecting tests turns into whac-a-mole with their interdependencies
"gcore/vsis3.py"
)
use !muparser && EPYTEST_IGNORE+=( "gdrivers/vrtpansharpen.py" )
use !pdf && EPYTEST_IGNORE+=( "gdrivers/pdf.py" )
EPYTEST_DESELECT=(
# network-sandbox
"gcore/tiff_read.py::test_tiff_read_strace_check"
"gcore/vsioss.py::test_vsioss_6"
"gdrivers/gdalhttp.py::test_http_ssl_verifystatus"
"gdrivers/jp2openjpeg.py::test_jp2openjpeg_45"
"gdrivers/wms.py::test_wms_8"
"ogr/ogr_csv.py::test_ogr_csv_schema_override"
"ogr/ogr_geojson.py::test_ogr_geojson_schema_override"
"ogr/ogr_gml.py::test_ogr_gml_type_override"
"ogr/ogr_gmlas.py::test_ogr_gmlas_billion_laugh"
"ogr/ogr_parquet.py::test_ogr_parquet_coordinate_epoch"
"ogr/ogr_parquet.py::test_ogr_parquet_crs_identification_on_write"
"ogr/ogr_parquet.py::test_ogr_parquet_edges"
"ogr/ogr_parquet.py::test_ogr_parquet_geoarrow"
"ogr/ogr_parquet.py::test_ogr_parquet_geometry_types"
"ogr/ogr_parquet.py::test_ogr_parquet_polygon_orientation"
"ogr/ogr_sqlite.py::test_ogr_sqlite_schema_override"
"pyscripts/test_validate_geoparquet.py::test_validate_geoparquet_ok"
"utilities/test_gdalinfo_lib.py::test_gdalinfo_lib_2"
"utilities/test_gdalinfo_lib.py::test_gdalinfo_lib_5"
"utilities/test_gdalinfo_lib.py::test_gdalinfo_lib_json_color_table_and_rat"
"utilities/test_ogrinfo_lib.py::test_ogrinfo_lib_extent3D"
"utilities/test_ogrinfo_lib.py::test_ogrinfo_lib_json_relationships"
"utilities/test_ogrinfo_lib.py::test_ogrinfo_lib_json_validate"
# sandbox interferes with strace?
"gcore/basic_test.py::test_basic_test_strace_non_existing_file"
# Breaks due to other deselects.
"ogr/ogr_gpkg.py::test_ogr_gpkg_immutable"
"ogr/ogr_gpkg.py::test_ogr_gpkg_nolock"
"ogr/ogr_parquet.py::test_ogr_parquet_read_large_binary_or_string_for_geometry"
"ogr/ogr_parquet.py::test_ogr_parquet_write_arrow_rewind_polygon"
"ogr/ogr_parquet.py::test_ogr_parquet_bbox_float32"
"ogr/ogr_sqlite.py::test_ogr_sqlite_34"
# USE="pdf" poppler 25.07?
# assert 8191 in (7926, 8177, 8174, 8165, 8172, 8193)
"gdrivers/pdf.py::test_pdf_extra_rasters[POPPLER]"
)
if use !armadillo; then
EPYTEST_DESELECT+=(
# AssertionError: (1634, (3456541.352648813, 5640759.820845713, 0.0))
"gcore/transformer.py::test_transformer_tps_precision"
)
fi
if use !sqlite; then
EPYTEST_DESELECT+=(
# implicit sqlite requirement for the test (or the wms (curl) driver)?
"gdrivers/ogcapi.py::test_ogr_ogcapi_vector_tiles"
# expects sqlite being enabled in a warning message
"utilities/test_gdalalg_vector_rasterize.py::test_gdalalg_vector_rasterize"
)
fi
pushd "${S}_python/autotest" >/dev/null || die
# https://github.com/OSGeo/gdal/tree/v3.11.3/autotest#gdals-tests-are-not-independent
# So run directories separately with reruns to maximise chances without excluding every test
#
# See pytest_dirs in autotest/CMakeLists.txt.
# benchmark excluded on purpose as it uses pytest-benchmark
# gdrivers excluded as its especially flaky with excluding tests
# gnm excluded as you need to exclude 99% of it leaving only one or two tests
local failures=()
for pytest_dir in alg gcore gdrivers ogr osr pyscripts utilities; do
nonfatal epytest ${pytest_dir}
[[ ${?} != 0 ]] && failures+=( ${pytest_dir} )
done
popd >/dev/null || die
if [[ ${#failures} -gt 0 ]]; then
die "pytest failures: ${failures[@]}"
fi
}
src_test() {
local -x GDAL_RUN_SLOW_TESTS=0
local -x GDAL_DOWNLOAD_TEST_DATA=0 # tests relying on downloaded data **may** be skipped
cmake_src_test
local -x PATH="${BUILD_DIR}/apps:${PATH}"
local -x LD_LIBRARY_PATH="${BUILD_DIR}:${LD_LIBRARY_PATH}"
use python && distutils-r1_src_test
}
python_install() {
pushd "${S}_python/swig/python" >/dev/null || die
distutils-r1_python_install
popd >/dev/null || die
}
src_install() {
cmake_src_install
if use java; then
# Move the native library into the proper place for Gentoo. The
# library in ${D} has already had its RPATH fixed, so we use it
# rather than ${BUILD_DIR}/swig/java/libgdalalljni.so.
java-pkg_doso "${D}/usr/$(get_libdir)/jni/libgdalalljni.so"
rm -rf "${ED}/usr/$(get_libdir)/jni" || die
fi
use python && distutils-r1_src_install
}
pkg_postinst() {
elog "Check available image and data formats after building with"
if use tools; then
elog "gdal info --formats"
else
elog "gdal-config --formats"
fi
if use java; then
elog
elog "To use the Java bindings, you need to pass the following to java:"
elog " -Djava.library.path=$(java-config -i gdal)"
fi
}

View File

@@ -14,13 +14,23 @@
<subslots>Reflects ABI compatibility of libgdal.so</subslots>
</slots>
<use>
<flag name="archive">Enable support for various archive and compression formats with <pkg>app-arch/libarchive</pkg></flag>
<flag name="armadillo">Use <pkg>sci-libs/armadillo</pkg> for faster TPS transform computation</flag>
<flag name="blosc">Enable support for blosc compression with <pkg>dev-libs/c-blosc</pkg></flag>
<flag name="cryptopp">Enable support RSA SHA256 signing functionality with <pkg>dev-libs/crypto++</pkg></flag>
<flag name="exprtk">Enable support for additional advanced C++ VRT expressions with <pkg>dev-cpp/exprtk</pkg></flag>
<flag name="fits">Enable support for NASA's <pkg>sci-libs/cfitsio</pkg> library</flag>
<flag name="geos">Add support for geometry engine (<pkg>sci-libs/geos</pkg>)</flag>
<flag name="gml">Enable support for <pkg>dev-libs/xerces-c</pkg> C++ API</flag>
<flag name="libaec">Enable support Adaptive Entropy Coding with <pkg>sci-libs/libaec</pkg></flag>
<flag name="libdeflate">Use <pkg>app-arch/libdeflate</pkg> for faster compression and decompression</flag>
<flag name="mongodb">Enable support for MongoDBV3 driver with <pkg>dev-db/mongodb</pkg></flag>
<flag name="muparser">Enable support for C++ VRT expressions with <pkg>dev-cpp/muParser</pkg></flag>
<flag name="ogdi">Enable support for the open geographic datastore interface (<pkg>sci-libs/ogdi</pkg>)</flag>
<flag name="parquet">Enables read/write parquet data format (<pkg>dev-libs/apache-arrow</pkg>)</flag>
<flag name="qhull">Enable support for linear interpolation of gdal_grid with <pkg>media-libs/qhull</pkg></flag>
<flag name="spatialite">Enable Spatial DBMS over sqlite <pkg>dev-db/spatialite</pkg></flag>
<flag name="tools">Build command line utilities</flag>
<flag name="xls">Add the <pkg>dev-libs/freexl</pkg> library for xls import support</flag>
</use>
<upstream>