about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix b/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix
new file mode 100644
index 000000000000..105a6b4953f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix
@@ -0,0 +1,45 @@
+{ lib, stdenv, fetchurl, gfortran, hoppet, lhapdf, root5, zlib, Cocoa }:
+
+stdenv.mkDerivation rec {
+  pname = "applgrid";
+  version = "1.4.70";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/applgrid/${pname}-${version}.tgz";
+    sha256 = "1yw9wrk3vjv84kd3j4s1scfhinirknwk6xq0hvj7x2srx3h93q9p";
+  };
+
+  nativeBuildInputs = [ gfortran ];
+
+  # For some reason zlib was only needed after bump to gfortran8
+  buildInputs = [ hoppet lhapdf root5 zlib ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
+
+  patches = [
+    ./bad_code.patch
+  ];
+
+  preConfigure = ''
+    substituteInPlace src/Makefile.in \
+      --replace "-L\$(subst /libgfortran.a, ,\$(FRTLIB) )" "-L${gfortran.cc.lib}/lib"
+  '' + (lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/Makefile.in \
+      --replace "gfortran -print-file-name=libgfortran.a" "gfortran -print-file-name=libgfortran.dylib"
+  '');
+
+  enableParallelBuilding = false; # broken
+
+  # Install private headers required by APFELgrid
+  postInstall = ''
+    for header in src/*.h; do
+      install -Dm644 "$header" "$out"/include/appl_grid/"`basename $header`"
+    done
+  '';
+
+  meta = with lib; {
+    description = "The APPLgrid project provides a fast and flexible way to reproduce the results of full NLO calculations with any input parton distribution set in only a few milliseconds rather than the weeks normally required to gain adequate statistics";
+    license     = licenses.gpl3;
+    homepage    = "http://applgrid.hepforge.org";
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}