diff mbox

[1/2] Makefile: Fix target-purgelocales

Message ID 1349204631-21077-2-git-send-email-gvaxon@gmail.com
State Superseded
Delegated to: Thomas De Schampheleire
Headers show

Commit Message

Valentine Barshak Oct. 2, 2012, 7:03 p.m. UTC
The /usr/share/X11/locale/locale.dir file is needed by libX11.
Removing it breaks locale support in X11. However, make removes
not only directories but also all files, which are not listed
in the BR2_ENABLE_LOCALE_WHITELIST.

This re-creates locale.dir database file where needed.

Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
---
 Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 0128839..009debe 100644
--- a/Makefile
+++ b/Makefile
@@ -478,11 +478,13 @@  target-purgelocales:
 
 	for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
 	do \
-		for lang in $$(cd $$dir; ls .|grep -v man); \
+		(cd $$dir && rm -f locale.dir && \
+		for lang in $$(ls .|grep -v "man\|locale\.dir"); \
 		do \
-			grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
-		done; \
-	done
+			grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$lang; \
+			[ ! -f $$lang/XLC_LOCALE ] || echo "$$lang/XLC_LOCALE: $$lang" >> locale.dir; \
+		done) \
+	done;
 endif
 
 ifneq ($(GENERATE_LOCALE),)