From 73d56251860e2c3b375b18530d65b93f3a4ae404 Mon Sep 17 00:00:00 2001
From: Ludovico de Nittis <ludovico.denittis@collabora.com>
Date: Wed, 11 Nov 2020 17:36:32 +0100
Subject: [PATCH] pressure-vessel-unruntime: Support
 PRESSURE_VESSEL_APP_LD_LIBRARY_PATH

This supports the new environment variable
"PRESSURE_VESSEL_APP_LD_LIBRARY_PATH" that "_v2-entry-point" will set.

The new variable has the advantage to support the eventual custom
"LD_LIBRARY_PATH" from game launch options.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
---
 pressure-vessel/pressure-vessel-unruntime | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pressure-vessel/pressure-vessel-unruntime b/pressure-vessel/pressure-vessel-unruntime
index e74fe332b..4bf4d59c6 100755
--- a/pressure-vessel/pressure-vessel-unruntime
+++ b/pressure-vessel/pressure-vessel-unruntime
@@ -69,6 +69,10 @@ unset STEAM_RUNTIME
 
 if [ -n "${SYSTEM_LD_LIBRARY_PATH+set}" ]; then
     options+=("--env-if-host=SYSTEM_LD_LIBRARY_PATH=$SYSTEM_LD_LIBRARY_PATH")
+    # This has been superseeded by the new $PRESSURE_VESSEL_APP_LD_LIBRARY_PATH
+    # environment variable. When we are sure that we are always using the new
+    # _v2-entry-point with $PRESSURE_VESSEL_APP_LD_LIBRARY_PATH support, the
+    # following export can be removed
     export LD_LIBRARY_PATH="$SYSTEM_LD_LIBRARY_PATH"
 fi
 
@@ -90,6 +94,13 @@ unset SYSTEM_LD_LIBRARY_PATH
 unset SYSTEM_LD_PRELOAD
 unset SYSTEM_PATH
 
+if [ -n "${PRESSURE_VESSEL_APP_LD_LIBRARY_PATH+set}" ]; then
+    options+=("--env-if-host=PRESSURE_VESSEL_APP_LD_LIBRARY_PATH=$PRESSURE_VESSEL_APP_LD_LIBRARY_PATH")
+    export LD_LIBRARY_PATH="$PRESSURE_VESSEL_APP_LD_LIBRARY_PATH"
+fi
+
+unset PRESSURE_VESSEL_APP_LD_LIBRARY_PATH
+
 old_IFS="$IFS"
 IFS=":"
 for word in $ld_preload; do
-- 
GitLab