2021-06-28 23:13:55 +00:00
|
|
|
{ lib, stdenv, fetchurl, python, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lhapdf";
|
2022-08-21 13:32:41 +00:00
|
|
|
version = "6.5.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.hepforge.org/archive/lhapdf/LHAPDF-${version}.tar.gz";
|
2022-08-21 13:32:41 +00:00
|
|
|
sha256 = "sha256-YIonU0VeBnqZQLXBa8hqtsR+LHSbyd0ZeWmW60NSsv0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# The Apple SDK only exports locale_t from xlocale.h whereas glibc
|
|
|
|
# had decided that xlocale.h should be a part of locale.h
|
|
|
|
postPatch = lib.optionalString (stdenv.isDarwin && stdenv.cc.isGNU) ''
|
|
|
|
substituteInPlace src/GridPDF.cc --replace '#include <locale>' '#include <xlocale.h>'
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ]
|
|
|
|
++ lib.optionals (python != null && lib.versionAtLeast python.version "3.10") [ python.pkgs.cython ];
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = [ python ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
configureFlags = lib.optionals (python == null) [ "--disable-python" ];
|
|
|
|
|
|
|
|
preBuild = lib.optionalString (python != null && lib.versionAtLeast python.version "3.10") ''
|
|
|
|
rm wrappers/python/lhapdf.cpp
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
passthru = {
|
2021-02-05 17:12:51 +00:00
|
|
|
pdf_sets = import ./pdf_sets.nix { inherit lib stdenv fetchurl; };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/lhapdf --prefix PYTHONPATH : "$(toPythonPath "$out")"
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A general purpose interpolator, used for evaluating Parton Distribution Functions from discretised data files";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = licenses.gpl2;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://lhapdf.hepforge.org";
|
2021-02-05 17:12:51 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ veprbl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|