From 56e89ebc21391215d33eec82c5ac57f62e736028 Mon Sep 17 00:00:00 2001 From: Bert Huijben Date: Fri, 19 Nov 2021 06:42:18 +0100 Subject: [PATCH] [proj4] Update to 8.0.0 (#16494) * [proj4,vtk,mapnik] Upgrade to proj 8.0.0. Make vtk compatible via upstream patch and mapnik by buildscript tweak. * [mapnik, proj4, vtk]: add versions --- ports/mapnik/portfile.cmake | 2 + ports/mapnik/proj-find-fix.patch | 13 +++ ports/mapnik/vcpkg.json | 1 + ports/proj4/portfile.cmake | 4 +- ports/proj4/vcpkg.json | 3 +- ports/vtk/UseProj5Api.patch | 149 +++++++++++++++++++++++++++++++ ports/vtk/portfile.cmake | 3 +- ports/vtk/vcpkg.json | 2 +- versions/baseline.json | 8 +- versions/m-/mapnik.json | 5 ++ versions/p-/proj4.json | 5 ++ versions/v-/vtk.json | 5 ++ 12 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 ports/mapnik/proj-find-fix.patch create mode 100644 ports/vtk/UseProj5Api.patch diff --git a/ports/mapnik/portfile.cmake b/ports/mapnik/portfile.cmake index cd219bed56d716..a093014a901588 100644 --- a/ports/mapnik/portfile.cmake +++ b/ports/mapnik/portfile.cmake @@ -7,6 +7,8 @@ vcpkg_from_github( REF 14f913d6ab3b0903dd36a1cb2d22f7d5493b8bb8 SHA512 f90762594d46946ddc512bb19b21c4d6a2f1ce81b7500a326ad512fae3a3f77e49ef3eb727ff8f98a31596e4132528212e0fa146e2eee0a9965a16551cfd0386 HEAD_REF master + PATCHES + proj-find-fix.patch # Quiet search with version range somehow fails for proj8+ ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS diff --git a/ports/mapnik/proj-find-fix.patch b/ports/mapnik/proj-find-fix.patch new file mode 100644 index 00000000000000..4fb3537610e061 --- /dev/null +++ b/ports/mapnik/proj-find-fix.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 47bbaa1..43f384d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -304,7 +304,7 @@ if(USE_WEBP) + + if(USE_PROJ) + #https://proj.org/development/cmake.html +- mapnik_find_package(PROJ ${PROJ_MIN_VERSION} QUIET) ++ mapnik_find_package(PROJ REQUIRED) + # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config + if(NOT PROJ_FOUND) + message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") diff --git a/ports/mapnik/vcpkg.json b/ports/mapnik/vcpkg.json index 582ba8497383f5..64f53ec587f94c 100644 --- a/ports/mapnik/vcpkg.json +++ b/ports/mapnik/vcpkg.json @@ -1,6 +1,7 @@ { "name": "mapnik", "version-date": "2021-11-15", + "port-version": 1, "description": "Mapnik is an open source toolkit for developing mapping applications.", "homepage": "https://github.com/mapnik/mapnik", "supports": "!(static & windows)", diff --git a/ports/proj4/portfile.cmake b/ports/proj4/portfile.cmake index 7933cf711939af..2a0a83e24bca53 100644 --- a/ports/proj4/portfile.cmake +++ b/ports/proj4/portfile.cmake @@ -1,9 +1,9 @@ -set(VERSION 7.2.1) # Variable used for pc file +set(VERSION 8.0.0) # Variable used for pc file vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO OSGeo/PROJ REF "${VERSION}" - SHA512 e6e77266dcd70c939c16667c916cccab8de161221d2ef600cfca43382f50da2dc8d790561556b4416adbb4ac6fba939004e0cc936c278e0e808dc3566e9a70d4 + SHA512 353f0e14ba6c11bfcec8a30b3f322842e8a3103546e0fd40871e341c859ca7ae2b9411425be5b588eb45cc5716255d2ea81d6357407bcfb9506a0edb161376f5 HEAD_REF master PATCHES fix-filemanager-uwp.patch diff --git a/ports/proj4/vcpkg.json b/ports/proj4/vcpkg.json index 9aed018aa871bd..b1c9f2034c0407 100644 --- a/ports/proj4/vcpkg.json +++ b/ports/proj4/vcpkg.json @@ -1,7 +1,6 @@ { "name": "proj4", - "version-semver": "7.2.1", - "port-version": 7, + "version-semver": "8.0.0", "description": "PROJ.4 library for cartographic projections", "homepage": "https://github.com/OSGeo/PROJ", "dependencies": [ diff --git a/ports/vtk/UseProj5Api.patch b/ports/vtk/UseProj5Api.patch new file mode 100644 index 00000000000000..7ee7adae3a9673 --- /dev/null +++ b/ports/vtk/UseProj5Api.patch @@ -0,0 +1,149 @@ +From 0325638832e35c8c8c6fc96e2c1d887aeea3dd43 Mon Sep 17 00:00:00 2001 +From: Julien Schueller +Date: Mon, 8 Mar 2021 10:57:46 +0100 +Subject: [PATCH] Geovis: Use proj>=5 api + +Closes #18130 +--- + Geovis/Core/vtkGeoProjection.cxx | 17 ++++++++++++++++- + Geovis/Core/vtkGeoTransform.cxx | 28 ++++++++++++++-------------- + ThirdParty/libproj/vtk_libproj.h.in | 7 +------ + 3 files changed, 31 insertions(+), 21 deletions(-) + +diff --git a/Geovis/Core/vtkGeoProjection.cxx b/Geovis/Core/vtkGeoProjection.cxx +index 7ff6526a5d..0a0d06eba1 100644 +--- a/Geovis/Core/vtkGeoProjection.cxx ++++ b/Geovis/Core/vtkGeoProjection.cxx +@@ -121,7 +121,11 @@ vtkGeoProjection::~vtkGeoProjection() + this->SetPROJ4String(nullptr); + if (this->Projection) + { ++#if PROJ_VERSION_MAJOR >= 5 ++ proj_destroy(this->Projection); ++#else + pj_free(this->Projection); ++#endif + } + delete this->Internals; + this->Internals = nullptr; +@@ -185,13 +189,21 @@ int vtkGeoProjection::UpdateProjection() + + if (this->Projection) + { ++#if PROJ_VERSION_MAJOR >= 5 ++ proj_destroy(this->Projection); ++#else + pj_free(this->Projection); ++#endif + this->Projection = nullptr; + } + + if (this->PROJ4String && strlen(this->PROJ4String)) + { ++#if PROJ_VERSION_MAJOR >= 5 ++ this->Projection = proj_create(PJ_DEFAULT_CTX, this->PROJ4String); ++#else + this->Projection = pj_init_plus(this->PROJ4String); ++#endif + if (!this->Projection) + { + vtkErrorMacro("Cannot set projection with string " << this->PROJ4String); +@@ -234,8 +246,11 @@ int vtkGeoProjection::UpdateProjection() + stringHolder[i] = param.str(); + pjArgs[3 + i] = stringHolder[i].c_str(); + } +- ++#if PROJ_VERSION_MAJOR >= 5 ++ this->Projection = proj_create_argv(PJ_DEFAULT_CTX, argSize, const_cast(pjArgs)); ++#else + this->Projection = pj_init(argSize, const_cast(pjArgs)); ++#endif + delete[] pjArgs; + } + this->ProjectionMTime = this->GetMTime(); +diff --git a/Geovis/Core/vtkGeoTransform.cxx b/Geovis/Core/vtkGeoTransform.cxx +index 5c2c74279d..1c99b6b11b 100644 +--- a/Geovis/Core/vtkGeoTransform.cxx ++++ b/Geovis/Core/vtkGeoTransform.cxx +@@ -163,8 +163,12 @@ void vtkGeoTransform::InternalTransformPoints(double* x, vtkIdType numPts, int s + projPJ src = this->SourceProjection ? this->SourceProjection->GetProjection() : nullptr; + projPJ dst = this->DestinationProjection ? this->DestinationProjection->GetProjection() : nullptr; + int delta = stride - 2; ++#if PROJ_VERSION_MAJOR >= 5 ++ PJ_COORD c, c_out; ++#else + projLP lp; + projXY xy; ++#endif + if (src) + { + // Convert from src system to lat/long using inverse of src transform +@@ -172,17 +176,15 @@ void vtkGeoTransform::InternalTransformPoints(double* x, vtkIdType numPts, int s + for (vtkIdType i = 0; i < numPts; ++i) + { + #if PROJ_VERSION_MAJOR >= 5 +- xy.x = coord[0]; +- xy.y = coord[1]; ++ c.xy.x = coord[0]; ++ c.xy.y = coord[1]; ++ c_out = proj_trans(src, PJ_INV, c); ++ coord[0] = c_out.lp.lam; ++ coord[1] = c_out.lp.phi; + #else + xy.u = coord[0]; + xy.v = coord[1]; +-#endif + lp = pj_inv(xy, src); +-#if PROJ_VERSION_MAJOR >= 5 +- coord[0] = lp.lam; +- coord[1] = lp.phi; +-#else + coord[0] = lp.u; + coord[1] = lp.v; + #endif +@@ -208,17 +210,15 @@ void vtkGeoTransform::InternalTransformPoints(double* x, vtkIdType numPts, int s + for (vtkIdType i = 0; i < numPts; ++i) + { + #if PROJ_VERSION_MAJOR >= 5 +- lp.lam = coord[0]; +- lp.phi = coord[1]; ++ c.lp.lam = coord[0]; ++ c.lp.phi = coord[1]; ++ c_out = proj_trans(src, PJ_FWD, c); ++ coord[0] = c_out.xy.x; ++ coord[1] = c_out.xy.y; + #else + lp.u = coord[0]; + lp.v = coord[1]; +-#endif + xy = pj_fwd(lp, dst); +-#if PROJ_VERSION_MAJOR >= 5 +- coord[0] = xy.x; +- coord[1] = xy.y; +-#else + coord[0] = xy.u; + coord[1] = xy.v; + #endif +diff --git a/ThirdParty/libproj/vtk_libproj.h.in b/ThirdParty/libproj/vtk_libproj.h.in +index 4d8ffc3c5d..c4182c4db2 100644 +--- a/ThirdParty/libproj/vtk_libproj.h.in ++++ b/ThirdParty/libproj/vtk_libproj.h.in +@@ -28,14 +28,9 @@ + #if VTK_MODULE_USE_EXTERNAL_vtklibproj + # if VTK_LibPROJ_MAJOR_VERSION >= 5 + # include +-# endif +-# if VTK_LibPROJ_MAJOR_VERSION < 6 ++# else + # include + # endif +-# if VTK_LibPROJ_MAJOR_VERSION >= 6 +-# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1 +-# endif +-# include + # include + #else + # include +-- +2.32.0.windows.1 + diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 63bd5eec20fbd9..cff5332c1fe36c 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -29,6 +29,7 @@ vcpkg_from_github( d107698a.patch fix-gdal.patch missing-limits.patch # This patch can be removed in next version. Since it has been merged to upstream via https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7611 + UseProj5Api.patch # Allow Proj 8.0+ (commit b66e4a7, backported). Should be in soon after 9.0.3 ) # ============================================================================= @@ -299,4 +300,4 @@ file(RENAME "${CURRENT_PACKAGES_DIR}/share/licenses" "${CURRENT_PACKAGES_DIR}/sh # Usage configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) # Handle copyright -file(INSTALL "${SOURCE_PATH}/Copyright.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright") \ No newline at end of file +file(INSTALL "${SOURCE_PATH}/Copyright.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright") diff --git a/ports/vtk/vcpkg.json b/ports/vtk/vcpkg.json index f443603a6618bd..2ce6162f33feba 100644 --- a/ports/vtk/vcpkg.json +++ b/ports/vtk/vcpkg.json @@ -1,7 +1,7 @@ { "name": "vtk", "version-semver": "9.0.3-pv5.9.1", - "port-version": 4, + "port-version": 5, "description": "Software system for 3D computer graphics, image processing, and visualization", "homepage": "https://github.com/Kitware/VTK", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index 89e9da93c6c146..dbcde5a8020b8e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4254,7 +4254,7 @@ }, "mapnik": { "baseline": "2021-11-15", - "port-version": 0 + "port-version": 1 }, "marble": { "baseline": "19.08.2", @@ -5373,8 +5373,8 @@ "port-version": 1 }, "proj4": { - "baseline": "7.2.1", - "port-version": 7 + "baseline": "8.0.0", + "port-version": 0 }, "prometheus-cpp": { "baseline": "1.0.0", @@ -7086,7 +7086,7 @@ }, "vtk": { "baseline": "9.0.3-pv5.9.1", - "port-version": 4 + "port-version": 5 }, "vtk-dicom": { "baseline": "0.8.12", diff --git a/versions/m-/mapnik.json b/versions/m-/mapnik.json index 6031bfaea3a05d..faee7dbb0d57a2 100644 --- a/versions/m-/mapnik.json +++ b/versions/m-/mapnik.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3f8eb08ffc7a02dd08de30c0851587d9537fc72e", + "version-date": "2021-11-15", + "port-version": 1 + }, { "git-tree": "d1ae6b45aea26d1bbed2716beaaaeaf3719fbefa", "version-date": "2021-11-15", diff --git a/versions/p-/proj4.json b/versions/p-/proj4.json index da6bb80887ba84..c9c039a63a6ff8 100644 --- a/versions/p-/proj4.json +++ b/versions/p-/proj4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f1939ed4483f6f1d75f6ddacb6a741090144bcfb", + "version-semver": "8.0.0", + "port-version": 0 + }, { "git-tree": "991dc069b2b9acb50da346e27f48100d5d8f8186", "version-semver": "7.2.1", diff --git a/versions/v-/vtk.json b/versions/v-/vtk.json index 975f7bb0e105c6..36d887d4c23cee 100644 --- a/versions/v-/vtk.json +++ b/versions/v-/vtk.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "bd6ac57e684fd8a2234509813248f64a6cb522d5", + "version-semver": "9.0.3-pv5.9.1", + "port-version": 5 + }, { "git-tree": "223022edbe63b3ecdb3e9204a4ad63ab61b36ece", "version-semver": "9.0.3-pv5.9.1",