From 83c18a93ec62820c12fb7174e9803046d0ca1f3c Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 24 Jul 2019 18:20:26 +0100
Subject: [PATCH] build: Don't set RPATH on -wrap without -Drelocatable

If we have built pressure-vessel without bundling the necessary
libraries, then we want it to use libraries from the host system, not
the (probably older) bundled libraries from a different
pressure-vessel build.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 meson.build | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 0987d1f72..8dc2b8593 100644
--- a/meson.build
+++ b/meson.build
@@ -233,6 +233,15 @@ configure_file(
   configuration : conf_data,
 )
 
+if get_option('relocatable')
+  rpath_kwargs = {
+    'build_rpath' : '${ORIGIN}/../' + get_option('libdir'),
+    'install_rpath' : '${ORIGIN}/../' + get_option('libdir'),
+  }
+else
+  rpath_kwargs = {}
+endif
+
 executable(
   'pressure-vessel-wrap',
   sources : [
@@ -254,10 +263,9 @@ executable(
     dependency('xau', required : true),
     subproject('libglnx').get_variable('libglnx_dep'),
   ],
-  build_rpath : '${ORIGIN}/../' + get_option('libdir'),
   install : true,
   install_dir : get_option('bindir'),
-  install_rpath : '${ORIGIN}/../' + get_option('libdir'),
+  kwargs : rpath_kwargs,
 )
 
 if get_option('relocatable')
-- 
GitLab