Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 45 lines 1.5 kB view raw
1{ lib, stdenv, fetchurl, python, makeWrapper }: 2 3stdenv.mkDerivation rec { 4 pname = "lhapdf"; 5 version = "6.5.4"; 6 7 src = fetchurl { 8 url = "https://www.hepforge.org/archive/lhapdf/LHAPDF-${version}.tar.gz"; 9 sha256 = "sha256-JEOksyzDsFl8gki9biVwOs6ckaeiU8X2CxtUKO+chp4="; 10 }; 11 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>' 16 ''; 17 18 nativeBuildInputs = [ makeWrapper ] 19 ++ lib.optionals (python != null && lib.versionAtLeast python.version "3.10") [ python.pkgs.cython ]; 20 buildInputs = [ python ]; 21 22 configureFlags = lib.optionals (python == null) [ "--disable-python" ]; 23 24 preBuild = lib.optionalString (python != null && lib.versionAtLeast python.version "3.10") '' 25 rm wrappers/python/lhapdf.cpp 26 ''; 27 28 enableParallelBuilding = true; 29 30 passthru = { 31 pdf_sets = import ./pdf_sets.nix { inherit lib stdenv fetchurl; }; 32 }; 33 34 postInstall = '' 35 wrapProgram $out/bin/lhapdf --prefix PYTHONPATH : "$(toPythonPath "$out")" 36 ''; 37 38 meta = with lib; { 39 description = "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 ]; 44 }; 45}