Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Geant4] Bump to latest version #10218

Merged
merged 10 commits into from
Jan 8, 2025
19 changes: 12 additions & 7 deletions G/Geant4/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
using BinaryBuilder

name = "Geant4"
version = v"11.2.1"
version = v"11.3.0"

# Collection of sources required to build
sources = [
ArchiveSource("https://gitlab.cern.ch/geant4/geant4/-/archive/v$(version)/geant4-v$(version).tar.gz",
"76c9093b01128ee2b45a6f4020a1bcb64d2a8141386dea4674b5ae28bcd23293"),
"d9d71daff8890a7b5e0e33ea9a65fe6308ad6713000b43ba6705af77078e7ead"),
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz",
"2408d07df7f324d3beea818585a6d990ba99587c218a3969f924dfcc4de93b62"),
DirectorySource("./bundled")
Expand All @@ -35,7 +35,10 @@ fi
mkdir build && cd build
FLAGS=()
if [[ "${target}" != *-w64-* && "${target}" != *-apple-* ]]; then
FLAGS=(-DGEANT4_USE_OPENGL_X11=ON)
FLAGS+=(-DGEANT4_USE_OPENGL_X11=ON)
fi
if [[ "${target}" == *-apple-* ]]; then
FLAGS+=(-DGEANT4_USE_SYSTEM_ZLIB=ON)
fi
if [[ "${target}" == *-w64-* ]]; then
FLAGS+=(-DGEANT4_BUILD_MULTITHREADED=OFF)
Expand All @@ -58,8 +61,11 @@ install_license ../LICENSE
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())
platforms = filter(p -> libc(p) != "musl" && os(p) != "freebsd" && arch(p) != "armv6l" && arch(p) != "i686", platforms)

platforms = filter(p -> libc(p) != "musl" &&
os(p) != "freebsd" &&
arch(p) != "armv6l" &&
arch(p) != "i686" &&
arch(p) != "riscv64", platforms)

# The products that we will ensure are always built
products = [
Expand All @@ -73,7 +79,6 @@ products = [
LibraryProduct("libG4GMocren", :libG4Mocren),
LibraryProduct("libG4particles", :libG4Particles),
LibraryProduct("libG4graphics_reps", :libG4Graphics),
LibraryProduct("libG4zlib", :libG4Zlib),
LibraryProduct("libG4geometry", :libG4Geometry),
LibraryProduct("libG4modeling", :libG4Modeling),
LibraryProduct("libG4interfaces", :libG4Interfaces),
Expand Down Expand Up @@ -101,7 +106,7 @@ products = [

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("Expat_jll"; compat="2.4.8"),
Dependency("Expat_jll"; compat="2.6.4"),
Dependency("Xorg_libXmu_jll"),
Dependency("Libglvnd_jll"),
Dependency("Xerces_jll"),
Expand Down
199 changes: 67 additions & 132 deletions G/Geant4/bundled/patches/windows.patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like this patch should be upstreamed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes of course.

Original file line number Diff line number Diff line change
@@ -1,140 +1,75 @@
diff --git a/source/externals/ptl/src/Threading.cc b/source/externals/ptl/src/Threading.cc
index 324d6c12d7..a7553d8db2 100644
--- a/source/externals/ptl/src/Threading.cc
+++ b/source/externals/ptl/src/Threading.cc
@@ -27,7 +27,7 @@
#include "PTL/Utility.hh"

#if defined(PTL_WINDOWS)
-# include <Windows.h>
+# include <windows.h>
#endif

#if defined(PTL_MACOS)
diff --git a/source/global/management/src/G4FindDataDir.cc b/source/global/management/src/G4FindDataDir.cc
index 8c80180f71..7c5a6e0158 100644
--- a/source/global/management/src/G4FindDataDir.cc
+++ b/source/global/management/src/G4FindDataDir.cc
@@ -34,7 +34,7 @@
#include <cstdlib>
#include <cstring>

-#if defined(_MSC_VER)
+#if defined(_WIN32)
#define setenv(name, value, overwrite) _putenv_s(name, value)
#endif

diff --git a/source/global/management/src/G4Threading.cc b/source/global/management/src/G4Threading.cc
index 3c6bd77b14..d793a7abff 100644
--- a/source/global/management/src/G4Threading.cc
+++ b/source/global/management/src/G4Threading.cc
@@ -34,8 +34,8 @@
#include "G4AutoLock.hh"
#include "globals.hh"

-#if defined(WIN32) || defined(__MINGW32__)
-# include <Windows.h>
+#if defined(_WIN32)
+# include <windows.h>
diff --git a/source/global/management/include/G4SliceTimer.hh b/source/global/management/include/G4SliceTimer.hh
index fca9b3eb369..04c2d739267 100644
--- a/source/global/management/include/G4SliceTimer.hh
+++ b/source/global/management/include/G4SliceTimer.hh
@@ -39,7 +39,7 @@
#ifndef G4SLICE_TIMER_HH
#define G4SLICE_TIMER_HH 1

-#if !(defined(WIN32) || defined(__MINGW32__))
+#if !defined(_WIN32)
# include <sys/times.h>
# include <unistd.h>
#else
# include <sys/syscall.h>
# include <sys/types.h>
diff --git a/source/processes/electromagnetic/dna/utils/include/G4MoleculeGun.hh b/source/processes/electromagnetic/dna/utils/include/G4MoleculeGun.hh
index ef764260ac..54f9a8a17f 100644
--- a/source/processes/electromagnetic/dna/utils/include/G4MoleculeGun.hh
+++ b/source/processes/electromagnetic/dna/utils/include/G4MoleculeGun.hh
@@ -110,6 +110,8 @@ protected:
void ShootAtFixedPosition(G4MoleculeGun*){}
};

+template<> void TG4MoleculeShoot<G4Track>::Shoot(G4MoleculeGun* gun);
+
template<typename TYPE>
G4shared_ptr<G4MoleculeShoot> G4MoleculeShoot::ChangeType()
@@ -49,7 +49,7 @@
extern "C"
{
diff --git a/source/processes/hadronic/models/lend/include/MCGIDI.h b/source/processes/hadronic/models/lend/include/MCGIDI.h
index e11303d2f4..3e4fa17887 100644
--- a/source/processes/hadronic/models/lend/include/MCGIDI.h
+++ b/source/processes/hadronic/models/lend/include/MCGIDI.h
@@ -9,7 +9,7 @@
#define MCGIDI_VERSION_MINOR 0
#define MCGIDI_VERSION_PATCHLEVEL 0

-#ifdef WIN32
+#ifdef _WIN32
#define M_PI 3.141592653589793238463
#endif

diff --git a/source/processes/hadronic/models/lend/include/nf_specialFunctions.h b/source/processes/hadronic/models/lend/include/nf_specialFunctions.h
index 4321f47a59..4868a156da 100644
--- a/source/processes/hadronic/models/lend/include/nf_specialFunctions.h
+++ b/source/processes/hadronic/models/lend/include/nf_specialFunctions.h
@@ -6,15 +6,12 @@
#ifndef specialFunctions_h_included
#define specialFunctions_h_included

+#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
int sysconf(int);
-};
+}

// Structure returned by times()
//
@@ -64,7 +64,7 @@ struct tms
extern "C"
{
extern clock_t times(struct tms*);
-};
+}
#endif /* WIN32 */

