math/plplot: fix build with reentrant version of qhull
patch from debian: https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
This commit is contained in:
parent
a0aa2b0fb2
commit
dddf1fb7f7
@ -16,7 +16,7 @@ PKGNAME-c++ = plplot-c++-${VERSION}
|
||||
PKGNAME-fortran = plplot-fortran-${VERSION}
|
||||
REVISION-c++ = 0
|
||||
REVISION-fortran = 0
|
||||
REVISION-main = 0
|
||||
REVISION-main = 1
|
||||
|
||||
CATEGORIES = math graphics
|
||||
|
||||
@ -64,7 +64,7 @@ MULTI_PACKAGES = -main -c++ -fortran
|
||||
|
||||
myWANTLIB += ICE SM X11 Xext cairo glib-2.0
|
||||
myWANTLIB += gobject-2.0 m pango-1.0 pangocairo-1.0
|
||||
myWANTLIB += qhull intl ltdl shp harfbuzz
|
||||
myWANTLIB += qhull_r intl ltdl shp harfbuzz
|
||||
|
||||
WANTLIB-main = ${myWANTLIB} c pthread
|
||||
WANTLIB-c++ = plplot m ${COMPILER_LIBCXX}
|
||||
|
42
math/plplot/patches/patch-cmake_modules_FindQHULL_cmake
Normal file
42
math/plplot/patches/patch-cmake_modules_FindQHULL_cmake
Normal file
@ -0,0 +1,42 @@
|
||||
fix build with reentrant qhull
|
||||
|
||||
https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
|
||||
|
||||
Index: cmake/modules/FindQHULL.cmake
|
||||
--- cmake/modules/FindQHULL.cmake.orig
|
||||
+++ cmake/modules/FindQHULL.cmake
|
||||
@@ -16,27 +16,27 @@ include(FindPackageHandleStandardArgs)
|
||||
# that is what is supplied by upstream qhull, and if the user is
|
||||
# finding a local install of the upstream library below, he wants to
|
||||
# access that same upstream version of the headers to be consistent.
|
||||
-find_file(QHULL_HEADER_FILE NAMES libqhull/qhull_a.h qhull/qhull_a.h)
|
||||
+find_file(QHULL_HEADER_FILE NAMES libqhull_r/qhull_ra.h)
|
||||
if(QHULL_HEADER_FILE)
|
||||
# message(STATUS "QHULL_HEADER_FILE = ${QHULL_HEADER_FILE}")
|
||||
- if(QHULL_HEADER_FILE MATCHES "libqhull")
|
||||
+ if(QHULL_HEADER_FILE MATCHES "libqhull_r")
|
||||
set(HAS_LIBQHULL_INCLUDE ON)
|
||||
- else(QHULL_HEADER_FILE MATCHES "libqhull")
|
||||
+ else()
|
||||
set(HAS_LIBQHULL_INCLUDE OFF)
|
||||
- endif(QHULL_HEADER_FILE MATCHES "libqhull")
|
||||
+ endif()
|
||||
# Determine grandparent directory of header file
|
||||
get_filename_component(QHULL_INCLUDE_DIRS ${QHULL_HEADER_FILE} DIRECTORY)
|
||||
get_filename_component(QHULL_INCLUDE_DIRS ${QHULL_INCLUDE_DIRS} DIRECTORY)
|
||||
elseif(NOT QHULL_HEADER_FILE AND NOT QHULL_FIND_QUIETLY)
|
||||
- message(STATUS "Neither qhull/qhull_a.h header nor libqhull/qhull_a.h could be found")
|
||||
+ message(STATUS "libqhull_r/qhull_ra.h could not be found")
|
||||
endif(QHULL_HEADER_FILE)
|
||||
|
||||
-find_library(QHULL_LIBRARY qhull)
|
||||
+find_library(QHULL_LIBRARY qhull_r)
|
||||
if( QHULL_LIBRARY )
|
||||
get_filename_component(QHULL_LIBRARY_DIRS ${QHULL_LIBRARY} DIRECTORY)
|
||||
set(QHULL_LIBRARIES ${QHULL_LIBRARY})
|
||||
elseif(NOT QHULL_LIBRARY AND NOT QHULL_FIND_QUIETLY)
|
||||
- message(STATUS "qhull library could not be found")
|
||||
+ message(STATUS "qhull_r library could not be found")
|
||||
endif(QHULL_LIBRARY)
|
||||
|
||||
find_package_handle_standard_args(QHULL
|
@ -1,3 +1,7 @@
|
||||
last chunk: fix build with reentrant qhull
|
||||
|
||||
https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
|
||||
|
||||
Index: cmake/modules/csiro.cmake
|
||||
--- cmake/modules/csiro.cmake.orig
|
||||
+++ cmake/modules/csiro.cmake
|
||||
@ -16,3 +20,16 @@ Index: cmake/modules/csiro.cmake
|
||||
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86" AND NOT CMAKE_C_COMPILER MATCHES "gcc")
|
||||
if(NOT DEFINED NaNAwareCCompiler)
|
||||
message(STATUS "Check for NaN awareness in C compiler")
|
||||
@@ -89,11 +89,7 @@ if(PL_HAVE_QHULL)
|
||||
message(STATUS "WARNING: function qh_new_qhull not found. Setting PL_HAVE_QHULL to OFF.")
|
||||
set(PL_HAVE_QHULL OFF CACHE BOOL "Enable use of the Qhull library" FORCE)
|
||||
endif(NOT QH_NEW_EXIST)
|
||||
- if(HAS_LIBQHULL_INCLUDE)
|
||||
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c "#include <libqhull/qhull_a.h>")
|
||||
- else(HAS_LIBQHULL_INCLUDE)
|
||||
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c "#include <qhull/qhull_a.h>")
|
||||
- endif(HAS_LIBQHULL_INCLUDE)
|
||||
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c "#include <libqhull_r/qhull_ra.h>")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c
|
||||
"
|
||||
int main(void)
|
||||
|
20
math/plplot/patches/patch-cmake_modules_csiro_cmake.orig
Normal file
20
math/plplot/patches/patch-cmake_modules_csiro_cmake.orig
Normal file
@ -0,0 +1,20 @@
|
||||
fix build with reentrant qhull
|
||||
|
||||
https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
|
||||
|
||||
Index: cmake/modules/csiro.cmake
|
||||
--- cmake/modules/csiro.cmake.orig
|
||||
+++ cmake/modules/csiro.cmake
|
||||
@@ -89,11 +89,7 @@ if(PL_HAVE_QHULL)
|
||||
message(STATUS "WARNING: function qh_new_qhull not found. Setting PL_HAVE_QHULL to OFF.")
|
||||
set(PL_HAVE_QHULL OFF CACHE BOOL "Enable use of the Qhull library" FORCE)
|
||||
endif(NOT QH_NEW_EXIST)
|
||||
- if(HAS_LIBQHULL_INCLUDE)
|
||||
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c "#include <libqhull/qhull_a.h>")
|
||||
- else(HAS_LIBQHULL_INCLUDE)
|
||||
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c "#include <qhull/qhull_a.h>")
|
||||
- endif(HAS_LIBQHULL_INCLUDE)
|
||||
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c "#include <libqhull_r/qhull_ra.h>")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/Check_realT_size.c
|
||||
"
|
||||
int main(void)
|
64
math/plplot/patches/patch-lib_nn_delaunay_c
Normal file
64
math/plplot/patches/patch-lib_nn_delaunay_c
Normal file
@ -0,0 +1,64 @@
|
||||
fix build with reentrant qhull
|
||||
|
||||
https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
|
||||
|
||||
Index: lib/nn/delaunay.c
|
||||
--- lib/nn/delaunay.c.orig
|
||||
+++ lib/nn/delaunay.c
|
||||
@@ -34,12 +34,8 @@
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#ifdef USE_QHULL
|
||||
-#ifdef HAS_LIBQHULL_INCLUDE
|
||||
-#include <libqhull/qhull_a.h>
|
||||
+#include <libqhull_r/qhull_ra.h>
|
||||
#else
|
||||
-#include <qhull/qhull_a.h>
|
||||
-#endif
|
||||
-#else
|
||||
#include "triangle.h"
|
||||
#endif
|
||||
#include "istack.h"
|
||||
@@ -388,7 +384,10 @@ delaunay* delaunay_build( int np, point points[], int
|
||||
// climax
|
||||
//
|
||||
|
||||
- exitcode = qh_new_qhull( dim, np, qpoints, ismalloc,
|
||||
+ qhT context = { 0 };
|
||||
+ qhT* qh = &context;
|
||||
+
|
||||
+ exitcode = qh_new_qhull( qh, dim, np, qpoints, ismalloc,
|
||||
flags, outfile, errfile );
|
||||
|
||||
if ( !exitcode )
|
||||
@@ -433,8 +432,8 @@ delaunay* delaunay_build( int np, point points[], int
|
||||
}
|
||||
}
|
||||
|
||||
- qh_findgood_all( qh facet_list );
|
||||
- qh_countfacets( qh facet_list, NULL, !qh_ALL, &numfacets,
|
||||
+ qh_findgood_all( qh, qh->facet_list );
|
||||
+ qh_countfacets( qh, qh->facet_list, NULL, !qh_ALL, &numfacets,
|
||||
&numsimplicial, &totneighbors, &numridges,
|
||||
&numcoplanars, &numtricoplanars );
|
||||
|
||||
@@ -462,7 +461,7 @@ delaunay* delaunay_build( int np, point points[], int
|
||||
|
||||
j = 0;
|
||||
FOREACHvertex_( facet->vertices )
|
||||
- t->vids[j++] = qh_pointid( vertex->point );
|
||||
+ t->vids[j++] = qh_pointid( qh, vertex->point );
|
||||
|
||||
j = 0;
|
||||
FOREACHneighbor_( facet )
|
||||
@@ -548,8 +547,8 @@ delaunay* delaunay_build( int np, point points[], int
|
||||
}
|
||||
|
||||
free( qpoints );
|
||||
- qh_freeqhull( !qh_ALL ); // free long memory
|
||||
- qh_memfreeshort( &curlong, &totlong ); // free short memory and memory allocator
|
||||
+ qh_freeqhull( qh, !qh_ALL ); // free long memory
|
||||
+ qh_memfreeshort( qh, &curlong, &totlong ); // free short memory and memory allocator
|
||||
if ( curlong || totlong )
|
||||
fprintf( errfile,
|
||||
"qhull: did not free %d bytes of long memory (%d pieces)\n",
|
19
math/plplot/patches/patch-src_CMakeLists_txt
Normal file
19
math/plplot/patches/patch-src_CMakeLists_txt
Normal file
@ -0,0 +1,19 @@
|
||||
fix build with reentrant qhull
|
||||
|
||||
https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
|
||||
|
||||
Index: src/CMakeLists.txt
|
||||
--- src/CMakeLists.txt.orig
|
||||
+++ src/CMakeLists.txt
|
||||
@@ -259,9 +259,9 @@ if(PL_HAVE_QHULL)
|
||||
# No *.pc files for lib subdirectory libraries so must add relevant bits
|
||||
# to the plplot.pc file instead.
|
||||
if(QHULL_RPATH)
|
||||
- list(APPEND pc_libplplot_LINK_FLAGS -l${WRITEABLE_TARGET}csironn -L${QHULL_RPATH} -lqhull)
|
||||
+ list(APPEND pc_libplplot_LINK_FLAGS -l${WRITEABLE_TARGET}csironn -L${QHULL_RPATH} -lqhull_r)
|
||||
else(QHULL_RPATH)
|
||||
- list(APPEND pc_libplplot_LINK_FLAGS -l${WRITEABLE_TARGET}csironn -lqhull)
|
||||
+ list(APPEND pc_libplplot_LINK_FLAGS -l${WRITEABLE_TARGET}csironn -lqhull_r)
|
||||
endif(QHULL_RPATH)
|
||||
|
||||
# Needed by plgridd.c.
|
88
math/plplot/patches/patch-src_plgridd_c
Normal file
88
math/plplot/patches/patch-src_plgridd_c
Normal file
@ -0,0 +1,88 @@
|
||||
fix build with reentrant qhull
|
||||
|
||||
https://salsa.debian.org/science-team/plplot/-/blob/master/debian/patches/reentrant-qhull.patch
|
||||
|
||||
Index: src/plgridd.c
|
||||
--- src/plgridd.c.orig
|
||||
+++ src/plgridd.c
|
||||
@@ -32,11 +32,7 @@
|
||||
#include "../lib/nn/nn.h"
|
||||
// PLPLOT_NONN not #defined or tested for more than a decade.
|
||||
#ifdef PLPLOT_NONN // another DTLI, based only on QHULL, not nn
|
||||
-#ifdef HAS_LIBQHULL_INCLUDE
|
||||
-#include <libqhull/qhull_a.h>
|
||||
-#else //#ifdef HAS_LIBQHULL_INCLUDE
|
||||
-#include <qhull/qhull_a.h>
|
||||
-#endif //#ifdef HAS_LIBQHULL_INCLUDE
|
||||
+#include <libqhull_r/qhull_ra.h>
|
||||
#endif //#ifdef PLPLOT_NONN
|
||||
#endif //#ifdef PL_HAVE_QHUL
|
||||
|
||||
@@ -852,8 +848,11 @@ grid_adtli( PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECT
|
||||
points[i * dim + 1] = y[i];
|
||||
}
|
||||
|
||||
+ qhT context = { 0 };
|
||||
+ qhT* qh = &context;
|
||||
+
|
||||
#if 1 // easy way
|
||||
- exitcode = qh_new_qhull( dim, npts, points, ismalloc,
|
||||
+ exitcode = qh_new_qhull( qh, dim, npts, points, ismalloc,
|
||||
flags, outfile, errfile );
|
||||
#else
|
||||
qh_init_A( stdin, stdout, stderr, 0, NULL );
|
||||
@@ -899,17 +898,17 @@ grid_adtli( PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECT
|
||||
#endif
|
||||
|
||||
// Without the setjmp(), Qhull will exit() after reporting an error
|
||||
- exitcode = setjmp( qh errexit );
|
||||
+ exitcode = setjmp( qh->errexit );
|
||||
if ( !exitcode )
|
||||
{
|
||||
- qh NOerrexit = False;
|
||||
+ qh->NOerrexit = False;
|
||||
for ( i = 0; i < nptsx; i++ )
|
||||
for ( j = 0; j < nptsy; j++ )
|
||||
{
|
||||
l = 0;
|
||||
point[0] = xg[i];
|
||||
point[1] = yg[j];
|
||||
- qh_setdelaunay( 3, 1, point );
|
||||
+ qh_setdelaunay( qh, 3, 1, point );
|
||||
|
||||
|
||||
// several ways to find the triangle given a point follow.
|
||||
@@ -942,7 +941,7 @@ grid_adtli( PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECT
|
||||
// Another possibility is to implement the 'walking
|
||||
// triangle algorithm
|
||||
|
||||
- facet = qh_findfacet_all( point, &bestdist, &isoutside, &totpart );
|
||||
+ facet = qh_findfacet_all( qh, point, &bestdist, &isoutside, &totpart );
|
||||
|
||||
if ( facet->upperdelaunay )
|
||||
zops->set( zgp, i, j, NaN );
|
||||
@@ -950,7 +949,7 @@ grid_adtli( PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECT
|
||||
{
|
||||
FOREACHvertex_( facet->vertices )
|
||||
{
|
||||
- k = qh_pointid( vertex->point );
|
||||
+ k = qh_pointid( qh, vertex->point );
|
||||
xt[l] = x[k];
|
||||
yt[l] = y[k];
|
||||
zt[l] = z[k];
|
||||
@@ -969,12 +968,12 @@ grid_adtli( PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECT
|
||||
}
|
||||
}
|
||||
}
|
||||
- qh NOerrexit = True;
|
||||
+ qh->NOerrexit = True;
|
||||
}
|
||||
|
||||
free( points );
|
||||
- qh_freeqhull( !qh_ALL ); // free long memory
|
||||
- qh_memfreeshort( &curlong, &totlong ); // free short memory and memory allocator
|
||||
+ qh_freeqhull( qh, !qh_ALL ); // free long memory
|
||||
+ qh_memfreeshort( qh, &curlong, &totlong ); // free short memory and memory allocator
|
||||
if ( curlong || totlong )
|
||||
fprintf( errfile,
|
||||
"qhull: did not free %d bytes of long memory (%d pieces)\n",
|
Loading…
x
Reference in New Issue
Block a user