All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] Makefile: Parallelize glibc locale generation
@ 2021-01-03 14:04 Gleb Mazovetskiy
  0 siblings, 0 replies; only message in thread
From: Gleb Mazovetskiy @ 2021-01-03 14:04 UTC (permalink / raw)
  To: buildroot

Parallelizes locale generation based on `BR2_JLEVEL` setting.

Uses `-P` (`--max-procs`) GNU xargs extension
together with the standard `-n` xargs option (`--max-args`).

Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
---
 Makefile | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 4d334adcd6..2ad60f3e42 100644
--- a/Makefile
+++ b/Makefile
@@ -673,20 +673,19 @@ PACKAGES += host-localedef
 
 define GENERATE_GLIBC_LOCALES
 	$(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
-	$(Q)for locale in $(GLIBC_GENERATE_LOCALES) ; do \
-		inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
-		charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
-		if test -z "$${charmap}" ; then \
-			charmap="UTF-8" ; \
-		fi ; \
-		echo "Generating locale $${inputfile}.$${charmap}" ; \
-		I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
+	$(Q)echo "Generating locales: $(GLIBC_GENERATE_LOCALES)"
+	for locale in $(GLIBC_GENERATE_LOCALES) ; do \
+		echo -i ; \
+		echo $${locale%%.*} ; \
+		echo -f ; \
+		echo $${locale} | cut -f2 -d'.' || echo UTF-8 ; \
+		echo $${locale} ; \
+	done | \
+	I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
+	$(Q)xargs -P $(PARALLEL_JOBS) -n 5 \
 		$(HOST_DIR)/bin/localedef \
 			--prefix=$(TARGET_DIR) \
-			--$(call LOWERCASE,$(BR2_ENDIAN))-endian \
-			-i $${inputfile} -f $${charmap} \
-			$${locale} ; \
-	done
+			--$(call LOWERCASE,$(call qstrip,$(BR2_ENDIAN)))-endian
 endef
 TARGET_FINALIZE_HOOKS += GENERATE_GLIBC_LOCALES
 endif
-- 
2.27.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-03 14:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-03 14:04 [Buildroot] [PATCH v2 1/1] Makefile: Parallelize glibc locale generation Gleb Mazovetskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.