From: Yann E. MORIN <hidden> Date: 2016-11-06 20:23:47
Hello All!
This short series is a band-aid to fix the build of tvheadend on systems
where the current locale is not UTF8.
Regards,
Yann E. MORIN.
The following changes since commit d02655cd2157636d6150daf3a1344b25141780c1
package/ser2net: disable threads for toolchains without threads support (2016-11-06 15:11:21 +0100)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 6f09b8c02099896660df1f6cfe177c92d946f01c
package/tvheadend: needs a host with an UTF8 locale (2016-11-06 21:21:34 +0100)
----------------------------------------------------------------
Yann E. MORIN (2):
core: find an UFT8 locale on the host
package/tvheadend: needs a host with an UTF8 locale
Makefile | 3 +++
package/tvheadend/tvheadend.mk | 5 +++--
support/scripts/find-utf8-locale | 48 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 54 insertions(+), 2 deletions(-)
create mode 100755 support/scripts/find-utf8-locale
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
From: Yann E. MORIN <hidden> Date: 2016-11-06 20:23:50
Some packages need an UTF8 locale to build sucessfully, so find one for
them.
We try hard to have a locale as close as possible to the one currently
used by the user, so as to output messages in his language. We first try
any of the current locale settings to see if they are fit, then we look
if said settigns have an UTF8 variant, then look for the same language
for other countries, and finally fallback to some well-known locales.
Signed-off-by: "Yann E. MORIN" <redacted>
Cc: Arnout Vandecappelle <redacted>
Cc: Romain Naour <redacted>
---
Makefile | 3 +++
support/scripts/find-utf8-locale | 48 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
create mode 100755 support/scripts/find-utf8-locale
@@ -244,6 +244,9 @@ export LANG=Cexport LC_ALL=Cendif+# Some packages want an UTF8 locale, so find one.+UTF8_LOCALE:=$(shellsupport/scripts/find-utf8-locale)+# To put more focus on warnings, be less verbose as default# Use 'make V=1' to see the full commandsifeq ("$(origin V)", "command line")
@@ -0,0 +1,48 @@+#!/bin/bash++# Try to find an UTF8 locale.+#+# We try to find a locale that is as close as possible to the one that+# the user currently uses. For that, we look at the same environment+# variables that glibc uses: $LANGUAGE, then $LC_ALL, then $LC_XXX and+# finally $LANG. $LANGUAGE can be a colon-separated list.+# https://www.gnu.org/software/libc/manual/html_node/Using-gettextized-software.html#Using-gettextized-software++# First, see if any of those variables is already an UTF8 locale.+for l in ${LANGUAGE//:/ } ${LC_ALL} ${LC_MESSAGES} ${LANG}; do+ case "${l,,}" in+ (*.utf8|*.utf-8) printf "%s" "${l}"; exit 0;;+ esac+done++# No luck. Try to see if any of those have an UTF8 variant.+for l in ${LANGUAGE//:/ } ${LC_ALL} ${LC_MESSAGES} ${LANG}; do+ l="$(locale -a |grep -i -E "^${l}\.utf.?8" |head -n 1)"+ if [ -n "${l}" ]; then+ printf "%s" "${l}"+ exit 0+ fi+done++# Still no luck. Try to see if we have a locale for the same language,+# but for another country.+for l in ${LANGUAGE//:/ } ${LC_ALL} ${LC_MESSAGES} ${LANG}; do+ l="$(locale -a |grep -i -E "^${l%_*}_.+\.utf.?8" |head -n 1)"+ if [ -n "${l}" ]; then+ printf "%s" "${l}"+ exit 0+ fi+done++# We're really out of luck. Try well-known UTF8 locales.+for l in en_US.utf8 en_GB.utf8 C.UTF-8; do+ l="$(locale -a |grep -i -E "^${l}" |head -n 1)"+ if [ -n "${l}" ]; then+ printf "%s" "${l}"+ exit 0+ fi+done++# We don't have an easy life, no we don't. And we don't have an+# UTF8 locale either... :-(+exit 1
From: Yann E. MORIN <hidden> Date: 2016-11-06 20:23:51
The mkbundle python script requires an UTF8 locale to encode non-ASCII
characters.
Force the locale on the configure, build and install command lines.
Fixes:
http://autobuild.buildroot.org/results/6fe/6fe3331f1f1d54cb977bb61a09d7707f19f7eafa/http://autobuild.buildroot.org/results/d1d/d1dda2c1d5af8fbaa09ecbf4a87f3892369b9e53/
[...]
Signed-off-by: "Yann E. MORIN" <redacted>
Cc: Romain Naour <redacted>
Cc: Arnout Vandecappelle <redacted>
---
There is still a corner case, where the user has a build machine that
has no UTF-8 locale. This is deemed a corner case which we do not want
to address yet for master. Changes in how we handle the UTF8 locale will
come in the -next branch.
---
package/tvheadend/tvheadend.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -88,11 +89,11 @@ define TVHEADEND_CONFIGURE_CMDSendefdefine TVHEADEND_BUILD_CMDS-$(TARGET_MAKE_ENV)$(MAKE)-C$(@D)+$(TARGET_MAKE_ENV)LC_ALL=$(UTF8_LOCALE)$(MAKE)-C$(@D)endefdefine TVHEADEND_INSTALL_TARGET_CMDS-$(TARGET_MAKE_ENV)$(MAKE)-C$(@D)DESTDIR="$(TARGET_DIR)"install+$(TARGET_MAKE_ENV)LC_ALL=$(UTF8_LOCALE)$(MAKE)-C$(@D)DESTDIR="$(TARGET_DIR)"installendef# Remove documentation and source files that are not needed because we
Hi Yann, all,
Le 06/11/2016 ? 21:23, Yann E. MORIN a ?crit :
Some packages need an UTF8 locale to build sucessfully, so find one for
s/sucessfully/successfully/
them.
We try hard to have a locale as close as possible to the one currently
used by the user, so as to output messages in his language. We first try
any of the current locale settings to see if they are fit, then we look
if said settigns have an UTF8 variant, then look for the same language
s/settigns/settings/
for other countries, and finally fallback to some well-known locales.
Tested with:
LC_ALL=fr_FR.utf8
Tested-by: Romain Naour <redacted>
Best regards,
Romain
@@ -244,6 +244,9 @@ export LANG=Cexport LC_ALL=Cendif+# Some packages want an UTF8 locale, so find one.+UTF8_LOCALE:=$(shellsupport/scripts/find-utf8-locale)+# To put more focus on warnings, be less verbose as default# Use 'make V=1' to see the full commandsifeq ("$(origin V)", "command line")
@@ -0,0 +1,48 @@+#!/bin/bash++# Try to find an UTF8 locale.+#+# We try to find a locale that is as close as possible to the one that+# the user currently uses. For that, we look at the same environment+# variables that glibc uses: $LANGUAGE, then $LC_ALL, then $LC_XXX and+# finally $LANG. $LANGUAGE can be a colon-separated list.+# https://www.gnu.org/software/libc/manual/html_node/Using-gettextized-software.html#Using-gettextized-software++# First, see if any of those variables is already an UTF8 locale.+for l in ${LANGUAGE//:/ } ${LC_ALL} ${LC_MESSAGES} ${LANG}; do+ case "${l,,}" in+ (*.utf8|*.utf-8) printf "%s" "${l}"; exit 0;;+ esac+done++# No luck. Try to see if any of those have an UTF8 variant.+for l in ${LANGUAGE//:/ } ${LC_ALL} ${LC_MESSAGES} ${LANG}; do+ l="$(locale -a |grep -i -E "^${l}\.utf.?8" |head -n 1)"+ if [ -n "${l}" ]; then+ printf "%s" "${l}"+ exit 0+ fi+done++# Still no luck. Try to see if we have a locale for the same language,+# but for another country.+for l in ${LANGUAGE//:/ } ${LC_ALL} ${LC_MESSAGES} ${LANG}; do+ l="$(locale -a |grep -i -E "^${l%_*}_.+\.utf.?8" |head -n 1)"+ if [ -n "${l}" ]; then+ printf "%s" "${l}"+ exit 0+ fi+done++# We're really out of luck. Try well-known UTF8 locales.+for l in en_US.utf8 en_GB.utf8 C.UTF-8; do+ l="$(locale -a |grep -i -E "^${l}" |head -n 1)"+ if [ -n "${l}" ]; then+ printf "%s" "${l}"+ exit 0+ fi+done++# We don't have an easy life, no we don't. And we don't have an+# UTF8 locale either... :-(+exit 1
---
There is still a corner case, where the user has a build machine that
has no UTF-8 locale. This is deemed a corner case which we do not want
to address yet for master. Changes in how we handle the UTF8 locale will
come in the -next branch.
---
package/tvheadend/tvheadend.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -88,11 +89,11 @@ define TVHEADEND_CONFIGURE_CMDSendefdefine TVHEADEND_BUILD_CMDS-$(TARGET_MAKE_ENV)$(MAKE)-C$(@D)+$(TARGET_MAKE_ENV)LC_ALL=$(UTF8_LOCALE)$(MAKE)-C$(@D)endefdefine TVHEADEND_INSTALL_TARGET_CMDS-$(TARGET_MAKE_ENV)$(MAKE)-C$(@D)DESTDIR="$(TARGET_DIR)"install+$(TARGET_MAKE_ENV)LC_ALL=$(UTF8_LOCALE)$(MAKE)-C$(@D)DESTDIR="$(TARGET_DIR)"installendef# Remove documentation and source files that are not needed because we