python312Packages.galario: fix build (#363044)

This commit is contained in:
Jörg Thalheim 2024-12-09 13:17:06 +01:00 committed by GitHub
commit 346cdedbff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,46 +1,62 @@
{ lib, stdenv
, fetchzip
, fetchFromGitHub
, cmake
, fftw
, fftwFloat
, enablePython ? false
, pythonPackages ? null
, llvmPackages
{
lib,
stdenv,
fetchzip,
fetchFromGitHub,
cmake,
fftw,
fftwFloat,
enablePython ? false,
pythonPackages ? null,
llvmPackages,
}:
let
# CMake recipes are needed to build galario
# Build process would usually download them
great-cmake-cookoff = fetchzip {
url = "https://github.com/UCL/GreatCMakeCookOff/archive/v2.1.9.tar.gz";
sha256 = "1yd53b5gx38g6f44jmjk4lc4igs3p25z6616hfb7aq79ly01q0w2";
hash = "sha256-ggMcgKfpYHWWgyYY84u4Q79IGCVTVkmIMw+N/soapfk=";
};
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs:{
pname = "galario";
version = "1.2.2";
src = fetchFromGitHub {
owner = "mtazzari";
repo = pname;
rev = "v${version}";
sha256 = "0dw88ga50x3jwyfgcarn4azlhiarggvdg262hilm7rbrvlpyvha0";
repo = "galario";
tag = "v${finalAttrs.version}";
hash = "sha256-QMHtL9155VNphMKI1/Z7WUVIvyI2K/ac53J0UNRDiDc=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ fftw fftwFloat ]
++ lib.optional enablePython pythonPackages.python
++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp
;
buildInputs =
[
fftw
fftwFloat
]
++ lib.optional enablePython pythonPackages.python
++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp;
propagatedBuildInputs = lib.optionals enablePython [
pythonPackages.numpy
pythonPackages.cython
pythonPackages.cython_0
pythonPackages.distutils
pythonPackages.pytest
];
nativeCheckInputs = lib.optionals enablePython [ pythonPackages.scipy pythonPackages.pytest-cov ];
postPatch = ''
substituteInPlace python/utils.py \
--replace-fail "trapz" "trapezoid" \
--replace-fail "np.int" "int"
'';
nativeCheckInputs = lib.optionals enablePython [
pythonPackages.scipy
pythonPackages.pytest-cov
];
preConfigure = ''
mkdir -p build/external/src
@ -49,7 +65,12 @@ stdenv.mkDerivation rec {
'';
preCheck = ''
${if stdenv.hostPlatform.isDarwin then "export DYLD_LIBRARY_PATH=$(pwd)/src/" else "export LD_LIBRARY_PATH=$(pwd)/src/"}
${
if stdenv.hostPlatform.isDarwin then
"export DYLD_LIBRARY_PATH=$(pwd)/src/"
else
"export LD_LIBRARY_PATH=$(pwd)/src/"
}
${lib.optionalString enablePython "sed -i -e 's|^#!.*|#!${stdenv.shell}|' python/py.test.sh"}
'';
@ -65,7 +86,7 @@ stdenv.mkDerivation rec {
install_name_tool -change libgalario_single.dylib $out/lib/libgalario_single.dylib $out/lib/python*/site-packages/galario/single/libcommon.so
'';
meta = with lib; {
meta = {
description = "GPU Accelerated Library for Analysing Radio Interferometer Observations";
longDescription = ''
Galario is a library that exploits the computing power of modern
@ -76,8 +97,8 @@ stdenv.mkDerivation rec {
comparison to the observations.
'';
homepage = "https://mtazzari.github.io/galario/";
license = licenses.lgpl3;
maintainers = [ maintainers.smaret ];
platforms = platforms.all;
license = lib.licenses.lgpl3;
maintainers = [ lib.maintainers.smaret ];
platforms = lib.platforms.all;
};
}
})