[openwrt/openwrt] e2fsprogs: break out libcomerr/libss, FS#1310

LEDE Commits lede-commits at lists.infradead.org
Wed Mar 14 10:53:16 PDT 2018


jow pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/20d63ebc942012040e08bb815a94f40e535b9cf9

commit 20d63ebc942012040e08bb815a94f40e535b9cf9
Author: Andy Walsh <andy.walsh44+github at gmail.com>
AuthorDate: Sat Feb 3 21:00:27 2018 +0100

    e2fsprogs: break out libcomerr/libss, FS#1310
    
    libext2fs breaks krb5 by always installing its own copies of libcom_err.so
    and libss.so.
    
    Move the libraries into separate libcomerr and libss packages respectively
    and add a host build recipe to stage the required compile_et and mk_cmds
    utilities for use by other packages.
    
    This allows the krb5 package to be fixed to use the system wide libcomerr
    and libss libraries.
    
    Signed-off-by: Andy Walsh <andy.walsh44+github at gmail.com>
    [rename libcom_err to libcomerr, make compile_et and mk_cmds relocatable,
     cleanup makefile, add dependency on host build, reword commit message]
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/utils/e2fsprogs/Makefile                   | 88 +++++++++++++++++-----
 .../utils/e2fsprogs/patches/000-relocatable.patch  | 46 +++++++++++
 2 files changed, 117 insertions(+), 17 deletions(-)

diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile
index 068ce3e..eb50fec 100644
--- a/package/utils/e2fsprogs/Makefile
+++ b/package/utils/e2fsprogs/Makefile
@@ -10,30 +10,27 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=e2fsprogs
 PKG_VERSION:=1.43.7
 PKG_HASH:=2a6367289047d68d9ba6a46cf89ab9a1efd0556cde02a51ebaf414ff51edded9
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/
 PKG_LICENSE:=GPL-2.0
 PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs
 
-PKG_BUILD_DEPENDS:=util-linux
+PKG_BUILD_DEPENDS:=util-linux e2fsprogs/host
 PKG_INSTALL:=1
 
 PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
-
-define Package/e2fsprogs/Default
-  URL:=http://e2fsprogs.sourceforge.net/
-  SUBMENU:=Filesystem
-endef
+include $(INCLUDE_DIR)/host-build.mk
 
 define Package/e2fsprogs
-$(call Package/e2fsprogs/Default)
   SECTION:=utils
   CATEGORY:=Utilities
+  SUBMENU:=Filesystem
   TITLE:=Ext2/3/4 filesystem utilities
+  URL:=http://e2fsprogs.sourceforge.net/
   DEPENDS:=+libuuid +libext2fs
 endef
 
@@ -43,17 +40,43 @@ define Package/e2fsprogs/description
 endef
 
 define Package/libext2fs
-$(call Package/e2fsprogs/Default)
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+libuuid +libblkid
   TITLE:=ext2/3/4 filesystem library
+  URL:=http://e2fsprogs.sourceforge.net/
+  DEPENDS:=+libuuid +libblkid +libss +libcomerr
 endef
 
 define Package/libext2fs/description
  libext2fs is a library which can access ext2, ext3 and ext4 filesystems.
 endef
 
+define Package/libss
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=command-line interface parsing library
+  URL:=http://e2fsprogs.sourceforge.net/
+  DEPENDS:=+libcomerr
+endef
+
+define Package/libss/description
+  This pacakge contains libss, a command-line interface parsing library
+  bundled with e2fsprogs.
+endef
+
+define Package/libcomerr
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=common error description library
+  URL:=http://e2fsprogs.sourceforge.net/
+  DEPENDS:=+libuuid
+endef
+
+define Package/libcomerr/description
+  This package contains libcom_err, the common error description library
+  bundled with e2fsprogs.
+endef
+
 define Package/tune2fs
 $(call Package/e2fsprogs)
   TITLE:=Ext2 Filesystem tune utility
@@ -153,11 +176,36 @@ define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_BUILD_DIR)/lib/libext2fs.{so,a}* $(1)/usr/lib
 	$(CP) $(PKG_BUILD_DIR)/lib/libcom_err.{so,a}* $(1)/usr/lib
