python312Packages.fastnlo-toolkit: fix build (#359805)

This commit is contained in:
Dmitry Kalinkin 2024-11-28 14:05:37 -05:00 committed by GitHub
commit b71f4a89a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,16 +1,17 @@
{ lib
, stdenv
, fetchurl
, boost
, gfortran
, lhapdf
, ncurses
, perl
, python ? null
, swig
, yoda
, zlib
, withPython ? false
{
lib,
stdenv,
fetchurl,
boost,
gfortran,
lhapdf,
ncurses,
perl,
python ? null,
swig,
yoda,
zlib,
withPython ? false,
}:
stdenv.mkDerivation rec {
@ -19,9 +20,16 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "https://fastnlo.hepforge.org/code/v25/fastnlo_toolkit-${version}.tar.gz";
sha256 = "sha256-7aIMYCOkHC/17CHYiEfrxvtSJxTDivrS7BQ32cGiEy0=";
hash = "sha256-7aIMYCOkHC/17CHYiEfrxvtSJxTDivrS7BQ32cGiEy0=";
};
postPatch = ''
substituteInPlace py-compile \
--replace-fail "import sys, os, py_compile, imp" "import sys, os, py_compile, importlib" \
--replace-fail "imp." "importlib." \
--replace-fail "hasattr(imp" "hasattr(importlib"
'';
patches = [
# Compatibility with YODA 2.x
./yoda2_support.patch
@ -33,12 +41,16 @@ stdenv.mkDerivation rec {
gfortran.cc.lib
lhapdf
yoda
] ++ lib.optional withPython python
++ lib.optional (withPython && python.isPy3k) ncurses;
] ++ lib.optional withPython python ++ lib.optional (withPython && python.isPy3k) ncurses;
propagatedBuildInputs = [
zlib
] ++ lib.optional withPython swig;
propagatedBuildInputs =
[
zlib
]
++ lib.optional withPython [
swig
python.pkgs.distutils
];
preConfigure = ''
substituteInPlace ./fastnlotoolkit/Makefile.in \
@ -67,7 +79,7 @@ stdenv.mkDerivation rec {
# None of our currently packaged versions of swig are C++17-friendly
# Use a workaround from https://github.com/swig/swig/issues/1538
env.CXXFLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES";
env.CXXFLAGS = "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES";
meta = with lib; {
homepage = "http://fastnlo.hepforge.org";