diff mbox series

[1/3] scripts: respect an initial LD_LIBRARY_PATH with env_use_destdir

Message ID 20230123014047.84911-2-carenas@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series improve performance of pcre matches | expand

Commit Message

Carlo Marcelo Arenas Belón Jan. 23, 2023, 1:40 a.m. UTC
In the highly unlikely that you would need to invoke a tool with
an out of tree PCRE2 library, it comes handy to set LD_LIBRARY_PATH
to point to such library and not get your setting blown away.

As usual, if no LD_LIBRARY_PATH exists previous to calling the
script, nothing will change.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 scripts/env_use_destdir | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/env_use_destdir b/scripts/env_use_destdir
index 89d989a2..61ef7b26 100755
--- a/scripts/env_use_destdir
+++ b/scripts/env_use_destdir
@@ -21,7 +21,13 @@  if [ -z "${DESTDIR:-}" ] ; then
     exit 1
 fi
 
-export LD_LIBRARY_PATH="$DESTDIR/usr/lib:$DESTDIR/lib"
+if [ -n "${LD_LIBRARY_PATH:-}" ] ; then
+    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DESTDIR/usr/lib:$DESTDIR/lib"
+else
+    LD_LIBRARY_PATH="$DESTDIR/usr/lib:$DESTDIR/lib"
+fi
+
+export LD_LIBRARY_PATH
 if [ -n "${PREFIX:-}" ] ; then
     LD_LIBRARY_PATH="$DESTDIR$PREFIX/lib:$LD_LIBRARY_PATH"
 fi