aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-05-17 22:48:07 -0400
committerEric Sandeen <sandeen@sandeen.net>2022-05-17 22:48:07 -0400
commite63257c0f5350fdbad0804b964af0038195c9291 (patch)
tree8865635c8ea51cf94cc44b8d8058ce07ef305f1e
parent920fd876c7c1455ece2211d75515a5be990e5ec6 (diff)
downloadxfsprogs-dev-e63257c0f5350fdbad0804b964af0038195c9291.tar.gz
debian: support multiarch for libhandle
For nearly a decade now, Debian and derivatives have supported the "multiarch" layout, where shared libraries are installed to /lib/<gcc triple>/ instead of /lib. This enables a single rootfs to support binaries from multiple architectures (e.g. i386 inside an amd64 system). We should follow this, since libhandle is useful. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--configure.ac11
-rwxr-xr-xdebian/rules6
-rw-r--r--include/builddefs.in1
-rw-r--r--m4/multilib.m412
-rw-r--r--scrub/Makefile11
5 files changed, 34 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 348af14751..e24fb0c893 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,11 @@ AC_ARG_ENABLE(lib64,
enable_lib64=yes)
AC_SUBST(enable_lib64)
+AC_ARG_WITH([multiarch],
+[ --with-multiarch=ARCH Specify the multiarch triplet],
+ multiarch=$withval)
+AC_SUBST(multiarch)
+
AC_ARG_ENABLE(librt,
[ --enable-librt=[yes/no] Enable librt support [default=yes]],,
enable_librt=yes)
@@ -110,6 +115,11 @@ lib64)
esac
#
+# If the user specified a multiarch path then disable lib64
+#
+test -n "$multiarch" && enable_lib64=no
+
+#
# Some important tools should be installed into the root partitions.
#
# Check whether exec_prefix=/usr: and install them to /sbin in that
@@ -143,6 +153,7 @@ AC_SUBST(LOCALIZED_FILES)
AC_PACKAGE_GLOBALS(xfsprogs)
AC_PACKAGE_UTILITIES(xfsprogs)
AC_MULTILIB($enable_lib64)
+AC_MULTIARCH($multiarch)
AC_RT($enable_librt)
AC_PACKAGE_NEED_INI_H
diff --git a/debian/rules b/debian/rules
index df023c651f..95df4835b2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,6 +13,7 @@ bootpkg = xfsprogs-udeb
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
version = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
target ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
@@ -28,6 +29,7 @@ stdenv = @GZIP=-q; export GZIP;
configure_options = \
--build=$(DEB_BUILD_GNU_TYPE) \
+ --with-multiarch=$(DEB_HOST_MULTIARCH) \
--host=$(DEB_HOST_GNU_TYPE) \
--disable-ubsan \
--disable-addrsan \
@@ -97,8 +99,8 @@ binary-arch: checkroot built
$(pkgme) $(MAKE) dist
install -D -m 0755 debian/local/initramfs.hook debian/xfsprogs/usr/share/initramfs-tools/hooks/xfs
rmdir debian/xfslibs-dev/usr/share/doc/xfsprogs
- rm -f debian/xfslibs-dev/lib/libhandle.la
- rm -f debian/xfslibs-dev/lib/libhandle.a
+ rm -f debian/xfslibs-dev/lib/$(DEB_HOST_MULTIARCH)/libhandle.la
+ rm -f debian/xfslibs-dev/lib/$(DEB_HOST_MULTIARCH)/libhandle.a
rm -fr debian/xfslibs-dev/usr/lib
dh_installdocs -XCHANGES
dh_installchangelogs
diff --git a/include/builddefs.in b/include/builddefs.in
index 0bb364310d..626db210cc 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -51,6 +51,7 @@ PKG_SBIN_DIR = @sbindir@
PKG_ROOT_SBIN_DIR = @root_sbindir@
PKG_ROOT_LIB_DIR= @root_libdir@@libdirsuffix@
PKG_LIB_DIR = @libdir@@libdirsuffix@
+PKG_LIB_SCRIPT_DIR = @libdir@
PKG_INC_DIR = @includedir@/xfs
DK_INC_DIR = @includedir@/disk
PKG_MAN_DIR = @mandir@
diff --git a/m4/multilib.m4 b/m4/multilib.m4
index 8d991d8d04..862fd8ab09 100644
--- a/m4/multilib.m4
+++ b/m4/multilib.m4
@@ -41,3 +41,15 @@ AC_DEFUN([AC_MULTILIB],
fi
AC_SUBST(libdirsuffix)
])
+
+dnl AC_MULTIARCH creates a variable libdirsuffix containing the suffix of the
+dnl libdir to follow the Debian multiarch spec. (i.e. "/$multiarch")
+AC_DEFUN([AC_MULTIARCH],
+[
+ if test -n "$1"; then
+ libdirsuffix="/$1"
+ AC_MSG_CHECKING([multiarch triplet])
+ AC_MSG_RESULT([$multiarch])
+ fi
+ AC_SUBST(libdirsuffix)
+])
diff --git a/scrub/Makefile b/scrub/Makefile
index 335e1e8de3..74492fb614 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -23,7 +23,7 @@ INSTALL_SCRUB += install-crond
CRONTABS = xfs_scrub_all.cron
OPTIONAL_TARGETS += $(CRONTABS)
# Don't enable the crontab by default for now
-CROND_DIR = $(PKG_LIB_DIR)/$(PKG_NAME)
+CROND_DIR = $(PKG_LIB_SCRIPT_DIR)/$(PKG_NAME)
endif
endif # scrub_prereqs
@@ -119,8 +119,9 @@ install: $(INSTALL_SCRUB)
@echo " [SED] $@"
$(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \
-e "s|@scrub_args@|$(XFS_SCRUB_ARGS)|g" \
- -e "s|@pkg_lib_dir@|$(PKG_LIB_DIR)|g" \
- -e "s|@pkg_name@|$(PKG_NAME)|g" < $< > $@
+ -e "s|@pkg_lib_dir@|$(PKG_LIB_SCRIPT_DIR)|g" \
+ -e "s|@pkg_name@|$(PKG_NAME)|g" \
+ < $< > $@
%.cron: %.cron.in $(builddefs)
@echo " [SED] $@"
@@ -129,8 +130,8 @@ install: $(INSTALL_SCRUB)
install-systemd: default $(SYSTEMD_SERVICES)
$(INSTALL) -m 755 -d $(SYSTEMD_SYSTEM_UNIT_DIR)
$(INSTALL) -m 644 $(SYSTEMD_SERVICES) $(SYSTEMD_SYSTEM_UNIT_DIR)
- $(INSTALL) -m 755 -d $(PKG_LIB_DIR)/$(PKG_NAME)
- $(INSTALL) -m 755 xfs_scrub_fail $(PKG_LIB_DIR)/$(PKG_NAME)
+ $(INSTALL) -m 755 -d $(PKG_LIB_SCRIPT_DIR)/$(PKG_NAME)
+ $(INSTALL) -m 755 xfs_scrub_fail $(PKG_LIB_SCRIPT_DIR)/$(PKG_NAME)
install-crond: default $(CRONTABS)
$(INSTALL) -m 755 -d $(CROND_DIR)