From be7f1ecbd0b35e36a0910f688c4bbd986549a9c5 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Tue, 2 Apr 2019 14:45:56 +0100 Subject: [PATCH] debian: Build relocatable versions of libcapsule binary tools When built on a system with the oldest glibc version that is to be supported, these tools are suitable for bundling in projects that need to run on an arbitrary host system and make use of libcapsule when preparing a container. Signed-off-by: Simon McVittie <smcv@collabora.com> --- debian/.gitignore | 1 + debian/control | 21 +++++++++++++++++++ debian/libcapsule-tools-relocatable.install | 1 + debian/rules | 23 +++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 debian/libcapsule-tools-relocatable.install diff --git a/debian/.gitignore b/debian/.gitignore index 71b58d210..642ca1661 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -10,6 +10,7 @@ /libcapsule-doc/ /libcapsule-gl-shims/ /libcapsule-tools/ +/libcapsule-tools-relocatable/ /libcapsule-libgl1-shims/ /libcapsule-tests/ /libcapsule0/ diff --git a/debian/control b/debian/control index 9962ebc9b..0b9ebb70e 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ Build-Depends: autoconf-archive <pkg.libcapsule.from-git>, automake, bubblewrap, + chrpath, debhelper, dh-autoreconf, gtk-doc-tools, @@ -73,6 +74,26 @@ Description: . This package contains the files needed to generate libcapsule proxy libraries. +Package: libcapsule-tools-relocatable +Architecture: amd64 i386 +Multi-Arch: same +Section: misc +Depends: + ${shlibs:Depends}, +Description: + libcapsule is a helper library used to implement segregated run-time + dynamic linking proxy libraries - used (for example) to load a library + that has dependencies incompatible with the regular libraries that are + part of the host OS, such as an incompatible libstdc++ version. + . + This package contains relocatable versions of the tools used to enumerate + library symbols and dependencies. After building this package on a system + with the oldest glibc that is to be supported, they can be bundled in + projects that need to run on an arbitrary host system and make use of + libcapsule to prepare a container. To do this, the relocatable tools + must be copied to PATH/bin/TUPLE-capsule-TOOL, and their required + non-glibc libraries (libelf and zlib) must be copied to PATH/lib/TUPLE. + Package: libcapsule-gl-shims Architecture: amd64 i386 Multi-Arch: same diff --git a/debian/libcapsule-tools-relocatable.install b/debian/libcapsule-tools-relocatable.install new file mode 100644 index 000000000..9084c938a --- /dev/null +++ b/debian/libcapsule-tools-relocatable.install @@ -0,0 +1 @@ +usr/lib/libcapsule/relocatable diff --git a/debian/rules b/debian/rules index aaa4d8c16..f2149a6c3 100755 --- a/debian/rules +++ b/debian/rules @@ -6,10 +6,13 @@ dh $@ --with autoreconf binaries := $(shell dh_listpackages) +fake_rpath := /_ORIGIN_/__/lib/${DEB_HOST_MULTIARCH} +real_rpath := $${ORIGIN}/../lib/${DEB_HOST_MULTIARCH} confflags = \ --disable-Werror \ --disable-silent-rules \ --enable-host-prefix=$(DEB_HOST_MULTIARCH)- \ + --enable-tools-rpath='${fake_rpath}' \ --libexecdir=\$${exec_prefix}/lib/libcapsule \ $(NULL) @@ -72,6 +75,26 @@ override_dh_auto_install: ln -s "$$bin" "$(DEB_HOST_GNU_TYPE)-$$tail"; \ done; \ fi + install -d debian/tmp/usr/lib/libcapsule/relocatable + cp -a \ + debian/tmp/usr/bin/*-capsule-capture-libs \ + debian/tmp/usr/bin/*-capsule-elf-dump \ + debian/tmp/usr/bin/*-capsule-symbols \ + debian/tmp/usr/bin/*-capsule-version \ + debian/tmp/usr/lib/libcapsule/relocatable + set -e; for bin in debian/tmp/usr/bin/$(DEB_HOST_MULTIARCH)-*; do \ + case "$$bin" in \ + (*-capsule-mkstublib) \ + ;; \ + (*) \ + chrpath -d "$$bin"; \ + chrpath -l "$$bin" || :; \ + ;; \ + esac; \ + done + chrpath -r '${real_rpath}' \ + debian/tmp/usr/lib/libcapsule/relocatable/$(DEB_HOST_MULTIARCH)-* + chrpath -l debian/tmp/usr/lib/libcapsule/relocatable/* $(MAKE) -C debian/libGL-proxy-build install V=1 $(proxy_vars) \ DESTDIR=$(CURDIR)/debian/libGL-proxy-build/shims install -d debian/tmp/usr/lib/libcapsule/shims/lib/$(DEB_HOST_MULTIARCH) -- GitLab