about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-07-13 23:20:04 +0000
committerAlyssa Ross <hi@alyssa.is>2020-07-13 23:21:06 +0000
commita42c1d6d62656dcf9bd85de620f2e200a5ad22d8 (patch)
tree7d481fea9872f62a034452612be17f4494159baa /nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
parent55f69a6b0e53c1c4b3e0396937c53bf5662b5519 (diff)
parent9480bae337095fd24f61380bce3174fdfe926a00 (diff)
downloadnixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar
nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.gz
nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.bz2
nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.lz
nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.xz
nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.zst
nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.zip
Merge commit '9480bae337095fd24f61380bce3174fdfe926a00'
This is the last nixos-unstable release before 13b2903169f, which I'm a
bit nervous about.  So I want the update including that one to be as
small as possible, hence going to this one first.
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/physics/geant4/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/default.nix31
1 files changed, 27 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix b/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
index 8c7ff230e011..97822d769dd5 100644
--- a/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
@@ -5,6 +5,7 @@
 , enableQT             ? false
 , enableXM             ? false
 , enableOpenGLX11      ? true
+, enablePython         ? false
 , enableRaytracerX11   ? false
 
 # Standard build environment with cmake.
@@ -33,17 +34,35 @@
 , libGLU, libGL
 , xlibsWrapper
 , libXmu
+
+# For enablePython
+, boost
+, python3
 }:
 
+let
+  boost_python = boost.override { enablePython = true; python = python3; };
+in
+
 stdenv.mkDerivation rec {
-  version = "10.6.1";
+  version = "10.6.2";
   pname = "geant4";
 
   src = fetchurl{
-    url = "https://geant4-data.web.cern.ch/geant4-data/releases/geant4.10.06.p01.tar.gz";
-    sha256 = "0ssxg7dd7vxljb3fdyb0llg7gsxack21qjfsb3n23k107a19yibk";
+    url = "https://geant4-data.web.cern.ch/geant4-data/releases/geant4.10.06.p02.tar.gz";
+    sha256 = "0vznm3pjlbihjy1wsxc4gj229k0dzc283wvil2xghyl08vwdpnpc";
   };
 
+  boost_python_lib = "python${builtins.replaceStrings ["."] [""] python3.pythonVersion}";
+  postPatch = ''
+    # Fix for boost 1.67+
+    substituteInPlace environments/g4py/CMakeLists.txt \
+      --replace "find_package(Boost REQUIRED python)" \
+                "find_package(Boost REQUIRED COMPONENTS $boost_python_lib)"
+    substituteInPlace environments/g4py/G4PythonHelpers.cmake \
+      --replace "Boost::python" "Boost::$boost_python_lib"
+  '';
+
   cmakeFlags = [
     "-DGEANT4_INSTALL_DATA=OFF"
     "-DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"}"
@@ -52,11 +71,14 @@ stdenv.mkDerivation rec {
     "-DGEANT4_USE_XM=${if enableXM then "ON" else "OFF"}"
     "-DGEANT4_USE_OPENGL_X11=${if enableOpenGLX11 then "ON" else "OFF"}"
     "-DGEANT4_USE_INVENTOR=${if enableInventor then "ON" else "OFF"}"
+    "-DGEANT4_USE_PYTHON=${if enablePython then "ON" else "OFF"}"
     "-DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"}"
     "-DGEANT4_USE_SYSTEM_CLHEP=${if clhep != null then "ON" else "OFF"}"
     "-DGEANT4_USE_SYSTEM_EXPAT=${if expat != null then "ON" else "OFF"}"
     "-DGEANT4_USE_SYSTEM_ZLIB=${if zlib != null then "ON" else "OFF"}"
     "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}"
+  ] ++ stdenv.lib.optionals (enableMultiThreading && enablePython) [
+    "-DGEANT4_BUILD_TLS_MODEL=global-dynamic"
   ] ++ stdenv.lib.optionals enableInventor [
     "-DINVENTOR_INCLUDE_DIR=${coin3d}/include"
     "-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so"
@@ -66,7 +88,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs =  [ cmake ];
 
   buildInputs = [ libGLU xlibsWrapper libXmu ]
-    ++ stdenv.lib.optionals enableInventor [ libXpm coin3d soxt motif ];
+    ++ stdenv.lib.optionals enableInventor [ libXpm coin3d soxt motif ]
+    ++ stdenv.lib.optionals enablePython [ boost_python python3 ];
 
   propagatedBuildInputs = [ clhep expat zlib libGL ]
     ++ stdenv.lib.optionals enableGDML [ xercesc ]