From 7c93a4a2747d01333e739f67f43f7cd8c607dc34 Mon Sep 17 00:00:00 2001
From: Dmitri Konstantinov <Dmitri.Konstantinov@cern.ch>
Date: Tue, 29 Apr 2025 07:00:09 +0200
Subject: [PATCH] Add temporary(solution) for ROOT internal unuran pacthcing it
 in not that elegant way

---
 projects/CMakeLists.txt                  |  3 +++
 projects/patches/unuran-1.8.0-root.patch | 11 +++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 projects/patches/unuran-1.8.0-root.patch

diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt
index 16f54cdfa4..d7c09f064e 100644
--- a/projects/CMakeLists.txt
+++ b/projects/CMakeLists.txt
@@ -172,6 +172,9 @@ if(ROOT_native_version)
                  IF LCG_TARGET MATCHES mac13 THEN
                    -D CLING_CXX_HEADERS=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
                  ENDIF
+                 BUILD_COMMAND echo "ROOT Build Step" 
+                 COMMAND patch -l -p0 -b -i ${CMAKE_CURRENT_SOURCE_DIR}/patches/unuran-1.8.0-root.patch
+                 COMMAND ${MAKE}
       DEPENDS Python fftw GSL xrootd numpy tbb blas zlib libxml2 vdt xz gl2ps cfitsio
               IF DEFINED mysql_native_version AND ${ROOT_version} VERSION_LESS 6.34 THEN
                   mysql
diff --git a/projects/patches/unuran-1.8.0-root.patch b/projects/patches/unuran-1.8.0-root.patch
new file mode 100644
index 0000000000..afed4819c7
--- /dev/null
+++ b/projects/patches/unuran-1.8.0-root.patch
@@ -0,0 +1,11 @@
+--- math/unuran/unuran-1.8.0-root/src/methods/pinv.c.orig	2025-04-28 19:35:55.636396517 +0200
++++ math/unuran/unuran-1.8.0-root/src/methods/pinv.c	2025-04-28 19:36:40.540877173 +0200
+@@ -76,7 +76,7 @@
+ 					  double *xval, int use_linear);
+ static int _unur_pinv_newton_testpoints (double *utest, double ui[], int order);
+ static int _unur_pinv_linear_testpoints (double *utest, double *ui, int order);
+-static int _unur_pinv_cubic_hermite_is_monotone();
++static int _unur_pinv_cubic_hermite_is_monotone(struct unur_gen *gen, double *ui, double *zi, double *xval);
+ static int _unur_pinv_interval( struct unur_gen *gen, int i, double x, double cdfx );
+ static int _unur_pinv_lastinterval( struct unur_gen *gen );
+ #ifdef UNUR_ENABLE_LOGGING
-- 
GitLab