LOCALE_WHITELIST = $(BUILD_DIR)/locales.nopurge
LOCALE_NOPURGE = $(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
+# This piece of junk does the following:
+# First collect the whitelist in a file.
+# Then go over all the locale dirs and for each subdir, check if it exists
+# in the whitelist file. If it doesn't, kill it.
+# Finally, specifically for X11, regenerate locale.dir from the whitelist.
define PURGE_LOCALES
rm -f $(LOCALE_WHITELIST)
for i in $(LOCALE_NOPURGE) locale-archive; do echo $$i >> $(LOCALE_WHITELIST); done
grep -qx $${langdir##*/} $(LOCALE_WHITELIST) || rm -rf $$langdir; \
done; \
done
+ if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
+ then \
+ for lang in $(LOCALE_NOPURGE); \
+ do \
+ if [ -f $(TARGET_DIR)/usr/share/X11/locale/$$lang/XLC_LOCALE ]; \
+ then \
+ echo "$$lang/XLC_LOCALE: $$lang"; \
+ fi \
+ done > $(TARGET_DIR)/usr/share/X11/locale/locale.dir; \
+ fi
endef
TARGET_FINALIZE_HOOKS += PURGE_LOCALES
endif