Skip to content

Commit

Permalink
geant4: patch old versions to work on new compiler/ubuntu (spack#43212)
Browse files Browse the repository at this point in the history
* geant4: patch old version for %clang@15

* Backport ascii-V10-07-03

* Apply to all compilers, but only for 10.5-10.6
  • Loading branch information
sethrj authored Mar 15, 2024
1 parent b938828 commit 968ad02
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
98 changes: 98 additions & 0 deletions var/spack/repos/builtin/packages/geant4/geant4-10.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
From b19a720a77d6661662f5dd440d9bb7fb6dadd9fb Mon Sep 17 00:00:00 2001
From: Seth R Johnson <[email protected]>
Date: Wed, 13 Mar 2024 14:43:37 -0400
Subject: [PATCH] Backport ascii-V10-07-03

---
.../persistency/ascii/src/G4tgrEvaluator.cc | 72 +++++++++----------
1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/source/persistency/ascii/src/G4tgrEvaluator.cc b/source/persistency/ascii/src/G4tgrEvaluator.cc
index 9447ede9910..f20f3ca3404 100644
--- a/source/persistency/ascii/src/G4tgrEvaluator.cc
+++ b/source/persistency/ascii/src/G4tgrEvaluator.cc
@@ -63,45 +63,45 @@ void G4tgrEvaluator::print_error( G4int estatus ) const
}
}

-G4double fsin( G4double arg ){ return std::sin(arg); }
-G4double fcos( G4double arg ){ return std::cos(arg); }
-G4double ftan( G4double arg ){ return std::tan(arg); }
-G4double fasin( G4double arg ){ return std::asin(arg); }
-G4double facos( G4double arg ){ return std::acos(arg); }
-G4double fatan( G4double arg ){ return std::atan(arg); }
-G4double fatan2( G4double arg1, G4double arg2 ){ return std::atan2(arg1,arg2); }
-G4double fsinh( G4double arg ){ return std::sinh(arg); }
-G4double fcosh( G4double arg ){ return std::cosh(arg); }
-G4double ftanh( G4double arg ){ return std::tanh(arg); }
-// G4double fasinh( G4double arg ){ return std::asinh(arg); }
-// G4double facosh( G4double arg ){ return std::acosh(arg); }
-// G4double fatanh( G4double arg ){ return std::atanh(arg); }
-G4double fsqrt( G4double arg ){ return std::sqrt(arg); }
-G4double fexp( G4double arg ){ return std::exp(arg); }
-G4double flog( G4double arg ){ return std::log(arg); }
-G4double flog10( G4double arg ){ return std::log10(arg); }
-G4double fpow( G4double arg1, G4double arg2 ){ return std::pow(arg1,arg2); }
+G4double fltsin( G4double arg ){ return std::sin(arg); }
+G4double fltcos( G4double arg ){ return std::cos(arg); }
+G4double flttan( G4double arg ){ return std::tan(arg); }
+G4double fltasin( G4double arg ){ return std::asin(arg); }
+G4double fltacos( G4double arg ){ return std::acos(arg); }
+G4double fltatan( G4double arg ){ return std::atan(arg); }
+G4double fltatan2( G4double arg1, G4double arg2 ){ return std::atan2(arg1,arg2); }
+G4double fltsinh( G4double arg ){ return std::sinh(arg); }
+G4double fltcosh( G4double arg ){ return std::cosh(arg); }
+G4double flttanh( G4double arg ){ return std::tanh(arg); }
+// G4double fltasinh( G4double arg ){ return std::asinh(arg); }
+// G4double fltacosh( G4double arg ){ return std::acosh(arg); }
+// G4double fltatanh( G4double arg ){ return std::atanh(arg); }
+G4double fltsqrt( G4double arg ){ return std::sqrt(arg); }
+G4double fltexp( G4double arg ){ return std::exp(arg); }
+G4double fltlog( G4double arg ){ return std::log(arg); }
+G4double fltlog10( G4double arg ){ return std::log10(arg); }
+G4double fltpow( G4double arg1, G4double arg2 ){ return std::pow(arg1,arg2); }


//--------------------------------------------------------------------
void G4tgrEvaluator::AddCommonFunctions()
{
- setFunction("sin", (*fsin));
- setFunction("cos", (*fcos));
- setFunction("tan", (*ftan));
- setFunction("asin", (*fasin));
- setFunction("acos", (*facos));
- setFunction("atan", (*fatan));
- setFunction("atan2", (*fatan2));
- setFunction("sinh", (*fsinh));
- setFunction("cosh", (*fcosh));
- setFunction("tanh", (*ftanh));
-// setFunction("asinh", (*fasinh));
-// setFunction("acosh", (*facosh));
-// setFunction("atanh", (*fatanh));
- setFunction("sqrt", (*fsqrt));
- setFunction("exp", (*fexp));
- setFunction("log", (*flog));
- setFunction("log10", (*flog10));
- setFunction("pow", (*fpow));
+ setFunction("sin", (*fltsin));
+ setFunction("cos", (*fltcos));
+ setFunction("tan", (*flttan));
+ setFunction("asin", (*fltasin));
+ setFunction("acos", (*fltacos));
+ setFunction("atan", (*fltatan));
+ setFunction("atan2", (*fltatan2));
+ setFunction("sinh", (*fltsinh));
+ setFunction("cosh", (*fltcosh));
+ setFunction("tanh", (*flttanh));
+// setFunction("asinh", (*fltasinh));
+// setFunction("acosh", (*fltacosh));
+// setFunction("atanh", (*fltatanh));
+ setFunction("sqrt", (*fltsqrt));
+ setFunction("exp", (*fltexp));
+ setFunction("log", (*fltlog));
+ setFunction("log10", (*fltlog10));
+ setFunction("pow", (*fltpow));
}
--
2.43.0

3 changes: 3 additions & 0 deletions var/spack/repos/builtin/packages/geant4/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def std_when(values):
# As released, 10.03.03 has issues with respect to using external
# CLHEP.
patch("CLHEP-10.03.03.patch", level=1, when="@10.3")
# Build failure on clang 15, ubuntu 22: see Geant4 problem report #2444
# fixed by ascii-V10-07-03
patch("geant4-10.6.patch", level=1, when="@10.5:10.6")
# These patches can be applied independent of the cxxstd value?
patch("cxx17.patch", when="@10.3 cxxstd=17")
patch("cxx17_geant4_10_0.patch", level=1, when="@10.4.0 cxxstd=17")
Expand Down

0 comments on commit 968ad02

Please sign in to comment.