summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2009-04-06 09:21:26 +0000
committerPeter Korsgaard <jacmet@sunsite.dk>2009-04-06 09:21:26 +0000
commitb87b4742e0b963e0c265cfd3eee02e79ff6041da (patch)
tree91b3a66d949a96edccd644118bbd985c9103f361 /Makefile
parent4d298a2d3771c177da606e00b916f58be7c629a0 (diff)
downloadbuildroot-novena-b87b4742e0b963e0c265cfd3eee02e79ff6041da.tar.gz
buildroot-novena-b87b4742e0b963e0c265cfd3eee02e79ff6041da.zip
Makefile: add BR2_ENABLE_LOCALE_PURGE to purge unwanted locales
Add BR2_ENABLE_LOCALE_PURGE / BR2_ENABLE_LOCALE_WHITELIST options to remove unwanted locales from the target rootfs. Handy for stuff like the gtk stack, which comes with ~25 MB locales. Works similar to localepurge in Debian, E.G. you provide a white list of wanted locales, and everything else is removed.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 22 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index b360626cd..99a2ceaac 100644
--- a/Makefile
+++ b/Makefile
@@ -264,6 +264,10 @@ include package/*/*.mk
TARGETS+=target-devfiles
+ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
+TARGETS+=target-purgelocales
+endif
+
# target stuff is last so it can override anything else
include target/Makefile.in
@@ -348,6 +352,24 @@ else
find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -delete
endif
+ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
+LOCALE_WHITELIST=$(PROJECT_BUILD_DIR)/locales.nopurge
+LOCALE_NOPURGE=$(strip $(subst ",,$(BR2_ENABLE_LOCALE_WHITELIST)))
+#"))
+
+target-purgelocales:
+ rm -f $(LOCALE_WHITELIST)
+ for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
+
+ 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); \
+ do \
+ grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
+ done; \
+ done
+endif
+
source: $(TARGETS_SOURCE) $(HOST_SOURCE)
_source-check: