[openwrt/openwrt] gettext-full: override SUBDIRS variable with Makefile

LEDE Commits lede-commits at lists.infradead.org
Thu May 4 11:07:24 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/ca8577f930713999fe27bdb2bd8c33ac8afb5bc8

commit ca8577f930713999fe27bdb2bd8c33ac8afb5bc8
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Sat Apr 15 19:54:43 2023 -0400

    gettext-full: override SUBDIRS variable with Makefile
    
    Instead of editing the SUBDIRS variable with a patch,
    it can be overriden at the end of the command line when invoking Make.
    
    This tool has a series of recursive Makefiles in each subdirectory,
    therefore SUBDIRS is set to a pattern of Make functions
    so that the result is variable depending on the current subdirectory
    that Make is being invoked in.
    
    Some of the subdirectories don't have a Makefile and are just storing files
    for another subdirectory Makefile target,
    therefore we have to place a fake Makefile that does nothing.
    
    Signed-off-by: Michael Pratt <mcpratt at pm.me>
---
 package/libs/gettext-full/Makefile                 | 45 +++++++++++++++++++++-
 .../patches/001-no_examples_and_tests.patch        | 22 -----------
 2 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/package/libs/gettext-full/Makefile b/package/libs/gettext-full/Makefile
index 2319401baf..6e185a37ab 100644
--- a/package/libs/gettext-full/Makefile
+++ b/package/libs/gettext-full/Makefile
@@ -27,6 +27,35 @@ PKG_BUILD_DEPENDS:=gettext-full/host
 PKG_BUILD_PARALLEL:=0
 HOST_BUILD_PARALLEL:=0
 
+PKG_SUBDIRS:= \
+	$$$$(foreach dir, \
+		intl \
+		intl-csharp \
+		intl-java \
+		its \
+		gnulib-lib \
+		gnulib-local \
+		lib \
+		$$$$(SUBDIR_libasprintf) \
+		libgettextpo \
+		libgrep \
+		libtextstyle \
+		m4 \
+		misc \
+		po \
+		projects \
+		src \
+		styles \
+		gettext-runtime \
+		gettext-tools \
+	,$$$$(wildcard $$$$(dir)) )
+
+PKG_MAKEFILES_FAKE:= \
+	gnulib-local/m4/Makefile \
+	libtextstyle/gnulib-local/Makefile \
+	libtextstyle/m4/Makefile \
+	m4/Makefile
+
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
 
@@ -75,6 +104,16 @@ HOST_CONFIGURE_VARS += \
 
 HOST_CFLAGS += $(HOST_FPIC)
 
+define Host/Compile
+	$(foreach makefile,$(PKG_MAKEFILES_FAKE),printf '%s\n%s\n' 'all:' 'install:' > $(HOST_BUILD_DIR)/$(makefile); )
+	$(call Host/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)')
+endef
+
+define Build/Compile
+	$(foreach makefile,$(PKG_MAKEFILES_FAKE),printf '%s\n%s\n' 'all:' 'install:' > $(PKG_BUILD_DIR)/$(makefile); )
+	$(call Build/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)')
+endef
+
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/lib/libintl-full/include
 	$(CP) $(PKG_INSTALL_DIR)/usr/include/libintl.h $(1)/usr/lib/libintl-full/include/
@@ -89,10 +128,14 @@ define Build/InstallDev
 endef
 
 define Host/Install
-	$(call Host/Install/Default)
+	$(call Host/Compile/Default,install SUBDIRS='$(PKG_SUBDIRS)')
 	$(LN) msgfmt $(STAGING_DIR_HOSTPKG)/bin/gmsgfmt
 endef
 
+define Build/Install
+	$(call Build/Install/Default,install SUBDIRS='$(PKG_SUBDIRS)')
+endef
+
 define Package/libintl-full/install
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libintl.so.* $(1)/usr/lib/
diff --git a/package/libs/gettext-full/patches/001-no_examples_and_tests.patch b/package/libs/gettext-full/patches/001-no_examples_and_tests.patch
deleted file mode 100644
index d813d20ed6..0000000000
--- a/package/libs/gettext-full/patches/001-no_examples_and_tests.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- a/gettext-runtime/Makefile.am
-+++ b/gettext-runtime/Makefile.am
-@@ -27,7 +27,7 @@ SUBDIR_libasprintf = libasprintf
- else
- SUBDIR_libasprintf =
- endif
--SUBDIRS = doc intl intl-java intl-csharp gnulib-lib $(SUBDIR_libasprintf) src po man m4 tests
-+SUBDIRS = intl intl-java intl-csharp gnulib-lib $(SUBDIR_libasprintf) src po m4
- 
- EXTRA_DIST = BUGS
- 
---- a/gettext-tools/Makefile.am
-+++ b/gettext-tools/Makefile.am
-@@ -19,7 +19,7 @@
- AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
- ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
- 
--SUBDIRS = intl gnulib-lib libgrep src libgettextpo po its projects styles emacs misc man m4 tests system-tests gnulib-tests examples doc
-+SUBDIRS = intl gnulib-lib libgrep src libgettextpo po its projects styles misc m4
- 
- EXTRA_DIST = misc/DISCLAIM
- MOSTLYCLEANFILES = core *.stackdump




More information about the lede-commits mailing list