pythonPackages.geant4: init at 10.6.2

Starting geant4 10.6.2 g4py can not be built separately
http://geant4-data.web.cern.ch/geant4-data/ReleaseNotes/Patch4.10.6-2.txt

Also, it appears that g4py itself is now deprecated, it was moved
to environments/g4py/tests/g4pytest in the source distribution.  The only
remaining imported module is Geant4, hence python package name
`pythonPackages.geant4`, the capitalization matches the one of the non-python
attribute.
This commit is contained in:
Dmitry Kalinkin
2020-06-06 14:53:54 -04:00
parent dfbc6b3a26
commit 6fa6decded
6 changed files with 30 additions and 69 deletions
@@ -5,6 +5,7 @@
, enableQT ? false
, enableXM ? false
, enableOpenGLX11 ? true
, enablePython ? false
, enableRaytracerX11 ? false
# Standard build environment with cmake.
@@ -33,8 +34,16 @@
, libGLU, libGL
, xlibsWrapper
, libXmu
# For enablePython
, boost
, python3
}:
let
boost_python = boost.override { enablePython = true; python = python3; };
in
stdenv.mkDerivation rec {
version = "10.6.2";
pname = "geant4";
@@ -44,6 +53,16 @@ stdenv.mkDerivation rec {
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 ]