ocamlPackages.findlib: don't wait configurePhase to set OCAMLFIND_DESTDIR

this fixes ocamlfind printconf destdir inside nix-shell

fixes #152028

the regression was introduced by
a3ab43d3a4 which was meant to fix building
ocamlPackages.ocamlbuild with strictDeps. This commit keeps ocamlbuild
building.
This commit is contained in:
Guillaume Girol 2021-12-26 12:00:00 +00:00
parent cb372c3b88
commit 79fb9f824e

View File

@ -36,15 +36,21 @@ stdenv.mkDerivation rec {
export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"
fi
}
createOcamlDestDir () {
exportOcamlDestDir () {
export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/"
}
createOcamlDestDir () {
if test -n "''${createFindlibDestdir-}"; then
mkdir -p $OCAMLFIND_DESTDIR
fi
}
# run for every buildInput
addEnvHooks "$targetOffset" addOCamlPath
# run before configurePhase, even without buildInputs, and not in nix-shell
preConfigureHooks+=(createOcamlDestDir)
# run even in nix-shell, and even without buildInputs
addEnvHooks "$hostOffset" exportOcamlDestDir
'';
meta = {