utop: fix on OCaml 4.04

Don’t strip the binary
The wrapper directly calls ocamlrun
This commit is contained in:
Vincent Laporte 2017-04-01 07:39:13 +02:00
parent a41668f441
commit 033c5debbc

@ -25,14 +25,24 @@ stdenv.mkDerivation rec {
make doc
'';
dontStrip = true;
postFixup =
let ocamlVersion = (builtins.parseDrvName (ocaml.name)).version;
in
let p = p: "${p}/lib/ocaml/${ocaml.version}/site-lib"; in
''
for prog in "$out"/bin/*
pushd $out/bin
for prog in *
do
wrapProgram $prog --set CAML_LD_LIBRARY_PATH "${ocaml_lwt}"/lib/ocaml/${ocamlVersion}/site-lib/lwt/:"${lambdaTerm}"/lib/ocaml/${ocamlVersion}/site-lib/lambda-term/:'$CAML_LD_LIBRARY_PATH' --set OCAMLPATH "${ocaml_lwt}"/lib/ocaml/${ocamlVersion}/site-lib:${ocaml_react}/lib/ocaml/${ocamlVersion}/site-lib:${camomile}/lib/ocaml/${ocamlVersion}/site-lib:${zed}/lib/ocaml/${ocamlVersion}/site-lib:${lambdaTerm}/lib/ocaml/${ocamlVersion}/site-lib:"$out"/lib/ocaml/${ocamlVersion}/site-lib:'$OCAMLPATH'
mv $prog .$prog-wrapped
cat > $prog <<EOF
#!/bin/sh
export CAML_LD_LIBRARY_PATH=${p ocaml_lwt}/lwt:${p lambdaTerm}/lambda-term:'\$CAML_LD_LIBRARY_PATH'
export OCAMLPATH=${p ocaml_lwt}:${p ocaml_react}:${p camomile}:${p zed}:${p lambdaTerm}:"$out"/lib/ocaml/${ocaml.version}/site-lib:'\$OCAMLPATH'
${ocaml}/bin/ocamlrun $out/bin/.$prog-wrapped \$*
EOF
chmod +x $prog
done
popd
'';
meta = {