]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
debian: support multiarch for libhandle
authorDarrick J. Wong <djwong@kernel.org>
Wed, 18 May 2022 02:48:07 +0000 (22:48 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 18 May 2022 02:48:07 +0000 (22:48 -0400)
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>
configure.ac
debian/rules
include/builddefs.in
m4/multilib.m4
scrub/Makefile

index 348af147518edca45cba1144244ebe5d3e349e7f..e24fb0c8934e77c2ec947e403d22f26c3fcbf274 100644 (file)
@@ -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)
@@ -109,6 +114,11 @@ lib64)
   enable_lib64=no
 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.
 #
@@ -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
index df023c651f122f2003cb8c68286d61e352c99d14..95df4835b2536fb6159b5a8e83fb67a23ddbe56e 100755 (executable)
@@ -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
index 0bb364310d783e1303cd12fa8662743b1368c870..626db210cc04313a4b553007307510d8e3768849 100644 (file)
@@ -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@
index 8d991d8d04dd3d2947f72c4252f3c9a98af1e96c..862fd8ab09c1b87e1775fb95870532e5cb69d427 100644 (file)
@@ -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)
+])
index 335e1e8de3799e4342ed080d02f76d573bf1c931..74492fb6141d3541bba26abbec5390b941e25d8f 100644 (file)
@@ -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)