2021-01-15 22:18:51 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, ocaml, findlib, ocamlbuild }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.08"
|
2020-04-24 23:36:52 +00:00
|
|
|
then throw "wasm is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-02-10 20:34:41 +00:00
|
|
|
pname = "ocaml${ocaml.version}-wasm";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "2.0.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "WebAssembly";
|
|
|
|
repo = "spec";
|
2020-05-15 21:57:56 +00:00
|
|
|
rev = "opam-${version}";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256:09s0v79x0ymzcp2114zkm3phxavdfnkkq67qz1ndnknbkziwqf3v";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +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";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [ "-C" "interpreter" ];
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir $out/bin
|
|
|
|
cp -L interpreter/wasm $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "An executable and OCaml library to run, read and write Web Assembly (wasm) files and manipulate their AST";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = [ lib.maintainers.vbgl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/WebAssembly/spec/tree/master/interpreter";
|
|
|
|
inherit (ocaml.meta) platforms;
|
|
|
|
};
|
|
|
|
}
|