+	$(CP) $(PKG_BUILD_DIR)/lib/libss.{so,a}* $(1)/usr/lib
 
 	$(INSTALL_DIR) $(1)/usr/include/ext2fs
 	$(CP) $(PKG_BUILD_DIR)/lib/ext2fs/*.h $(1)/usr/include/ext2fs
 	$(INSTALL_DIR) $(1)/usr/include/et
-	$(CP) $(PKG_BUILD_DIR)/lib/et/*.h $(1)/usr/include/et
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/et/*.h $(1)/usr/include/et
+	# Apparently there is some confusion
+	echo "#include <et/com_err.h>" > $(1)/usr/include/com_err.h
+	$(INSTALL_DIR) $(1)/usr/include/ss
+	$(CP) \
+		$(PKG_BUILD_DIR)/lib/ss/ss.h \
+		$(PKG_BUILD_DIR)/lib/ss/ss_err.h \
+		$(1)/usr/include/ss/
+endef
+
+define Host/Compile
+	$(MAKE) $(PKG_JOBS) -C $(HOST_BUILD_DIR)/lib/ss mk_cmds
+	$(MAKE) $(PKG_JOBS) -C $(HOST_BUILD_DIR)/lib/et compile_et
+endef
+
+define Host/Install
+	$(INSTALL_DIR) $(1)/share/et
+	$(CP) $(HOST_BUILD_DIR)/lib/et/et_[ch].awk $(1)/share/et/
+	$(INSTALL_DIR) $(1)/share/ss
+	$(CP) $(HOST_BUILD_DIR)/lib/ss/ct_c.{sed,awk} $(1)/share/ss/
+	$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
+	$(CP) \
+		$(HOST_BUILD_DIR)/lib/et/compile_et \
+		$(HOST_BUILD_DIR)/lib/ss/mk_cmds \
+		$(1)/bin/
 endef
 
 define Package/e2fsprogs/conffiles
@@ -182,15 +230,19 @@ define Package/e2fsprogs/install
 	$(INSTALL_DATA) ./files/e2fsck.conf $(1)/etc/e2fsck.conf
 endef
 
-define Package/libcom_err/install
+define Package/libcomerr/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcom_err.so* $(1)/usr/lib/
+endef
+
+define Package/libss/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libss.so* $(1)/usr/lib/
 endef
 
 define Package/libext2fs/install
 	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) \
-		$(PKG_INSTALL_DIR)/usr/lib/libext2fs.so.* \
-		$(PKG_INSTALL_DIR)/usr/lib/libcom_err.so.* \
-		$(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libext2fs.so.* $(1)/usr/lib/
 endef
 
 define Package/libext2fs/install_lib
@@ -233,7 +285,6 @@ define Package/debugfs/install
 	$(INSTALL_DIR) $(1)/usr/sbin
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/debugfs $(1)/usr/sbin/
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libss.so.* $(1)/usr/lib/
 endef
 
 define Package/chattr/install
@@ -247,6 +298,8 @@ define Package/lsattr/install
 endef
 
 $(eval $(call BuildPackage,e2fsprogs))
+$(eval $(call BuildPackage,libcomerr))
+$(eval $(call BuildPackage,libss))
 $(eval $(call BuildPackage,libext2fs))
 $(eval $(call BuildPackage,tune2fs))
 $(eval $(call BuildPackage,resize2fs))
@@ -257,3 +310,4 @@ $(eval $(call BuildPackage,filefrag))
 $(eval $(call BuildPackage,debugfs))
 $(eval $(call BuildPackage,chattr))
 $(eval $(call BuildPackage,lsattr))
+$(eval $(call HostBuild))
diff --git a/package/utils/e2fsprogs/patches/000-relocatable.patch b/package/utils/e2fsprogs/patches/000-relocatable.patch
new file mode 100644
index 0000000..017aca1
--- /dev/null
+++ b/package/utils/e2fsprogs/patches/000-relocatable.patch
@@ -0,0 +1,46 @@
+--- a/lib/et/compile_et.sh.in
++++ b/lib/et/compile_et.sh.in
+@@ -2,9 +2,15 @@
+ #
+ #
+ 
+-datarootdir=@datarootdir@
+-AWK=@AWK@
+-DIR=@datadir@/et
++if test "x$STAGING_DIR" = x ; then
++	datarootdir=@datarootdir@
++	AWK=@AWK@
++	DIR=@datadir@/et
++else
++	datarootdir="$STAGING_DIR/../hostpkg/share"
++	AWK=awk
++	DIR="$datarootdir/et"
++fi
+ 
+ if test "$1" = "--build-tree" ; then
+     shift;
+--- a/lib/ss/mk_cmds.sh.in
++++ b/lib/ss/mk_cmds.sh.in
+@@ -1,11 +1,17 @@
+ #!/bin/sh
+ #
+ #
+-
+-datarootdir=@datarootdir@
+-DIR=@datadir@/ss
+-AWK=@AWK@
+-SED=@SED@
++if test "x$STAGING_DIR" = x ; then
++	datarootdir=@datarootdir@
++	DIR=@datadir@/ss
++	AWK=@AWK@
++	SED=@SED@
++else
++	datarootdir="$STAGING_DIR/../hostpkg/share"
++	DIR="$datarootdir/ss"
++	AWK=awk
++	SED=sed
++fi
+ 
+ for as_var in \
+   LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \



More information about the lede-commits mailing list