2021-08-27 10:15:39 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2021-01-04 09:44:04 +00:00
|
|
|
, rustPlatform
|
2021-08-27 10:15:39 +00:00
|
|
|
, callPackage
|
2021-01-04 09:44:04 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPythonPackage
|
2021-06-12 12:35:52 +00:00
|
|
|
, libiconv
|
2021-08-27 10:15:39 +00:00
|
|
|
, llvm_11
|
|
|
|
, libffi
|
|
|
|
, libxml2
|
|
|
|
, ncurses
|
|
|
|
, zlib
|
2021-01-04 09:44:04 +00:00
|
|
|
}:
|
2021-06-20 15:34:25 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
let
|
|
|
|
common =
|
|
|
|
{ pname
|
|
|
|
, buildAndTestSubdir
|
|
|
|
, cargoHash
|
|
|
|
, extraNativeBuildInputs ? [ ]
|
|
|
|
, extraBuildInputs ? [ ]
|
|
|
|
}: buildPythonPackage rec {
|
|
|
|
inherit pname;
|
|
|
|
version = "1.0.0";
|
|
|
|
format = "pyproject";
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
outputs = [ "out" ] ++ lib.optional (pname == "wasmer") "testsout";
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wasmerio";
|
|
|
|
repo = "wasmer-python";
|
|
|
|
rev = version;
|
|
|
|
hash = "sha256-I1GfjLaPYMIHKh2m/5IQepUsJNiVUEJg49wyuuzUYtY=";
|
|
|
|
};
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
sha256 = cargoHash;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = (with rustPlatform; [ cargoSetupHook maturinBuildHook ])
|
|
|
|
++ extraNativeBuildInputs;
|
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]
|
|
|
|
++ extraBuildInputs;
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
inherit buildAndTestSubdir;
|
2021-02-11 18:30:30 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
postInstall = lib.optionalString (pname == "wasmer") ''
|
|
|
|
mkdir $testsout
|
|
|
|
cp -R tests $testsout/tests
|
|
|
|
'';
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
# check in passthru.tests.pytest because all packages are required to run the tests
|
|
|
|
doCheck = false;
|
2021-06-12 12:35:52 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
passthru.tests = lib.optionalAttrs (pname == "wasmer") {
|
|
|
|
pytest = callPackage ./tests.nix { };
|
|
|
|
};
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
pythonImportsCheck = [ "${lib.replaceStrings ["-"] ["_"] pname}" ];
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Python extension to run WebAssembly binaries";
|
|
|
|
homepage = "https://github.com/wasmerio/wasmer-python";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
rec {
|
|
|
|
wasmer = common {
|
|
|
|
pname = "wasmer";
|
|
|
|
buildAndTestSubdir = "packages/api";
|
|
|
|
cargoHash = "sha256-txOOia1C4W+nsXuXp4EytEn82CFfSmiOYwRLC4WPImc=";
|
|
|
|
};
|
|
|
|
|
|
|
|
wasmer-compiler-cranelift = common {
|
|
|
|
pname = "wasmer-compiler-cranelift";
|
|
|
|
buildAndTestSubdir = "packages/compiler-cranelift";
|
|
|
|
cargoHash = "sha256-cHgAUwqnbQV3E5nUYGYQ48ntbIFfq4JXfU5IrSFZ3zI=";
|
|
|
|
};
|
|
|
|
|
|
|
|
wasmer-compiler-llvm = common {
|
|
|
|
pname = "wasmer-compiler-llvm";
|
|
|
|
buildAndTestSubdir = "packages/compiler-llvm";
|
|
|
|
cargoHash = "sha256-Jm22CC5S3pN/vdVvsGZdvtoAgPzWVLto8wavSJdxY3A=";
|
|
|
|
extraNativeBuildInputs = [ llvm_11 ];
|
|
|
|
extraBuildInputs = [ libffi libxml2.out ncurses zlib ];
|
|
|
|
};
|
2021-01-04 09:44:04 +00:00
|
|
|
|
2021-08-27 10:15:39 +00:00
|
|
|
wasmer-compiler-singlepass = common {
|
|
|
|
pname = "wasmer-compiler-singlepass";
|
|
|
|
buildAndTestSubdir = "packages/compiler-singlepass";
|
|
|
|
cargoHash = "sha256-lmqEo3+jYoN+4EEYphcoE4b84jdFcvYVycjrJ956Bh8=";
|
2021-01-04 09:44:04 +00:00
|
|
|
};
|
|
|
|
}
|