about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxeji <36407913+xeji@users.noreply.github.com>2018-05-12 23:13:01 +0200
committerGitHub <noreply@github.com>2018-05-12 23:13:01 +0200
commitef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040 (patch)
treefef4f8caed3576802680f5d0c810dcf154862b39
parent0e57b81b2dd69a9fdf2166cdf2d2c129176081de (diff)
parent024efc950923730bc3e7e05a87b90c157324e912 (diff)
downloadnixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.tar
nixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.tar.gz
nixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.tar.bz2
nixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.tar.lz
nixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.tar.xz
nixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.tar.zst
nixlib-ef102bd43a78ac7ad7c1c3cfbb3bd849d4e6b040.zip
Merge pull request #39514 from Tmplt/update-geant4
geant4: v10.0.2 -> v10.4.1, define datasets seperately, add dependencies for enableInventor
-rw-r--r--maintainers/maintainer-list.nix5
-rw-r--r--pkgs/development/libraries/physics/geant4/datasets-hook.sh5
-rw-r--r--pkgs/development/libraries/physics/geant4/datasets.nix103
-rw-r--r--pkgs/development/libraries/physics/geant4/default.nix88
-rw-r--r--pkgs/development/libraries/physics/geant4/fetch.nix12
-rw-r--r--pkgs/development/libraries/physics/geant4/geant4-hook.sh (renamed from pkgs/development/libraries/physics/geant4/setup-hook.sh)0
-rw-r--r--pkgs/development/libraries/soxt/default.nix21
-rw-r--r--pkgs/top-level/all-packages.nix2
8 files changed, 180 insertions, 56 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index b60d5643434c..b8746b04283b 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -3771,6 +3771,11 @@
     github = "titanous";
     name = "Jonathan Rudenberg";
   };
+  tmplt = {
+    email = "tmplt@dragons.rocks";
+    github = "tmplt";
+    name = "Viktor";
+  };
   tnias = {
     email = "phil@grmr.de";
     github = "tnias";
diff --git a/pkgs/development/libraries/physics/geant4/datasets-hook.sh b/pkgs/development/libraries/physics/geant4/datasets-hook.sh
new file mode 100644
index 000000000000..14e3b8f2fc38
--- /dev/null
+++ b/pkgs/development/libraries/physics/geant4/datasets-hook.sh
@@ -0,0 +1,5 @@
+@name@ () {
+    export G4@envvar@DATA="@out@/data"
+}
+
+postHooks+=(@name@)
diff --git a/pkgs/development/libraries/physics/geant4/datasets.nix b/pkgs/development/libraries/physics/geant4/datasets.nix
new file mode 100644
index 000000000000..88f2dc2cd6d4
--- /dev/null
+++ b/pkgs/development/libraries/physics/geant4/datasets.nix
@@ -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";
+    }
+  ])
diff --git a/pkgs/development/libraries/physics/geant4/default.nix b/pkgs/development/libraries/physics/geant4/default.nix
index 794d0b24c778..87af069c18a5 100644
--- a/pkgs/development/libraries/physics/geant4/default.nix
+++ b/pkgs/development/libraries/physics/geant4/default.nix
@@ -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 ];
+
+      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 = ./setup-hook.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;
+  };
+}
diff --git a/pkgs/development/libraries/physics/geant4/fetch.nix b/pkgs/development/libraries/physics/geant4/fetch.nix
index 0e5dd54c6ae7..7dc4c8656279 100644
--- a/pkgs/development/libraries/physics/geant4/fetch.nix
+++ b/pkgs/development/libraries/physics/geant4/fetch.nix
@@ -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";
+    };
+  };
+
 }
 
diff --git a/pkgs/development/libraries/physics/geant4/setup-hook.sh b/pkgs/development/libraries/physics/geant4/geant4-hook.sh
index 0b775d432831..0b775d432831 100644
--- a/pkgs/development/libraries/physics/geant4/setup-hook.sh
+++ b/pkgs/development/libraries/physics/geant4/geant4-hook.sh
diff --git a/pkgs/development/libraries/soxt/default.nix b/pkgs/development/libraries/soxt/default.nix
new file mode 100644
index 000000000000..13f037960b08
--- /dev/null
+++ b/pkgs/development/libraries/soxt/default.nix
@@ -0,0 +1,21 @@
+{ fetchurl, stdenv, coin3d, motif, xlibsWrapper, libGLU_combined }:
+
+stdenv.mkDerivation rec {
+  name = "soxt-${version}";
+  version = "1.3.0";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/Coin3D/coin/downloads/SoXt-${version}.tar.gz";
+    sha256= "f5443aadafe8e2222b9b5a23d1f228bb0f3e7d98949b8ea8676171b7ea5bf013";
+  };
+
+  buildInputs = [ coin3d motif xlibsWrapper libGLU_combined ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.coin3d.org/;
+    license = licenses.bsd3;
+    description = "A GUI binding for using Open Inventor with Xt/Motif";
+    maintainers = with maintainers; [ tmplt ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c04fb6bf6d70..49bd8adaf333 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8670,6 +8670,8 @@ with pkgs;
 
   coin3d = callPackage ../development/libraries/coin3d { };
 
+  soxt = callPackage ../development/libraries/soxt { };
+
   CoinMP = callPackage ../development/libraries/CoinMP { };
 
   cointop = callPackage ../applications/misc/cointop { };