#include "G4Types.hh"
diff --git a/source/global/management/include/G4Timer.hh b/source/global/management/include/G4Timer.hh
index 022e3557df8..b0d8a358956 100644
--- a/source/global/management/include/G4Timer.hh
+++ b/source/global/management/include/G4Timer.hh
@@ -72,7 +72,7 @@
#ifndef G4TIMER_HH
#define G4TIMER_HH 1

-#if !(defined(WIN32) || defined(__MINGW32__))
+#if !defined(_WIN32)
# include <sys/times.h>
# include <unistd.h>
#else
@@ -82,7 +82,7 @@
extern "C"
{
int sysconf(int);
-};
+}

#include "nf_utilities.h"
// Structure returned by times()

-#ifdef WIN32
-#define M_PI 3.141592653589793238463
-#endif
-
#if defined __cplusplus
extern "C" {
namespace GIDI {
diff --git a/source/processes/hadronic/models/lend/src/MCGIDI_energy.cc b/source/processes/hadronic/models/lend/src/MCGIDI_energy.cc
index 65644c9727..d94d42eb78 100644
--- a/source/processes/hadronic/models/lend/src/MCGIDI_energy.cc
+++ b/source/processes/hadronic/models/lend/src/MCGIDI_energy.cc
@@ -5,7 +5,7 @@
#include <string.h>
#include <cmath>
@@ -97,7 +97,7 @@ struct tms
extern "C"
{
extern clock_t times(struct tms*);
-};
+}
#endif /* WIN32 */

#include "G4Types.hh"
diff --git a/source/global/management/src/G4Timer.cc b/source/global/management/src/G4Timer.cc
index 461d0141a0a..d45631602e6 100644
--- a/source/global/management/src/G4Timer.cc
+++ b/source/global/management/src/G4Timer.cc
@@ -41,7 +41,7 @@
# endif
#endif

-#ifdef WIN32
+#ifdef _WIN32
#define M_PI 3.141592653589793238463
#endif

diff --git a/source/processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc b/source/processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc
index d22caeb84d..86a3fbccef 100644
--- a/source/processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc
+++ b/source/processes/hadronic/models/lend/src/MCGIDI_outputChannel.cc
@@ -2,6 +2,7 @@
# <<BEGIN-copyright>>
# <<END-copyright>>
*/
+#define _USE_MATH_DEFINES
#include <string.h>
#include <cmath>

diff --git a/source/processes/hadronic/models/lend/src/nf_angularMomentumCoupling.cc b/source/processes/hadronic/models/lend/src/nf_angularMomentumCoupling.cc
index ce8946de18..bc59181626 100644
--- a/source/processes/hadronic/models/lend/src/nf_angularMomentumCoupling.cc
+++ b/source/processes/hadronic/models/lend/src/nf_angularMomentumCoupling.cc
@@ -54,6 +54,7 @@
*/

#include <stdlib.h>
+#define _USE_MATH_DEFINES
#include <cmath>

#include "nf_specialFunctions.h"
diff --git a/source/processes/hadronic/models/lend/src/xDataTOM_importXML.cc b/source/processes/hadronic/models/lend/src/xDataTOM_importXML.cc
index afa8a06987..07245f1a2c 100644
--- a/source/processes/hadronic/models/lend/src/xDataTOM_importXML.cc
+++ b/source/processes/hadronic/models/lend/src/xDataTOM_importXML.cc
@@ -11,8 +11,8 @@
#include <fcntl.h>
#include <errno.h>
# include <sys/types.h>
# include <windows.h>

-#if defined(WIN32) || defined(__MINGW32__)
-#include <BaseTsd.h>
+#if defined(_WIN32)
+#include <basetsd.h>
#include <io.h>
#include <windows.h>
#define realpath( a, b ) GetFullPathName( a, PATH_MAX, b, NULL )