From 8f6236baec5d103e00044a38cacfb0f3364bddf6 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Mon, 10 Jul 2023 18:29:30 +0200 Subject: [PATCH] jasmin-compiler: install the OCaml libraries And split into multiple outputs - the default `bin` contains the Jasmin compilers - the `lib` output contains the EasyCrypt support library - the remaining `out` contains the OCaml libraries --- .../compilers/jasmin-compiler/default.nix | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/jasmin-compiler/default.nix b/pkgs/development/compilers/jasmin-compiler/default.nix index 913b927834fa..9f539f698182 100644 --- a/pkgs/development/compilers/jasmin-compiler/default.nix +++ b/pkgs/development/compilers/jasmin-compiler/default.nix @@ -11,6 +11,12 @@ stdenv.mkDerivation rec { sourceRoot = "jasmin-compiler-v${version}/compiler"; + # Released tarball contains extraneous `dune` files + # See https://github.com/jasmin-lang/jasmin/pull/495 + preBuild = '' + rm -rf tests + ''; + nativeBuildInputs = with ocamlPackages; [ ocaml findlib dune_3 menhir camlidl cmdliner ]; buildInputs = [ @@ -18,21 +24,23 @@ stdenv.mkDerivation rec { ppl ] ++ (with ocamlPackages; [ apron + yojson + ]); + + propagatedBuildInputs = with ocamlPackages; [ batteries menhirLib - yojson zarith - ]); + ]; + + outputs = [ "bin" "lib" "out" ]; installPhase = '' runHook preInstall - mkdir -p $out/bin - for p in jasminc jazz2tex - do - cp _build/default/entry/$p.exe $out/bin/$p - done - mkdir -p $out/lib/jasmin/easycrypt - cp ../eclib/*.ec $out/lib/jasmin/easycrypt + dune build @install + dune install --prefix=$bin --libdir=$out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib + mkdir -p $lib/lib/jasmin/easycrypt + cp ../eclib/*.ec $lib/lib/jasmin/easycrypt runHook postInstall '';