浏览代码

Detect early if an UTF-8 locale is needed

Check in toolchain/dependencies/dependencies.sh if an UTF-8 locale is
properly present on the system before trying to build a locale enabled
toolchain. As this test is only needed when a locale enabled toolchain
is going to be built, we pass the configuration file path to the
dependencies.sh script so that it can grep for the current value of
various options.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thomas Petazzoni 15 年之前
父节点
当前提交
01c1279f9f
共有 2 个文件被更改,包括 13 次插入0 次删除
  1. 1 0
      toolchain/dependencies/dependencies.mk
  2. 12 0
      toolchain/dependencies/dependencies.sh

+ 1 - 0
toolchain/dependencies/dependencies.mk

@@ -16,6 +16,7 @@ endif
 dependencies: host-sed $(DEPENDENCIES_HOST_PREREQ)
 	@HOSTCC="$(firstword $(HOSTCC))" MAKE="$(MAKE)" \
 		HOST_SED_DIR="$(HOST_SED_DIR)" \
+		CONFIG_FILE="$(CONFIG_DIR)/.config" \
 		$(TOPDIR)/toolchain/dependencies/dependencies.sh
 
 dependencies-source:

+ 12 - 0
toolchain/dependencies/dependencies.sh

@@ -152,3 +152,15 @@ for prog in awk bison flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio p
 	exit 1;
     fi
 done
+
+if grep ^BR2_TOOLCHAIN_BUILDROOT=y $CONFIG_FILE > /dev/null && \
+   grep ^BR2_ENABLE_LOCALE=y       $CONFIG_FILE > /dev/null ; then
+   if ! which locale > /dev/null ; then
+       /bin/echo -e "\nYou need locale support on your build machine to build a toolchain supporting locales\n"
+       exit 1 ;
+   fi
+   if ! locale -a | grep -i utf8$ ; then
+       /bin/echo -e "\nYou need at least one UTF8 locale to build a toolchain supporting locales\n"
+       exit 1 ;
+   fi
+fi