summaryrefslogtreecommitdiff
path: root/tests/use-as-subproject
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-05-10 16:34:06 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2022-05-16 10:19:24 +0200
commit7d54d050a2ef24aa2a88a625ea43fc4ed5e54fd7 (patch)
tree944c5852d90375f6e50192afc44ec2ec921985d2 /tests/use-as-subproject
parentc54bbc6d7b78e7a45016efe0c4ac8af9d209aa20 (diff)
downloadbubblewrap-7d54d050a2ef24aa2a88a625ea43fc4ed5e54fd7.tar.gz
meson: Add options to set a RPATH/RUNPATH on the bwrap executable
This is useful when building a self-contained, relocatable tree containing a build of bubblewrap and all of its non-glibc dependencies (in practice this means libcap and maybe libselinux), as is done in the Steam container runtime. A RPATH/RUNPATH pointing to ${ORIGIN}/../lib allows bwrap to find an adjacent, bundled copy of libcap. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'tests/use-as-subproject')
-rwxr-xr-xtests/use-as-subproject/assert-correct-rpath.py26
-rw-r--r--tests/use-as-subproject/meson.build1
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/use-as-subproject/assert-correct-rpath.py b/tests/use-as-subproject/assert-correct-rpath.py
new file mode 100755
index 0000000..10b0947
--- /dev/null
+++ b/tests/use-as-subproject/assert-correct-rpath.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: LGPL-2.0-or-later
+
+import subprocess
+import sys
+
+if __name__ == '__main__':
+ completed = subprocess.run(
+ ['objdump', '-T', '-x', sys.argv[1]],
+ stdout=subprocess.PIPE,
+ )
+ stdout = completed.stdout
+ assert stdout is not None
+ seen_rpath = False
+
+ for line in stdout.splitlines():
+ words = line.strip().split()
+
+ if words and words[0] in (b'RPATH', b'RUNPATH'):
+ print(line.decode(errors='backslashreplace'))
+ assert len(words) == 2, words
+ assert words[1] == b'${ORIGIN}/../lib', words
+ seen_rpath = True
+
+ assert seen_rpath
diff --git a/tests/use-as-subproject/meson.build b/tests/use-as-subproject/meson.build
index 802fd61..bc4781c 100644
--- a/tests/use-as-subproject/meson.build
+++ b/tests/use-as-subproject/meson.build
@@ -14,6 +14,7 @@ configure_file(
subproject(
'bubblewrap',
default_options : [
+ 'install_rpath=${ORIGIN}/../lib',
'program_prefix=not-flatpak-',
],
)