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
This commit is contained in:
Vincent Laporte 2023-07-10 18:29:30 +02:00 committed by Vincent Laporte
parent 4afa90a84f
commit 8f6236baec

View file

@ -11,6 +11,12 @@ stdenv.mkDerivation rec {
sourceRoot = "jasmin-compiler-v${version}/compiler"; 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 ]; nativeBuildInputs = with ocamlPackages; [ ocaml findlib dune_3 menhir camlidl cmdliner ];
buildInputs = [ buildInputs = [
@ -18,21 +24,23 @@ stdenv.mkDerivation rec {
ppl ppl
] ++ (with ocamlPackages; [ ] ++ (with ocamlPackages; [
apron apron
yojson
]);
propagatedBuildInputs = with ocamlPackages; [
batteries batteries
menhirLib menhirLib
yojson
zarith zarith
]); ];
outputs = [ "bin" "lib" "out" ];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/bin dune build @install
for p in jasminc jazz2tex dune install --prefix=$bin --libdir=$out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib
do mkdir -p $lib/lib/jasmin/easycrypt
cp _build/default/entry/$p.exe $out/bin/$p cp ../eclib/*.ec $lib/lib/jasmin/easycrypt
done
mkdir -p $out/lib/jasmin/easycrypt
cp ../eclib/*.ec $out/lib/jasmin/easycrypt
runHook postInstall runHook postInstall
''; '';