summary refs log tree commit diff
path: root/pkgs/development/libraries/physics/applgrid/default.nix
blob: 3e2a53d81dd8dcf1929200b9e3bce4ca7ded81a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ stdenv, fetchurl, gfortran, hoppet, lhapdf, root5, zlib }:

stdenv.mkDerivation rec {
  pname = "applgrid";
  version = "1.4.70";

  src = fetchurl {
    url = "https://www.hepforge.org/archive/applgrid/${pname}-${version}.tgz";
    sha256 = "1yw9wrk3vjv84kd3j4s1scfhinirknwk6xq0hvj7x2srx3h93q9p";
  };

  # For some reason zlib was only needed after bump to gfortran8
  buildInputs = [ gfortran hoppet lhapdf root5 zlib ];

  patches = [
    ./bad_code.patch
  ];

  preConfigure = ''
    substituteInPlace src/Makefile.in \
      --replace "-L\$(subst /libgfortran.a, ,\$(FRTLIB) )" "-L${gfortran.cc.lib}/lib"
  '' + (if stdenv.isDarwin then ''
    substituteInPlace src/Makefile.in \
      --replace "gfortran -print-file-name=libgfortran.a" "gfortran -print-file-name=libgfortran.dylib"
  '' else "");

  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 stdenv.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 ];
  };
}