summaryrefslogtreecommitdiff
path: root/dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch
diff options
context:
space:
mode:
authorNHOrus <jy6x2b32pie9@yahoo.com>2025-01-06 18:20:21 +0400
committerSam James <sam@gentoo.org>2025-02-10 09:13:17 +0000
commit1e5c143b1d6f57d4fc3c55bbe9aad3d2eb46c298 (patch)
tree5ba659fd9c6451b95d7f9e5327950a6fc16522ca /dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch
parent9e2efdc0e1b463df3e1e34172e0d8eaba2bc809a (diff)
downloadgentoo-1e5c143b1d6f57d4fc3c55bbe9aad3d2eb46c298.tar.gz
gentoo-1e5c143b1d6f57d4fc3c55bbe9aad3d2eb46c298.tar.bz2
gentoo-1e5c143b1d6f57d4fc3c55bbe9aad3d2eb46c298.zip
dev-db/spatialite: fix compile errors
Upstream forgot to: 1. remove usage of functions whose existence depends on USE=geos 2. add modern interfaces for PROJ.6+ in all places where fallback to PROJ.4 existed. Bug: https://bugs.gentoo.org/919177 Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com> Closes: https://github.com/gentoo/gentoo/pull/40009 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch')
-rw-r--r--dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch b/dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch
new file mode 100644
index 000000000000..ea057f50bc8b
--- /dev/null
+++ b/dev-db/spatialite/files/spatialite-5.1.0-macro-surgery.patch
@@ -0,0 +1,80 @@
+https://bugs.gentoo.org/919177
+https://www.gaia-gis.it/fossil/libspatialite/tktview?name=d5c8f926be
+https://www.gaia-gis.it/fossil/libspatialite/tktview/af38159360a2e740b2339e279103bcdaf951498e
+Macro out things upstream forgot to conditionally exclude, macro in things upstream forgot
+In particular, functions that appear only when GEOM is enabled should not be used
+when GEOM is disabled, and having fallback for ancient version of PROJ is well and good;
+upstream forgot version for modern one in one place.
+--- a/src/gaiageo/gg_advanced.c
++++ b/src/gaiageo/gg_advanced.c
+@@ -2286,6 +2286,7 @@
+ / identifying toxic geometries
+ / i.e. geoms making GEOS to crash !!!
+ */
++#ifndef OMIT_GEOS /* don't do anything if there's no GEOS */
+ int ib;
+ gaiaPointPtr point;
+ gaiaLinestringPtr line;
+@@ -2350,6 +2351,7 @@
+ }
+ polyg = polyg->Next;
+ }
++#endif /* OMIT_GEOS */
+ return 0;
+ }
+
+@@ -2377,11 +2379,13 @@
+ return 0;
+ else
+ {
++#ifndef OMIT_GEOS /*can't report error if GEOS is not build, skipping */
+ if (cache != NULL)
+ gaiaSetGeosAuxErrorMsg_r (cache,
+ "gaia detected a not-closed Ring");
+ else
+ gaiaSetGeosAuxErrorMsg ("gaia detected a not-closed Ring");
++#endif
+ return 1;
+ }
+ }
+--- a/src/spatialite/spatialite.c
++++ b/src/spatialite/spatialite.c
+@@ -23472,9 +23472,11 @@
+ sqlite3_result_null (context);
+ else
+ {
++#ifndef OMIT_GEOS /* Only if GEOS enabled */
+ if (!gaiaInterpolatePoint (cache, line, point, &m_value))
+ sqlite3_result_null (context);
+ else
++#endif
+ sqlite3_result_double (context, m_value);
+ }
+ if (line != NULL)
+--- a/src/connection_cache/alloc_cache.c
++++ b/connection_cache/alloc_cache.c
+@@ -646,8 +646,12 @@
+ #endif
+
+ #else /* supporting old PROJ.4 */
++#ifdef PROJ_NEW /* PROJ.6* */
++ cache->PROJ_handle = proj_context_create ();
++#else
+ cache->PROJ_handle = pj_ctx_alloc ();
+ #endif
++#endif
+ #endif /* end PROJ.4 */
+
+ #ifdef ENABLE_RTTOPO /* initializing the RTTOPO context */
+@@ -706,7 +706,11 @@
+ #endif /* end GEOS */
+
+ #ifndef OMIT_PROJ /* initializing the PROJ.4 context */
++#ifndef PROJ_NEW /* Only in case where PROJ.5 not needed */
+ cache->PROJ_handle = pj_ctx_alloc ();
++#else /* PROJ.6* */
++ cache->PROJ_handle = proj_context_create ();
++#endif
+ #endif /* end PROJ.4 */
+
+ done: