Skip to content

Commit

Permalink
python312Packages.fastnlo-toolkit: fix build (#359805)
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl authored Nov 28, 2024
2 parents 017d88e + d3021e5 commit b71f4a8
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions pkgs/by-name/fa/fastnlo-toolkit/package.nix
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit b71f4a8

Please sign in to comment.