Merge pull request #25122 from pmahoney/ocaml-utop
ocamlPackages.utop: fix environment variables
This commit is contained in:
commit
6955d02309
@ -1,10 +1,10 @@
|
|||||||
{ stdenv, fetchurl, libev, ocaml, findlib, ocamlbuild, ocaml_lwt, ocaml_react, zed }:
|
{ stdenv, buildOcaml, fetchurl, libev, ocaml, findlib, ocamlbuild, ocaml_lwt, ocaml_react, zed }:
|
||||||
|
|
||||||
assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.01";
|
assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.01";
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
buildOcaml rec {
|
||||||
version = "1.10";
|
version = "1.10";
|
||||||
name = "lambda-term-${version}";
|
name = "lambda-term";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/diml/lambda-term/archive/${version}.tar.gz";
|
url = "https://github.com/diml/lambda-term/archive/${version}.tar.gz";
|
||||||
@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
createFindlibDestdir = true;
|
createFindlibDestdir = true;
|
||||||
|
|
||||||
|
hasSharedObjects = true;
|
||||||
|
|
||||||
meta = { description = "Terminal manipulation library for OCaml";
|
meta = { description = "Terminal manipulation library for OCaml";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
Lambda-term is a cross-platform library for
|
Lambda-term is a cross-platform library for
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchzip, which, cryptopp, ocaml, findlib, ocamlbuild, camlp4
|
{ stdenv, buildOcaml, fetchzip, which, cryptopp, ocaml, findlib, ocamlbuild, camlp4
|
||||||
, ocaml_react, ocaml_ssl, libev, pkgconfig, ncurses, ocaml_oasis, glib
|
, ocaml_react, ocaml_ssl, libev, pkgconfig, ncurses, ocaml_oasis, glib
|
||||||
, ppx_tools, result, cppo
|
, ppx_tools, result, cppo
|
||||||
, ppxSupport ? stdenv.lib.versionAtLeast ocaml.version "4.02"
|
, ppxSupport ? stdenv.lib.versionAtLeast ocaml.version "4.02"
|
||||||
@ -15,8 +15,8 @@ let param =
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
buildOcaml rec {
|
||||||
name = "ocaml-lwt-${version}";
|
name = "lwt";
|
||||||
inherit (param) version;
|
inherit (param) version;
|
||||||
|
|
||||||
src = fetchzip {
|
src = fetchzip {
|
||||||
@ -36,6 +36,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
createFindlibDestdir = true;
|
createFindlibDestdir = true;
|
||||||
|
|
||||||
|
hasSharedObjects = true;
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
homepage = http://ocsigen.org/lwt;
|
homepage = http://ocsigen.org/lwt;
|
||||||
description = "Lightweight thread library for Objective Caml";
|
description = "Lightweight thread library for Objective Caml";
|
||||||
|
@ -28,21 +28,41 @@ stdenv.mkDerivation rec {
|
|||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
|
|
||||||
postFixup =
|
postFixup =
|
||||||
let p = p: "${p}/lib/ocaml/${ocaml.version}/site-lib"; in
|
let
|
||||||
''
|
path = "etc/utop/env";
|
||||||
pushd $out/bin
|
|
||||||
for prog in *
|
# derivation of just runtime deps so env vars created by
|
||||||
do
|
# setup-hooks can be saved for use at runtime
|
||||||
mv $prog .$prog-wrapped
|
runtime = stdenv.mkDerivation rec {
|
||||||
cat > $prog <<EOF
|
name = "utop-runtime-env-${version}";
|
||||||
#!${bash}/bin/bash -e
|
|
||||||
export CAML_LD_LIBRARY_PATH="${p ocaml_lwt}/lwt:${p lambdaTerm}/lambda-term:\$CAML_LD_LIBRARY_PATH"
|
buildInputs = [ findlib ] ++ propagatedBuildInputs;
|
||||||
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 \$*
|
phases = [ "installPhase" ];
|
||||||
EOF
|
|
||||||
chmod +x $prog
|
installPhase = ''
|
||||||
|
mkdir -p "$out"/${path}
|
||||||
|
for e in OCAMLPATH CAML_LD_LIBRARY_PATH; do
|
||||||
|
printf %s "''${!e}" > "$out"/${path}/$e
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
get = key: ''$(cat "${runtime}/${path}/${key}")'';
|
||||||
|
in ''
|
||||||
|
for prog in "$out"/bin/*
|
||||||
|
do
|
||||||
|
|
||||||
|
# Note: wrapProgram by default calls 'exec -a $0 ...', but this
|
||||||
|
# breaks utop on Linux with OCaml 4.04, and is disabled with
|
||||||
|
# '--argv0 ""' flag. See https://github.com/NixOS/nixpkgs/issues/24496
|
||||||
|
wrapProgram "$prog" \
|
||||||
|
--argv0 "" \
|
||||||
|
--prefix CAML_LD_LIBRARY_PATH ":" "${get "CAML_LD_LIBRARY_PATH"}" \
|
||||||
|
--prefix OCAMLPATH ":" "${get "OCAMLPATH"}" \
|
||||||
|
--prefix OCAMLPATH ":" $(unset OCAMLPATH; addOCamlPath "$out"; printf %s "$OCAMLPATH")
|
||||||
|
|
||||||
done
|
done
|
||||||
popd
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user