mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
geant4: v10.0.2 -> v10.4.1, define datasets seperately, add deps for enableInventor
By seperating the datasets, geant4 now builds in a sandbox. Resolves #39766
This commit is contained in:
parent
3eabf15f9b
commit
024efc9509
@ -3726,6 +3726,11 @@
|
||||
github = "titanous";
|
||||
name = "Jonathan Rudenberg";
|
||||
};
|
||||
tmplt = {
|
||||
email = "tmplt@dragons.rocks";
|
||||
github = "tmplt";
|
||||
name = "Viktor";
|
||||
};
|
||||
tnias = {
|
||||
email = "phil@grmr.de";
|
||||
github = "tnias";
|
||||
|
@ -0,0 +1,5 @@
|
||||
@name@ () {
|
||||
export G4@envvar@DATA="@out@/data"
|
||||
}
|
||||
|
||||
postHooks+=(@name@)
|
103
pkgs/development/libraries/physics/geant4/datasets.nix
Normal file
103
pkgs/development/libraries/physics/geant4/datasets.nix
Normal file
@ -0,0 +1,103 @@
|
||||
{ stdenv, fetchurl, }:
|
||||
|
||||
let
|
||||
mkDataset = { name, version, sha256, envvar}:
|
||||
stdenv.mkDerivation {
|
||||
inherit name version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://geant4-data.web.cern.ch/geant4-data/datasets/${name}.${version}.tar.gz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
preferLocalBuild = true;
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/data
|
||||
mv ./* $out/data
|
||||
'';
|
||||
|
||||
inherit envvar;
|
||||
setupHook = ./datasets-hook.sh;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Data files for the Geant4 toolkit";
|
||||
homepage = "https://geant4.web.cern.ch/support/download";
|
||||
license = licenses.g4sl;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
in
|
||||
builtins.listToAttrs (map (a: { inherit (a) name; value = mkDataset a; }) [
|
||||
{
|
||||
name = "G4NDL";
|
||||
version = "4.5";
|
||||
sha256 = "cba928a520a788f2bc8229c7ef57f83d0934bb0c6a18c31ef05ef4865edcdf8e";
|
||||
envvar = "NEUTRONHP";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4EMLOW";
|
||||
version = "7.3";
|
||||
sha256 = "583aa7f34f67b09db7d566f904c54b21e95a9ac05b60e2bfb794efb569dba14e";
|
||||
envvar = "LE";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4PhotonEvaporation";
|
||||
version = "5.2";
|
||||
sha256 = "83607f8d36827b2a7fca19c9c336caffbebf61a359d0ef7cee44a8bcf3fc2d1f";
|
||||
envvar = "LEVELGAMMA";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4RadioactiveDecay";
|
||||
version = "5.2";
|
||||
sha256 = "99c038d89d70281316be15c3c98a66c5d0ca01ef575127b6a094063003e2af5d";
|
||||
envvar = "RADIOACTIVE";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4SAIDDATA";
|
||||
version = "1.1";
|
||||
sha256 = "a38cd9a83db62311922850fe609ecd250d36adf264a88e88c82ba82b7da0ed7f";
|
||||
envvar = "SAIDXS";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4NEUTRONXS";
|
||||
version = "1.4";
|
||||
sha256 = "57b38868d7eb060ddd65b26283402d4f161db76ed2169437c266105cca73a8fd";
|
||||
envvar = "NEUTRONXS";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4ABLA";
|
||||
version = "3.1";
|
||||
sha256 = "7698b052b58bf1b9886beacdbd6af607adc1e099fc730ab6b21cf7f090c027ed";
|
||||
envvar = "ABLA";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4PII";
|
||||
version = "1.3";
|
||||
sha256 = "6225ad902675f4381c98c6ba25fc5a06ce87549aa979634d3d03491d6616e926";
|
||||
envvar = "PII";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4ENSDFSTATE";
|
||||
version = "2.2";
|
||||
sha256 = "dd7e27ef62070734a4a709601f5b3bada6641b111eb7069344e4f99a01d6e0a6";
|
||||
envvar = "ENSDFSTATE";
|
||||
}
|
||||
|
||||
{
|
||||
name = "G4RealSurface";
|
||||
version = "2.1";
|
||||
sha256 = "2a287adbda1c0292571edeae2082a65b7f7bd6cf2bf088432d1d6f889426dcf3";
|
||||
envvar = "REALSURFACE";
|
||||
}
|
||||
])
|
@ -24,9 +24,14 @@
|
||||
# For enableXM.
|
||||
, motif ? null # motif or lesstif
|
||||
|
||||
# For enableInventor
|
||||
, coin3d
|
||||
, soxt
|
||||
, libXpm ? null
|
||||
|
||||
# For enableQT, enableXM, enableOpenGLX11, enableRaytracerX11.
|
||||
, libGLU_combined ? null
|
||||
, xlibsWrapper ? null
|
||||
, libGLU_combined ? null
|
||||
, xlibsWrapper ? null
|
||||
, libXmu ? null
|
||||
}:
|
||||
|
||||
@ -43,6 +48,7 @@ assert enableXM -> motif != null;
|
||||
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 =
|
||||
@ -52,18 +58,11 @@ let
|
||||
inherit version src;
|
||||
name = "geant4-${version}";
|
||||
|
||||
# The data directory holds not just interaction cross section data, but other
|
||||
# files which the installer needs to write, so we link to the previously installed
|
||||
# data instead. This assumes the default data installation location of $out/share.
|
||||
preConfigure = ''
|
||||
mkdir -p $out/share/Geant4-${version}
|
||||
ln -s ${g4data}/Geant4-${version}/data $out/share/Geant4-${version}/data
|
||||
'';
|
||||
|
||||
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"}
|
||||
@ -74,24 +73,31 @@ let
|
||||
-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
|
||||
'';
|
||||
|
||||
g4data = installData {
|
||||
inherit version src;
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
buildInputs = [ cmake clhep expat zlib xercesc qt motif libGLU_combined xlibsWrapper libXmu ];
|
||||
propagatedBuildInputs = [ g4data clhep expat zlib xercesc qt motif libGLU_combined xlibsWrapper libXmu ];
|
||||
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 ];
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
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 = {
|
||||
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.
|
||||
@ -99,44 +105,12 @@ let
|
||||
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;
|
||||
license = licenses.g4sl;
|
||||
maintainers = with maintainers; [ tmplt ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
|
||||
installData =
|
||||
{ version, src }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit version src;
|
||||
name = "g4data-${version}";
|
||||
|
||||
cmakeFlags = ''
|
||||
-DGEANT4_INSTALL_DATA="ON"
|
||||
'';
|
||||
|
||||
buildInputs = [ cmake expat ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
buildPhase = ''
|
||||
make G4EMLOW G4NDL G4NEUTRONXS G4PII G4SAIDDATA PhotonEvaporation RadioactiveDecay RealSurface
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/Geant4-${version}
|
||||
cp -R data/ $out/Geant4-${version}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Data files for the Geant4 toolkit";
|
||||
homepage = http://www.geant4.org;
|
||||
license = stdenv.lib.licenses.g4sl;
|
||||
maintainers = [ ];
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
};
|
||||
};
|
||||
|
||||
fetchGeant4 = import ./fetch.nix {
|
||||
inherit stdenv fetchurl;
|
||||
};
|
||||
@ -146,5 +120,9 @@ in {
|
||||
inherit (fetchGeant4.v10_0_2) version src;
|
||||
multiThreadingCapable = true;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
v10_4_1 = buildGeant4 {
|
||||
inherit (fetchGeant4.v10_4_1) version src;
|
||||
multiThreadingCapable = true;
|
||||
};
|
||||
}
|
||||
|
@ -13,7 +13,17 @@ in {
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user