From bca2e8255e4230398edd1f91ce45521d54d6122e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 14 Nov 2019 13:44:07 -0500 Subject: [PATCH] treewide: CAML_LD_LIBRARY_PATH may be undefined --- pkgs/build-support/ocaml/default.nix | 2 +- pkgs/development/compilers/reason/default.nix | 4 ++-- pkgs/development/ocaml-modules/bap/default.nix | 6 +++--- pkgs/development/ocaml-modules/ocsigen-server/default.nix | 2 +- pkgs/development/tools/ocaml/camlidl/default.nix | 2 +- pkgs/development/tools/ocaml/findlib/default.nix | 2 +- pkgs/development/tools/ocaml/utop/default.nix | 1 + 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pkgs/build-support/ocaml/default.nix b/pkgs/build-support/ocaml/default.nix index cc2001c66e2e..3957b955a2c6 100644 --- a/pkgs/build-support/ocaml/default.nix +++ b/pkgs/build-support/ocaml/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation (args // { setupHook = if setupHook == null && hasSharedObjects then writeText "setupHook.sh" '' - export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" + export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" '' else setupHook; diff --git a/pkgs/development/compilers/reason/default.nix b/pkgs/development/compilers/reason/default.nix index 5d7d0ce6684b..20286dcc43c9 100644 --- a/pkgs/development/compilers/reason/default.nix +++ b/pkgs/development/compilers/reason/default.nix @@ -27,8 +27,8 @@ stdenv.mkDerivation rec { postInstall = '' wrapProgram $out/bin/rtop \ --prefix PATH : "${utop}/bin" \ - --set CAML_LD_LIBRARY_PATH ${ocaml_lwt}/lib/ocaml/${ocaml.version}/site-lib:$CAML_LD_LIBRARY_PATH \ - --set OCAMLPATH $out/lib/ocaml/${ocaml.version}/site-lib:$OCAMLPATH + --prefix CAML_LD_LIBRARY_PATH : "${ocaml_lwt}/lib/ocaml/${ocaml.version}/site-lib" \ + --prefix OCAMLPATH : "$out/lib/ocaml/${ocaml.version}/site-lib" ''; meta = with stdenv.lib; { diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix index 0766e6e8a8c5..a988582ce6ce 100644 --- a/pkgs/development/ocaml-modules/bap/default.nix +++ b/pkgs/development/ocaml-modules/bap/default.nix @@ -28,8 +28,8 @@ stdenv.mkDerivation rec { createFindlibDestdir = true; setupHook = writeText "setupHook.sh" '' - export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" - export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}-llvm-plugins/" + export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" + export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}-llvm-plugins/" ''; nativeBuildInputs = [ which makeWrapper ]; @@ -44,7 +44,7 @@ stdenv.mkDerivation rec { installPhase = '' export OCAMLPATH=$OCAMLPATH:$OCAMLFIND_DESTDIR; export PATH=$PATH:$out/bin - export CAML_LD_LIBRARY_PATH=$CAML_LD_LIBRARY_PATH:$OCAMLFIND_DESTDIR/bap-plugin-llvm/:$OCAMLFIND_DESTDIR/bap/ + export CAML_LD_LIBRARY_PATH=''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}$OCAMLFIND_DESTDIR/bap-plugin-llvm/:$OCAMLFIND_DESTDIR/bap/ mkdir -p $out/lib/bap make install rm $out/bin/baptop diff --git a/pkgs/development/ocaml-modules/ocsigen-server/default.nix b/pkgs/development/ocaml-modules/ocsigen-server/default.nix index 426fecf39155..9b0b8c433c2c 100644 --- a/pkgs/development/ocaml-modules/ocsigen-server/default.nix +++ b/pkgs/development/ocaml-modules/ocsigen-server/default.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { '' rm -rf $out/var/run wrapProgram $out/bin/ocsigenserver \ - --prefix CAML_LD_LIBRARY_PATH : "$CAML_LD_LIBRARY_PATH:${mkpath ssl "ssl"}:${mkpath ocamlnet "netsys"}:${mkpath ocamlnet "netstring"}:${mkpath ocaml_pcre "pcre"}:${mkpath ocaml_sqlite3 "sqlite3"}" + --suffix CAML_LD_LIBRARY_PATH : "${mkpath ssl "ssl"}:${mkpath ocamlnet "netsys"}:${mkpath ocamlnet "netstring"}:${mkpath ocaml_pcre "pcre"}:${mkpath ocaml_sqlite3 "sqlite3"}" ''; dontPatchShebangs = true; diff --git a/pkgs/development/tools/ocaml/camlidl/default.nix b/pkgs/development/tools/ocaml/camlidl/default.nix index 09de5b02737b..309c44d6d463 100644 --- a/pkgs/development/tools/ocaml/camlidl/default.nix +++ b/pkgs/development/tools/ocaml/camlidl/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { ''; setupHook = writeText "setupHook.sh" '' - export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" + export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" export NIX_CFLAGS_COMPILE+=" -isystem $1/lib/ocaml/${ocaml.version}/site-lib/camlidl" export NIX_LDFLAGS+=" -L $1/lib/ocaml/${ocaml.version}/site-lib/camlidl" ''; diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix index 6bf34a6e9587..9db5ed10c842 100644 --- a/pkgs/development/tools/ocaml/findlib/default.nix +++ b/pkgs/development/tools/ocaml/findlib/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/" fi if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"; then - export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs" + export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs" fi export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/" if test -n "''${createFindlibDestdir-}"; then diff --git a/pkgs/development/tools/ocaml/utop/default.nix b/pkgs/development/tools/ocaml/utop/default.nix index 290ab9b571f4..f154b94ae336 100644 --- a/pkgs/development/tools/ocaml/utop/default.nix +++ b/pkgs/development/tools/ocaml/utop/default.nix @@ -39,6 +39,7 @@ stdenv.mkDerivation rec { installPhase = '' mkdir -p "$out"/${path} for e in OCAMLPATH CAML_LD_LIBRARY_PATH; do + [[ -v "$e" ]] || continue printf %s "''${!e}" > "$out"/${path}/$e done '';