From 1d2afc0e998abe2a1bb2c6b803ae9154717c3e24 Mon Sep 17 00:00:00 2001 From: Mutsuha Asada Date: Wed, 4 Jun 2025 07:51:23 +0900 Subject: [PATCH] ocamlPackages.wasm: 2.0.1 -> 2.0.2 --- .../ocaml-modules/wasm/default.nix | 77 ++++++++----------- 1 file changed, 32 insertions(+), 45 deletions(-) diff --git a/pkgs/development/ocaml-modules/wasm/default.nix b/pkgs/development/ocaml-modules/wasm/default.nix index 1abe1f060bbd..5af0836ed2ca 100644 --- a/pkgs/development/ocaml-modules/wasm/default.nix +++ b/pkgs/development/ocaml-modules/wasm/default.nix @@ -1,55 +1,42 @@ { - stdenv, lib, + stdenv, fetchFromGitHub, - ocaml, - findlib, - ocamlbuild, + menhir, + odoc, + buildDunePackage, }: +buildDunePackage rec { + pname = "wasm"; + version = "2.0.2"; -if lib.versionOlder ocaml.version "4.08" then - throw "wasm is not available for OCaml ${ocaml.version}" -else + minimalOCamlVersion = "4.12"; - stdenv.mkDerivation rec { - pname = "ocaml${ocaml.version}-wasm"; - version = "2.0.1"; + src = fetchFromGitHub { + owner = "WebAssembly"; + repo = "spec"; + tag = "opam-${version}"; + hash = "sha256-RbVGW6laC3trP6IhtA2tLrAYVbx0Oucox9FgoEvs6LQ="; + }; - src = fetchFromGitHub { - owner = "WebAssembly"; - repo = "spec"; - rev = "opam-${version}"; - hash = "sha256-5eo8MIui2GxRS5X9az0NlLGZfxi5KGsTI/EaP6m/zts="; - }; + postUnpack = '' + cd "$sourceRoot/interpreter" + export sourceRoot=$PWD + ''; - 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"; - # x86_64-unknown-linux-musl-ld: -r and -pie may not be used together - hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + nativeBuildInputs = [ + menhir + odoc + ]; - makeFlags = [ - "-C" - "interpreter" - ]; - - createFindlibDestdir = true; - - postInstall = '' - mkdir $out/bin - cp -L interpreter/wasm $out/bin - ''; - - meta = { - description = "Executable and OCaml library to run, read and write Web Assembly (wasm) files and manipulate their AST"; - mainProgram = "wasm"; - license = lib.licenses.asl20; - maintainers = [ lib.maintainers.vbgl ]; - homepage = "https://github.com/WebAssembly/spec/tree/master/interpreter"; - inherit (ocaml.meta) platforms; - }; - } + meta = { + description = "Library to read and write WebAssembly (Wasm) files and manipulate their AST"; + mainProgram = "wasm"; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.vbgl ]; + homepage = "https://github.com/WebAssembly/spec/tree/main/interpreter"; + }; +}