slackbuilds_ponce/gis/openorienteering-mapper/69977dfd4cbb8608aafa8ca8b5388d4983f5430a.patch
ArTourter 76d36aa916
gis/openorienteering-mapper: updated to version 0.9.5
update to include patch from debian submitted as a PR to upstream to
support proj version 8 which removes the deprecated proj_api.h

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2021-10-27 08:16:42 +07:00

35 lines
1.9 KiB
Diff

From 69977dfd4cbb8608aafa8ca8b5388d4983f5430a Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <sebastic@debian.org>
Date: Sat, 23 Oct 2021 17:08:31 +0200
Subject: [PATCH] Add support for proj.h, proj_api.h is removed in PROJ 8.
---
cmake/FindPROJ4.cmake | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/cmake/FindPROJ4.cmake b/cmake/FindPROJ4.cmake
index 093deaa79..10dfc7afa 100644
--- a/cmake/FindPROJ4.cmake
+++ b/cmake/FindPROJ4.cmake
@@ -91,6 +91,21 @@ if(PROJ4_INCLUDE_DIR AND EXISTS "${PROJ4_INCLUDE_DIR}/proj_api.h")
string(REGEX REPLACE "^.*PJ_VERSION [0-9][0-9]([0-9]).*$" "\\1" PROJ4_VERSION_PATCH "${PROJ4_H}")
set(PROJ4_VERSION "${PROJ4_VERSION_MAJOR}.${PROJ4_VERSION_MINOR}.${PROJ4_VERSION_PATCH}")
set(PROJ4_VERSION_COUNT 3)
+else()
+ find_path(PROJ4_INCLUDE_DIR NAMES proj.h ${_PROJ4_SEARCH} PATH_SUFFIXES include)
+ mark_as_advanced(PROJ4_INCLUDE_DIR)
+
+ if(PROJ4_INCLUDE_DIR AND EXISTS "${PROJ4_INCLUDE_DIR}/proj.h")
+ file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_MAJOR REGEX "^#define PROJ_VERSION_MAJOR [0-9]+$")
+ file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_MINOR REGEX "^#define PROJ_VERSION_MINOR [0-9]+$")
+ file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_PATCH REGEX "^#define PROJ_VERSION_PATCH [0-9]+$")
+
+ string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_MAJOR "${PROJ_VERSION_MAJOR}")
+ string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_MINOR "${PROJ_VERSION_MINOR}")
+ string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_PATCH "${PROJ_VERSION_PATCH}")
+ set(PROJ4_VERSION "${PROJ4_VERSION_MAJOR}.${PROJ4_VERSION_MINOR}.${PROJ4_VERSION_PATCH}")
+ set(PROJ4_VERSION_COUNT 3)
+ endif()
endif()
# Allow PROJ4_LIBRARY to be set manually, as the location of the proj library