2023-02-16 17:41:37 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, python, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lhapdf";
|
2022-12-28 21:21:41 +00:00
|
|
|
version = "6.5.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.hepforge.org/archive/lhapdf/LHAPDF-${version}.tar.gz";
|
2022-12-28 21:21:41 +00:00
|
|
|
sha256 = "sha256-V0Nc1pXilwZdU+ab0pCQdlyTSTa2qXX/jFWXZvIjA1k=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
patches = [
|
|
|
|
# avoid silent compilation failures
|
|
|
|
(fetchpatch {
|
|
|
|
name = "lhapdf-propagate_returncode.patch";
|
|
|
|
url = "https://gitlab.com/hepcedar/lhapdf/-/commit/2806ac795c7e4a69281d9c2a6a8bba5423f37e74.diff";
|
|
|
|
hash = "sha256-j8txlt0n5gpUy9zeuWKx+KRXL3HMMaGcwOxr908966k=";
|
|
|
|
})
|
|
|
|
|
|
|
|
# workaround "ld: -stack_size option can only be used when linking a main executable" on darwin
|
|
|
|
(fetchpatch {
|
|
|
|
name = "lhapdf-Wl_stack_size.patch";
|
|
|
|
url = "https://gitlab.com/hepcedar/lhapdf/-/commit/463764d6613837b6ab57ecaf13bc61be2349e5e4.diff";
|
|
|
|
hash = "sha256-AbDs7gtU5HsJG5n/solMzu2bjX1juxfUIqIt5KmNffU=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|