Files
bubblewrap/tests/use-as-subproject/assert-correct-rpath.py
Simon McVittie 7d54d050a2 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>
2022-05-16 10:19:24 +02:00

27 lines
697 B
Python
Executable File

#!/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