2022-12-28 21:21:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, cmake
|
|
|
|
, coreutils
|
|
|
|
, python
|
|
|
|
, root
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2021-02-05 17:12:51 +00:00
|
|
|
pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
withPython = python != null;
|
2020-08-20 17:08:02 +00:00
|
|
|
# ensure that root is built with the same python interpreter, as it links against numpy
|
|
|
|
root_py = if withPython then root.override { inherit python; } else root;
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "hepmc3";
|
2022-03-05 16:20:37 +00:00
|
|
|
version = "3.2.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://hepmc.web.cern.ch/hepmc/releases/HepMC3-${version}.tar.gz";
|
2022-03-05 16:20:37 +00:00
|
|
|
sha256 = "sha256-zQ91yA91VJxZzCqCns52Acd96Xyypat1eQysjh1YUDI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
root_py
|
|
|
|
]
|
|
|
|
++ lib.optional withPython python;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DHEPMC3_ENABLE_PYTHON=${if withPython then "ON" else "OFF"}"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals withPython [
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DHEPMC3_PYTHON_VERSIONS=${if python.isPy3k then "3.X" else "2.X"}"
|
|
|
|
"-DHEPMC3_Python_SITEARCH${pythonVersion}=${placeholder "out"}/${python.sitePackages}"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace "$out"/bin/HepMC3-config \
|
|
|
|
--replace 'greadlink' '${coreutils}/bin/readlink' \
|
|
|
|
--replace 'readlink' '${coreutils}/bin/readlink'
|
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
doInstallCheck = withPython;
|
|
|
|
# prevent nix from trying to dereference a null python
|
2021-02-05 17:12:51 +00:00
|
|
|
installCheckPhase = lib.optionalString withPython ''
|
2020-08-20 17:08:02 +00:00
|
|
|
PYTHONPATH=${placeholder "out"}/${python.sitePackages} python -c 'import pyHepMC3'
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "The HepMC package is an object oriented, C++ event record for High Energy Physics Monte Carlo generators and simulation";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
homepage = "http://hepmc.web.cern.ch/hepmc/";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ veprbl ];
|
2022-12-17 10:02:37 +00:00
|
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
|
|
broken = stdenv.isDarwin && stdenv.isAarch64;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|