Merge pull request #24524 from vbgl/utop_404

utop: fix on OCaml 4.04
This commit is contained in:
Tim Steinbach 2017-04-01 13:45:56 -04:00 committed by GitHub
commit ed5d80d74b

View File

@ -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 = {