2021-01-11 12:49:15 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, ocaml, findlib, ocamlbuild }:
|
2017-08-03 18:40:07 +00:00
|
|
|
|
2022-06-02 07:33:44 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.08"
|
2017-08-03 18:40:07 +00:00
|
|
|
then throw "wasm is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-02-06 22:35:27 +00:00
|
|
|
pname = "ocaml${ocaml.version}-wasm";
|
2022-06-02 07:33:44 +00:00
|
|
|
version = "2.0.0";
|
2017-08-03 18:40:07 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "WebAssembly";
|
|
|
|
repo = "spec";
|
2020-05-10 09:27:59 +00:00
|
|
|
rev = "opam-${version}";
|
2022-06-02 07:33:44 +00:00
|
|
|
sha256 = "sha256:09s0v79x0ymzcp2114zkm3phxavdfnkkq67qz1ndnknbkziwqf3v";
|
2017-08-03 18:40:07 +00:00
|
|
|
};
|
|
|
|
|
2021-08-14 12:00:00 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
# x86_64-unknown-linux-musl-ld: -r and -pie may not be used together
|
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
2017-08-03 18:40:07 +00:00
|
|
|
|
|
|
|
makeFlags = [ "-C" "interpreter" ];
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
2018-08-13 02:49:00 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir $out/bin
|
|
|
|
cp -L interpreter/wasm $out/bin
|
|
|
|
'';
|
|
|
|
|
2017-08-03 18:40:07 +00:00
|
|
|
meta = {
|
2018-08-13 02:49:00 +00:00
|
|
|
description = "An executable and OCaml library to run, read and write Web Assembly (wasm) files and manipulate their AST";
|
2021-01-11 12:49:15 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = [ lib.maintainers.vbgl ];
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/WebAssembly/spec/tree/master/interpreter";
|
2017-08-03 18:40:07 +00:00
|
|
|
inherit (ocaml.meta) platforms;
|
|
|
|
};
|
|
|
|
}
|