From 65fe9f9cc9b6e6303fb879c74681bb244772831a Mon Sep 17 00:00:00 2001 From: Christoph Willing Date: Mon, 9 Dec 2019 20:28:41 +1000 Subject: [PATCH] libraries/VTK: Patched for proj version 6 Signed-off-by: Christoph Willing --- libraries/VTK/VTK.SlackBuild | 12 +++- libraries/VTK/patch-proj6.diff | 110 +++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 libraries/VTK/patch-proj6.diff diff --git a/libraries/VTK/VTK.SlackBuild b/libraries/VTK/VTK.SlackBuild index 7a216d4c0f..e9167ae916 100644 --- a/libraries/VTK/VTK.SlackBuild +++ b/libraries/VTK/VTK.SlackBuild @@ -28,7 +28,7 @@ PRGNAM=VTK VERSION=${VERSION:-8.2.0} SHORT_VERSION=${SHORT_VERSION:-8.2} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -70,7 +70,6 @@ wrap_python="" ; [ "${PYTHON:-yes}" != "no" ] && wrap_python="-DVTK_WRAP_PYTH wrap_java="" ; [ "${JAVA:-no}" != "no" ] && wrap_java="-DVTK_WRAP_JAVA=true" if pkg-config --exists jsoncpp ; then jsoncpp="-DVTK_USE_SYSTEM_JSONCPP:BOOL=ON" ; else jsoncpp="" ; fi -if pkg-config --exists proj ; then proj="-DVTK_USE_SYSTEM_LIBPROJ:BOOL=ON" ; else proj="" ; fi # TODO: netcdf, hdf5, gl2ps #if test -e /usr/include/hdf5.h ; then hdf5="-DVTK_USE_SYSTEM_HDF5:BOOL=ON" ; else hdf5="" ; fi @@ -97,6 +96,15 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +if pkg-config --exists proj ; then + proj="-DVTK_USE_SYSTEM_LIBPROJ:BOOL=ON" + # proj6 patch courtesy of + # https://git.archlinux.org/svntogit/community.git/plain/trunk/proj6.patch?h=packages/vtk + patch -p1 < $CWD/patch-proj6.diff +else + proj="" +fi + mkdir -p build cd build cmake \ diff --git a/libraries/VTK/patch-proj6.diff b/libraries/VTK/patch-proj6.diff new file mode 100644 index 0000000000..3ae71acef7 --- /dev/null +++ b/libraries/VTK/patch-proj6.diff @@ -0,0 +1,110 @@ +diff --git a/Geovis/Core/vtkGeoProjection.cxx b/Geovis/Core/vtkGeoProjection.cxx +index f3a8852d94..824060348a 100644 +--- a/Geovis/Core/vtkGeoProjection.cxx ++++ b/Geovis/Core/vtkGeoProjection.cxx +@@ -72,6 +72,7 @@ public: + } + + std::map< std::string, std::string > OptionalParameters; ++ PJ_PROJ_INFO ProjInfo; + }; + + //----------------------------------------------------------------------------- +@@ -80,7 +83,7 @@ int vtkGeoProjection::GetNumberOfProjections() + if ( vtkGeoProjectionNumProj < 0 ) + { + vtkGeoProjectionNumProj = 0; +- for ( const PJ_LIST* pj = pj_get_list_ref(); pj && pj->id; ++ pj ) ++ for ( const PJ_LIST* pj = proj_list_operations(); pj && pj->id; ++ pj ) + ++ vtkGeoProjectionNumProj; + } + return vtkGeoProjectionNumProj; +@@ -91,7 +94,7 @@ const char* vtkGeoProjection::GetProjectionName( int projection ) + if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() ) + return nullptr; + +- return pj_get_list_ref()[projection].id; ++ return proj_list_operations()[projection].id; + } + //----------------------------------------------------------------------------- + const char* vtkGeoProjection::GetProjectionDescription( int projection ) +@@ -99,7 +102,7 @@ const char* vtkGeoProjection::GetProjectionDescription( int projection ) + if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() ) + return nullptr; + +- return pj_get_list_ref()[projection].descr[0]; ++ return proj_list_operations()[projection].descr[0]; + } + //----------------------------------------------------------------------------- + vtkGeoProjection::vtkGeoProjection() +@@ -144,7 +147,7 @@ void vtkGeoProjection::PrintSelf( ostream& os, vtkIndent indent ) + int vtkGeoProjection::GetIndex() + { + int i = 0; +- for ( const PJ_LIST* proj = pj_get_list_ref(); proj && proj->id; ++ proj, ++ i ) ++ for ( const PJ_LIST* proj = proj_list_operations(); proj && proj->id; ++ proj, ++ i ) + { + if ( ! strcmp( proj->id, this->Name ) ) + { +@@ -161,7 +164,7 @@ const char* vtkGeoProjection::GetDescription() + { + return nullptr; + } +- return this->Projection->descr; ++ return this->Internals->ProjInfo.description; + } + //----------------------------------------------------------------------------- + projPJ vtkGeoProjection::GetProjection() +@@ -232,6 +239,7 @@ int vtkGeoProjection::UpdateProjection() + this->ProjectionMTime = this->GetMTime(); + if ( this->Projection ) + { ++ this->Internals->ProjInfo = proj_pj_info(this->Projection); + return 0; + } + return 1; +diff --git a/Geovis/Core/vtkGeoTransform.cxx b/Geovis/Core/vtkGeoTransform.cxx +index aeeabc1075..b80a8c010c 100644 +--- a/Geovis/Core/vtkGeoTransform.cxx ++++ b/Geovis/Core/vtkGeoTransform.cxx +@@ -167,9 +167,9 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int + double* coord = x; + for ( vtkIdType i = 0; i < numPts; ++ i ) + { +- xy.u = coord[0]; xy.v = coord[1]; ++ xy.x = coord[0]; xy.y = coord[1]; + lp = pj_inv( xy, src ); +- coord[0] = lp.u; coord[1] = lp.v; ++ coord[0] = lp.lam; coord[1] = lp.phi; + coord += stride; + } + } +@@ -191,9 +199,9 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int + double* coord = x; + for ( vtkIdType i = 0; i < numPts; ++ i ) + { +- lp.u = coord[0]; lp.v = coord[1]; ++ lp.lam = coord[0]; lp.phi = coord[1]; + xy = pj_fwd( lp, dst ); +- coord[0] = xy.u; coord[1] = xy.v; ++ coord[0] = xy.x; coord[1] = xy.y; + coord += stride; + } + } +diff --git a/ThirdParty/libproj/vtk_libproj.h.in b/ThirdParty/libproj/vtk_libproj.h.in +index d52db07a95..4d8ffc3c5d 100644 +--- a/ThirdParty/libproj/vtk_libproj.h.in ++++ b/ThirdParty/libproj/vtk_libproj.h.in +@@ -18,7 +18,8 @@ + /* Use the libproj library configured for VTK. */ + #cmakedefine VTK_USE_SYSTEM_LIBPROJ + #ifdef VTK_USE_SYSTEM_LIBPROJ +-# include ++# include ++# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1 + # include + # include + #else +-- +2.21.0 +