From 27cbf58fee58c5ae579ac99d830450e332bc574f Mon Sep 17 00:00:00 2001 From: Lars Wendler Date: Mon, 26 Aug 2024 22:58:37 +0200 Subject: [PATCH] Reintroduce split-usr support This reverts commit 91e361f1251617469c70af7a9144643d4d8b71fa. --- configure.ac | 21 +++++++++++++++++++++ debian/Makefile | 4 ++-- debian/local/initramfs.hook | 2 +- debian/rules | 5 +++-- fsck/Makefile | 4 ++-- include/builddefs.in | 2 ++ include/buildmacros | 20 ++++++++++---------- mkfs/Makefile | 4 ++-- repair/Makefile | 4 ++-- 9 files changed, 45 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 5640635b..6466057d 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,27 @@ esac # 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 +# case. If the user chooses a different prefix assume they just want +# a local install for testing and not a system install. +# +case $exec_prefix:$prefix in +NONE:NONE | NONE:/usr | /usr:*) + root_sbindir='/sbin' + root_libdir="/${base_libdir}" + ;; +*) + root_sbindir="${sbindir}" + root_libdir="${libdir}" + ;; +esac + +AC_SUBST([root_sbindir]) +AC_SUBST([root_libdir]) + # Find localized files. Don't descend into any "dot directories" # (like .git or .pc from quilt). Strangely, the "-print" argument # to "find" is required, to avoid including such directories in the diff --git a/debian/Makefile b/debian/Makefile index 2f9cd38c..cafe8bbb 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -31,6 +31,6 @@ endif install-d-i: default ifeq ($(PKG_DISTRIBUTION), debian) - $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) - $(INSTALL) -m 755 $(BOOT_MKFS_BIN) $(PKG_SBIN_DIR)/mkfs.xfs + $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) + $(INSTALL) -m 755 $(BOOT_MKFS_BIN) $(PKG_ROOT_SBIN_DIR)/mkfs.xfs endif diff --git a/debian/local/initramfs.hook b/debian/local/initramfs.hook index eac7e79e..5b24eaec 100644 --- a/debian/local/initramfs.hook +++ b/debian/local/initramfs.hook @@ -45,7 +45,7 @@ rootfs_type() { . /usr/share/initramfs-tools/hook-functions if [ "$(rootfs_type)" = "xfs" ]; then - copy_exec /usr/sbin/xfs_repair + copy_exec /sbin/xfs_repair copy_exec /usr/sbin/xfs_db copy_exec /usr/sbin/xfs_metadump fi diff --git a/debian/rules b/debian/rules index c3fbcd26..d506cc5d 100755 --- a/debian/rules +++ b/debian/rules @@ -106,8 +106,9 @@ 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/usr/lib/$(DEB_HOST_MULTIARCH)/libhandle.la - rm -f debian/xfslibs-dev/usr/lib/$(DEB_HOST_MULTIARCH)/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 dh_strip diff --git a/fsck/Makefile b/fsck/Makefile index 5ca529f5..da9b6ded 100644 --- a/fsck/Makefile +++ b/fsck/Makefile @@ -12,6 +12,6 @@ default: $(LTCOMMAND) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) - $(INSTALL) -m 755 xfs_fsck.sh $(PKG_SBIN_DIR)/fsck.xfs + $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) + $(INSTALL) -m 755 xfs_fsck.sh $(PKG_ROOT_SBIN_DIR)/fsck.xfs install-dev: diff --git a/include/builddefs.in b/include/builddefs.in index 734bd95e..ce637b50 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -48,6 +48,8 @@ datarootdir = @datarootdir@ top_builddir = @top_builddir@ PKG_SBIN_DIR = @sbindir@ +PKG_ROOT_SBIN_DIR = @root_sbindir@ +PKG_ROOT_LIB_DIR= @root_libdir@@libdirsuffix@ PKG_LIB_DIR = @libdir@@libdirsuffix@ PKG_LIBEXEC_DIR = @libexecdir@/@pkg_name@ PKG_INC_DIR = @includedir@/xfs diff --git a/include/buildmacros b/include/buildmacros index 9183e5bc..6f34d7c5 100644 --- a/include/buildmacros +++ b/include/buildmacros @@ -50,16 +50,16 @@ LTINSTALL = $(LIBTOOL) --quiet --mode=install $(INSTALL) LTCOMPILE = $(LIBTOOL) --quiet --tag=CC --mode=compile $(CCF) ifeq ($(ENABLE_SHARED),yes) -LTLDFLAGS += -rpath $(PKG_LIB_DIR) +LTLDFLAGS += -rpath $(PKG_ROOT_LIB_DIR) LTLDFLAGS += -version-info $(LTVERSION) endif ifeq ($(ENABLE_SHARED),yes) INSTALL_LTLIB = \ cd $(TOPDIR)/$(LIBNAME)/.libs; \ - ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \ - ../$(INSTALL) -m 755 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \ - ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR) + ../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \ + ../$(INSTALL) -m 755 -T so_dot_version $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \ + ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_ROOT_LIB_DIR) endif # Libtool thinks the static and shared libs should be in the same dir, so @@ -74,13 +74,13 @@ INSTALL_LTLIB_DEV = \ ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \ ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR); \ ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \ - ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \ - ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \ + ../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \ + ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \ if [ "x$(shell readlink -f $(PKG_LIB_DIR))" != \ - "x$(shell readlink -f $(PKG_LIB_DIR))" ]; then \ - ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \ - ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \ - ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \ + "x$(shell readlink -f $(PKG_ROOT_LIB_DIR))" ]; then \ + ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \ + ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \ + ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \ fi else INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC) diff --git a/mkfs/Makefile b/mkfs/Makefile index a6173083..a0c168e3 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -28,8 +28,8 @@ default: depend $(LTCOMMAND) $(CFGFILES) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) - $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR) + $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) + $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR) $(INSTALL) -m 755 -d $(MKFS_CFG_DIR) $(INSTALL) -m 644 $(CFGFILES) $(MKFS_CFG_DIR) diff --git a/repair/Makefile b/repair/Makefile index a36a95e3..320f2f9a 100644 --- a/repair/Makefile +++ b/repair/Makefile @@ -107,8 +107,8 @@ include $(BUILDRULES) #CFLAGS += ... install: default - $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) - $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR) + $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) + $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR) install-dev: -include .dep -- 2.46.0