1 { lib, stdenv, fetchurl, python, makeWrapper }:
3 stdenv.mkDerivation rec {
8 url = "https://www.hepforge.org/archive/lhapdf/LHAPDF-${version}.tar.gz";
9 sha256 = "sha256-YIonU0VeBnqZQLXBa8hqtsR+LHSbyd0ZeWmW60NSsv0=";
12 # The Apple SDK only exports locale_t from xlocale.h whereas glibc
13 # had decided that xlocale.h should be a part of locale.h
14 postPatch = lib.optionalString (stdenv.isDarwin && stdenv.cc.isGNU) ''
15 substituteInPlace src/GridPDF.cc --replace '#include <locale>' '#include <xlocale.h>'
18 nativeBuildInputs = [ makeWrapper ]
19 ++ lib.optionals (python != null && lib.versionAtLeast python.version "3.10") [ python.pkgs.cython ];
20 buildInputs = [ python ];
22 configureFlags = lib.optionals (python == null) [ "--disable-python" ];
24 preBuild = lib.optionalString (python != null && lib.versionAtLeast python.version "3.10") ''
25 rm wrappers/python/lhapdf.cpp
28 enableParallelBuilding = true;
31 pdf_sets = import ./pdf_sets.nix { inherit lib stdenv fetchurl; };
35 wrapProgram $out/bin/lhapdf --prefix PYTHONPATH : "$(toPythonPath "$out")"
39 description = "A general purpose interpolator, used for evaluating Parton Distribution Functions from discretised data files";
40 license = licenses.gpl2;
41 homepage = "http://lhapdf.hepforge.org";
42 platforms = platforms.unix;
43 maintainers = with maintainers; [ veprbl ];