2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
rustPlatform,
|
|
|
|
callPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonAtLeast,
|
|
|
|
libiconv,
|
|
|
|
libffi,
|
|
|
|
libxml2,
|
|
|
|
llvm_14,
|
|
|
|
ncurses,
|
|
|
|
zlib,
|
2021-01-09 10:05:03 +00:00
|
|
|
}:
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
let
|
|
|
|
common =
|
2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
pname,
|
|
|
|
buildAndTestSubdir,
|
|
|
|
cargoHash,
|
|
|
|
extraNativeBuildInputs ? [ ],
|
|
|
|
extraBuildInputs ? [ ],
|
|
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
2021-09-18 10:52:07 +00:00
|
|
|
inherit pname;
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "1.1.1";
|
2021-09-18 10:52:07 +00:00
|
|
|
format = "pyproject";
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
outputs = [ "out" ] ++ lib.optional (pname == "wasmer") "testsout";
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wasmerio";
|
|
|
|
repo = "wasmer-python";
|
|
|
|
rev = version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-Iu28LMDNmtL2r7gJV5Vbb8HZj18dlkHe+mw/Y1L8YKE=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
sha256 = cargoHash;
|
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
(with rustPlatform; [
|
|
|
|
cargoSetupHook
|
|
|
|
maturinBuildHook
|
|
|
|
])
|
2021-09-18 10:52:07 +00:00
|
|
|
++ extraNativeBuildInputs;
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Workaround for metadata, that maturin 0.14 does not accept in Cargo.toml anymore
|
|
|
|
substituteInPlace ${buildAndTestSubdir}/Cargo.toml \
|
|
|
|
--replace "package.metadata.maturin" "broken"
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ] ++ extraBuildInputs;
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
inherit buildAndTestSubdir;
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
postInstall = lib.optionalString (pname == "wasmer") ''
|
|
|
|
mkdir $testsout
|
|
|
|
cp -R tests $testsout/tests
|
|
|
|
'';
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# check in passthru.tests.pytest because all packages are required to run the tests
|
|
|
|
doCheck = false;
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.tests = lib.optionalAttrs (pname == "wasmer") { pytest = callPackage ./tests.nix { }; };
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "${lib.replaceStrings [ "-" ] [ "_" ] pname}" ];
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
meta = with lib; {
|
2024-05-15 15:35:15 +00:00
|
|
|
# https://github.com/wasmerio/wasmer-python/issues/778
|
|
|
|
broken = pythonAtLeast "3.12";
|
2021-09-18 10:52:07 +00:00
|
|
|
description = "Python extension to run WebAssembly binaries";
|
|
|
|
homepage = "https://github.com/wasmerio/wasmer-python";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = [ ];
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
2023-10-09 19:29:22 +00:00
|
|
|
{
|
2021-09-18 10:52:07 +00:00
|
|
|
wasmer = common {
|
|
|
|
pname = "wasmer";
|
|
|
|
buildAndTestSubdir = "packages/api";
|
2024-05-15 15:35:15 +00:00
|
|
|
cargoHash = "sha256-vpbwU1HrIQmQkce9SK8UOHrX5tOLv/XKsfJHteqOteA=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
wasmer-compiler-cranelift = common {
|
|
|
|
pname = "wasmer-compiler-cranelift";
|
|
|
|
buildAndTestSubdir = "packages/compiler-cranelift";
|
2024-05-15 15:35:15 +00:00
|
|
|
cargoHash = "sha256-nv4cr52mUIuR3LWRT3eXU5b2LORwuN4iMbLX1efzovI=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
wasmer-compiler-llvm = common {
|
|
|
|
pname = "wasmer-compiler-llvm";
|
|
|
|
buildAndTestSubdir = "packages/compiler-llvm";
|
2024-05-15 15:35:15 +00:00
|
|
|
cargoHash = "sha256-FA/xXlPaK8NxZIw7MCm9Fyesgu72Dsxhmb5xzOIINhE=";
|
2024-01-02 11:29:13 +00:00
|
|
|
extraNativeBuildInputs = [ llvm_14 ];
|
2024-06-05 15:53:02 +00:00
|
|
|
extraBuildInputs = [
|
|
|
|
libffi
|
|
|
|
libxml2.out
|
|
|
|
ncurses
|
|
|
|
zlib
|
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
wasmer-compiler-singlepass = common {
|
|
|
|
pname = "wasmer-compiler-singlepass";
|
|
|
|
buildAndTestSubdir = "packages/compiler-singlepass";
|
2024-05-15 15:35:15 +00:00
|
|
|
cargoHash = "sha256-yew7cB/7RLjW55jZmHFfIvaErgZ6XVxL1ucGGX2Cx18=";
|
2021-01-09 10:05:03 +00:00
|
|
|
};
|
|
|
|
}
|