python3Packages.llvmlite: make it statically link to llvm (#335416)

This commit is contained in:
Nick Cao 2024-09-07 10:33:21 -04:00 committed by GitHub
commit 06ea4ab184
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,12 +6,14 @@
isPyPy,
pythonAtLeast,
# build-system
llvm,
setuptools,
# tests
pytestCheckHook,
llvm,
libxml2,
withStaticLLVM ? true,
}:
buildPythonPackage rec {
@ -28,24 +30,19 @@ buildPythonPackage rec {
hash = "sha256-5QBSRDb28Bui9IOhGofj+c7Rk7J5fNv5nPksEPY/O5o=";
};
nativeBuildInputs = [
llvm
setuptools
];
build-system = [ setuptools ];
postPatch = ''
substituteInPlace llvmlite/tests/test_binding.py \
--replace-fail "test_linux" "nope"
buildInputs = [ llvm ] ++ lib.optionals withStaticLLVM [ libxml2.dev ];
postPatch = lib.optionalString withStaticLLVM ''
substituteInPlace ffi/build.py --replace-fail "--system-libs --libs all" "--system-libs --libs --link-static all"
'';
# Set directory containing llvm-config binary
preConfigure = ''
export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
'';
env.LLVM_CONFIG = "${llvm.dev}/bin/llvm-config";
nativeCheckInputs = [ pytestCheckHook ];
nativeCheckInputs = [
pytestCheckHook
];
# https://github.com/NixOS/nixpkgs/issues/255262
preCheck = ''
cd $out
@ -53,7 +50,7 @@ buildPythonPackage rec {
__impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ];
passthru.llvm = llvm;
passthru = lib.optionalAttrs (!withStaticLLVM) { inherit llvm; };
meta = {
changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG";