Merge pull request #46019 from veprbl/pr/geant4_overhaul
geant4 overhaul
This commit is contained in:
commit
a60e79425b
@ -1,128 +1,101 @@
|
||||
{ enableMultiThreading ? false
|
||||
{ enableMultiThreading ? true
|
||||
, enableG3toG4 ? false
|
||||
, enableInventor ? false
|
||||
, enableGDML ? false
|
||||
, enableQT ? false
|
||||
, enableXM ? false
|
||||
, enableOpenGLX11 ? false
|
||||
, enableOpenGLX11 ? true
|
||||
, enableRaytracerX11 ? false
|
||||
|
||||
# Standard build environment with cmake.
|
||||
, stdenv, fetchurl, cmake
|
||||
|
||||
# Optional system packages, otherwise internal GEANT4 packages are used.
|
||||
, clhep ? null
|
||||
, expat ? null
|
||||
, zlib ? null
|
||||
, clhep ? null # not packaged currently
|
||||
, expat
|
||||
, zlib
|
||||
|
||||
# For enableGDML.
|
||||
, xercesc ? null
|
||||
, xercesc
|
||||
|
||||
# For enableQT.
|
||||
, qt ? null # qt4SDK or qt5SDK
|
||||
, qtbase
|
||||
|
||||
# For enableXM.
|
||||
, motif ? null # motif or lesstif
|
||||
, motif
|
||||
|
||||
# For enableInventor
|
||||
, coin3d
|
||||
, soxt
|
||||
, libXpm ? null
|
||||
, libXpm
|
||||
|
||||
# For enableQT, enableXM, enableOpenGLX11, enableRaytracerX11.
|
||||
, libGLU_combined ? null
|
||||
, xlibsWrapper ? null
|
||||
, libXmu ? null
|
||||
, libGLU_combined
|
||||
, xlibsWrapper
|
||||
, libXmu
|
||||
}:
|
||||
|
||||
# G4persistency library with support for GDML
|
||||
assert enableGDML -> xercesc != null;
|
||||
stdenv.mkDerivation rec {
|
||||
version = "10.4.1";
|
||||
name = "geant4-${version}";
|
||||
|
||||
# If enableQT, Qt4/5 User Interface and Visualization drivers.
|
||||
assert enableQT -> qt != null;
|
||||
|
||||
# Motif User Interface and Visualisation drivers.
|
||||
assert enableXM -> motif != null;
|
||||
|
||||
# OpenGL/X11 User Interface and Visualisation drivers.
|
||||
assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> libGLU_combined != null;
|
||||
assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> xlibsWrapper != null;
|
||||
assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> libXmu != null;
|
||||
assert enableInventor -> libXpm != null;
|
||||
|
||||
let
|
||||
buildGeant4 =
|
||||
{ version, src, multiThreadingCapable ? false }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit version src;
|
||||
name = "geant4-${version}";
|
||||
|
||||
multiThreadingFlag = if multiThreadingCapable then "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}" else "";
|
||||
|
||||
cmakeFlags = ''
|
||||
${multiThreadingFlag}
|
||||
-DGEANT4_INSTALL_DATA=OFF
|
||||
-DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"}
|
||||
-DGEANT4_USE_G3TOG4=${if enableG3toG4 then "ON" else "OFF"}
|
||||
-DGEANT4_USE_QT=${if enableQT then "ON" else "OFF"}
|
||||
-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_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"}
|
||||
-DINVENTOR_INCLUDE_DIR=${coin3d}/include
|
||||
-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
buildInputs = [ cmake clhep expat zlib xercesc qt motif libGLU_combined xlibsWrapper libXmu libXpm coin3d soxt ];
|
||||
propagatedBuildInputs = [ clhep expat zlib xercesc qt motif libGLU_combined xlibsWrapper libXmu libXpm coin3d soxt ];
|
||||
|
||||
postFixup = ''
|
||||
# Don't try to export invalid environment variables.
|
||||
sed -i 's/export G4\([A-Z]*\)DATA/#export G4\1DATA/' "$out"/bin/geant4.sh
|
||||
'';
|
||||
|
||||
setupHook = ./geant4-hook.sh;
|
||||
|
||||
passthru = {
|
||||
data = import ./datasets.nix { inherit stdenv fetchurl; };
|
||||
};
|
||||
|
||||
# Set the myriad of envars required by Geant4 if we use a nix-shell.
|
||||
shellHook = ''
|
||||
source $out/nix-support/setup-hook
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A toolkit for the simulation of the passage of particles through matter";
|
||||
longDescription = ''
|
||||
Geant4 is a toolkit for the simulation of the passage of particles through matter.
|
||||
Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.
|
||||
The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
|
||||
'';
|
||||
homepage = http://www.geant4.org;
|
||||
license = licenses.g4sl;
|
||||
maintainers = with maintainers; [ tmplt ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
|
||||
fetchGeant4 = import ./fetch.nix {
|
||||
inherit stdenv fetchurl;
|
||||
src = fetchurl{
|
||||
url = "http://cern.ch/geant4-data/releases/geant4.10.04.p01.tar.gz";
|
||||
sha256 = "a3eb13e4f1217737b842d3869dc5b1fb978f761113e74bd4eaf6017307d234dd";
|
||||
};
|
||||
|
||||
in {
|
||||
v10_0_2 = buildGeant4 {
|
||||
inherit (fetchGeant4.v10_0_2) version src;
|
||||
multiThreadingCapable = true;
|
||||
cmakeFlags = [
|
||||
"-DGEANT4_INSTALL_DATA=OFF"
|
||||
"-DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"}"
|
||||
"-DGEANT4_USE_G3TOG4=${if enableG3toG4 then "ON" else "OFF"}"
|
||||
"-DGEANT4_USE_QT=${if enableQT then "ON" else "OFF"}"
|
||||
"-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_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 enableInventor [
|
||||
"-DINVENTOR_INCLUDE_DIR=${coin3d}/include"
|
||||
"-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ clhep expat zlib libGLU_combined xlibsWrapper libXmu ]
|
||||
++ stdenv.lib.optionals enableGDML [ xercesc ]
|
||||
++ stdenv.lib.optionals enableXM [ motif ]
|
||||
++ stdenv.lib.optionals enableQT [ qtbase ]
|
||||
++ stdenv.lib.optionals enableInventor [ libXpm coin3d soxt ];
|
||||
|
||||
postFixup = ''
|
||||
# Don't try to export invalid environment variables.
|
||||
sed -i 's/export G4\([A-Z]*\)DATA/#export G4\1DATA/' "$out"/bin/geant4.sh
|
||||
'';
|
||||
|
||||
setupHook = ./geant4-hook.sh;
|
||||
|
||||
passthru = {
|
||||
data = import ./datasets.nix { inherit stdenv fetchurl; };
|
||||
};
|
||||
|
||||
v10_4_1 = buildGeant4 {
|
||||
inherit (fetchGeant4.v10_4_1) version src;
|
||||
multiThreadingCapable = true;
|
||||
# Set the myriad of envars required by Geant4 if we use a nix-shell.
|
||||
shellHook = ''
|
||||
source $out/nix-support/setup-hook
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A toolkit for the simulation of the passage of particles through matter";
|
||||
longDescription = ''
|
||||
Geant4 is a toolkit for the simulation of the passage of particles through matter.
|
||||
Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.
|
||||
The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
|
||||
'';
|
||||
homepage = http://www.geant4.org;
|
||||
license = licenses.g4sl;
|
||||
maintainers = with maintainers; [ tmplt ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
{ stdenv, fetchurl }:
|
||||
|
||||
let
|
||||
fetch = { version, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null }:
|
||||
{
|
||||
inherit version src;
|
||||
};
|
||||
|
||||
in {
|
||||
v10_0_2 = fetch {
|
||||
version = "10.0.2";
|
||||
|
||||
src = fetchurl{
|
||||
url = "http://geant4.cern.ch/support/source/geant4.10.00.p02.tar.gz";
|
||||
sha256 = "9d615200901f1a5760970e8f5970625ea146253e4f7c5ad9df2a9cf84549e848";
|
||||
};
|
||||
};
|
||||
|
||||
v10_4_1 = fetch {
|
||||
version = "10.4.1";
|
||||
|
||||
src = fetchurl{
|
||||
url = "http://cern.ch/geant4-data/releases/geant4.10.04.p01.tar.gz";
|
||||
sha256 = "a3eb13e4f1217737b842d3869dc5b1fb978f761113e74bd4eaf6017307d234dd";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
--- environments/g4py/configure 2014-03-17 22:47:05.000000000 +1100
|
||||
+++ environments/g4py/configure 2014-09-01 15:33:46.523637686 +1000
|
||||
@@ -4,9 +4,6 @@
|
||||
# ======================================================================
|
||||
export LANG=C
|
||||
|
||||
-PATH=/bin:/usr/bin
|
||||
-export PATH
|
||||
-
|
||||
# ======================================================================
|
||||
# testing the echo features
|
||||
# ======================================================================
|
@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl
|
||||
{ stdenv, fetchurl, cmake, xercesc
|
||||
|
||||
# The target version of Geant4
|
||||
, geant4
|
||||
@ -9,66 +9,55 @@
|
||||
}:
|
||||
|
||||
let
|
||||
buildG4py =
|
||||
{ version, src, geant4}:
|
||||
# g4py does not support MT and will fail to build against MT geant
|
||||
geant4_nomt = geant4.override { enableMultiThreading = false; };
|
||||
boost_python = boost.override { enablePython = true; inherit python; };
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit version src geant4;
|
||||
name = "g4py-${version}";
|
||||
stdenv.mkDerivation rec {
|
||||
inherit (geant4_nomt) version src;
|
||||
name = "g4py-${version}";
|
||||
|
||||
# ./configure overwrites $PATH, which clobbers everything.
|
||||
patches = [ ./configure.patch ];
|
||||
patchFlags = "-p0";
|
||||
sourceRoot = "geant4.10.04.p01/environments/g4py";
|
||||
|
||||
configurePhase = ''
|
||||
export PYTHONPATH=$PYTHONPATH:${geant4}/lib64:$prefix
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ geant4_nomt xercesc boost_python python ];
|
||||
|
||||
source ${geant4}/share/Geant4-*/geant4make/geant4make.sh
|
||||
cd environments/g4py
|
||||
GEANT4_INSTALL = geant4_nomt;
|
||||
|
||||
./configure linux64 --prefix=$prefix \
|
||||
--with-g4install-dir=${geant4} \
|
||||
--with-python-incdir=${python}/include/python${python.majorVersion} \
|
||||
--with-python-libdir=${python}/lib \
|
||||
--with-boost-incdir=${boost.dev}/include \
|
||||
--with-boost-libdir=${boost.out}/lib
|
||||
'';
|
||||
preConfigure = ''
|
||||
# Fix for boost 1.67+
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace "find_package(Boost)" "find_package(Boost 1.40 REQUIRED COMPONENTS python${builtins.replaceStrings ["."] [""] python.majorVersion})"
|
||||
for f in `find . -name CMakeLists.txt`; do
|
||||
substituteInPlace "$f" \
|
||||
--replace "boost_python" "\''${Boost_LIBRARIES}"
|
||||
done
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
buildInputs = [ geant4 boost python ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
# Make sure we set PYTHONPATH
|
||||
shellHook = ''
|
||||
source $out/nix-support/setup-hook
|
||||
'';
|
||||
# Make sure we set PYTHONPATH
|
||||
shellHook = ''
|
||||
source $out/nix-support/setup-hook
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Python bindings and utilities for Geant4";
|
||||
longDescription = ''
|
||||
Geant4 is a toolkit for the simulation of the passage of particles
|
||||
through matter. Its areas of application include high energy,
|
||||
nuclear and accelerator physics, as well as studies in medical and
|
||||
space science. The two main reference papers for Geant4 are
|
||||
published in Nuclear Instruments and Methods in Physics Research A
|
||||
506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1
|
||||
(2006) 270-278.
|
||||
'';
|
||||
homepage = http://www.geant4.org;
|
||||
license = stdenv.lib.licenses.g4sl;
|
||||
maintainers = [ ];
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
};
|
||||
};
|
||||
|
||||
fetchGeant4 = import ../fetch.nix {
|
||||
inherit stdenv fetchurl;
|
||||
};
|
||||
|
||||
in {
|
||||
v10_0_2 = buildG4py {
|
||||
inherit (fetchGeant4.v10_0_2) version src;
|
||||
geant4 = geant4.v10_0_2;
|
||||
meta = {
|
||||
description = "Python bindings and utilities for Geant4";
|
||||
longDescription = ''
|
||||
Geant4 is a toolkit for the simulation of the passage of particles
|
||||
through matter. Its areas of application include high energy,
|
||||
nuclear and accelerator physics, as well as studies in medical and
|
||||
space science. The two main reference papers for Geant4 are
|
||||
published in Nuclear Instruments and Methods in Physics Research A
|
||||
506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1
|
||||
(2006) 270-278.
|
||||
'';
|
||||
homepage = http://www.geant4.org;
|
||||
license = stdenv.lib.licenses.g4sl;
|
||||
maintainers = [ ];
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
@ -21297,29 +21297,7 @@ with pkgs;
|
||||
|
||||
fastnlo = callPackage ../development/libraries/physics/fastnlo { };
|
||||
|
||||
geant4 = callPackage ../development/libraries/physics/geant4 {
|
||||
enableMultiThreading = true;
|
||||
enableG3toG4 = false;
|
||||
enableInventor = false;
|
||||
enableGDML = false;
|
||||
enableQT = false;
|
||||
enableXM = false;
|
||||
enableOpenGLX11 = true;
|
||||
enableRaytracerX11 = false;
|
||||
|
||||
# Optional system packages, otherwise internal GEANT4 packages are used.
|
||||
clhep = null;
|
||||
zlib = null;
|
||||
|
||||
# For enableGDML.
|
||||
xercesc = null;
|
||||
|
||||
# For enableQT.
|
||||
qt = null; # qt4SDK or qt5SDK
|
||||
|
||||
# For enableXM.
|
||||
motif = null; # motif or lesstif
|
||||
};
|
||||
geant4 = libsForQt5.callPackage ../development/libraries/physics/geant4 { };
|
||||
|
||||
cernlib = callPackage ../development/libraries/physics/cernlib { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user