From 02f27a83b44d4566fd409edc60570ac0734eb63e Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Wed, 18 Jan 2017 13:20:31 +0000 Subject: The output of tools like awk, date, sort, tr,... depends on the current locale set by the user. Add LANG=C and LC_ALL=C at the beginning of bsd.port.mk and export them so all commands are executed with the C locale. LC_ALL=C overrides all other LC_* variables. LANG is used by setlocale(3) as default value for LC_* variables, so normally it isn't used when LC_ALL is set, but there's code out there that looks at LANG directly so it's safer to set it as well. The only commands not captured by this are != assignments before any inclusion of bsd.port.*mk. Introduce USE_LOCALE= that adds LANG= and LC_ALL= to CONFIGURE_ENV and MAKE_ENV so upstream build systems can be executed with a different locale (e.g. USE_LOCALE=en_US.UTF-8). PR: 215882 Exp-run by: antoine Approved by: portmgr (antoine) --- Mk/bsd.port.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Mk/bsd.port.mk') diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 361ea58a0b3f..9cafcbe77604 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -348,7 +348,10 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # can be used in Makefiles by port maintainers # if a port breaks with it (it should be # extremely rare). -# +## +# USE_LOCALE - LANG and LC_ALL are set to the value of this variable in +# CONFIGURE_ENV and MAKE_ENV. Example: USE_LOCALE=en_US.UTF-8 +## # USE_GCC - If set, this port requires this version of gcc, either in # the system or installed from a port. # USE_CSTD - Override the default C language standard (gnu89, gnu99) @@ -1035,6 +1038,10 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # Most port authors should not need to understand anything after this point. # +LANG= C +LC_ALL= C +.export LANG LC_ALL + # These need to be absolute since we don't know how deep in the ports # tree we are and thus can't go relative. They can, of course, be overridden # by individual Makefiles or local system make configuration. @@ -1904,6 +1911,11 @@ ${_f}_ARGS:= ${f:C/^[^\:]*(\:|\$)//:S/,/ /g} .include "${USESDIR}/${f:C/\:.*//}.mk" .endfor +.if defined(USE_LOCALE) +CONFIGURE_ENV+= LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE} +MAKE_ENV+= LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE} +.endif + .if defined(USE_XORG) # Add explicit X options to avoid problems with false positives in configure .if defined(GNU_CONFIGURE) -- cgit v1.2.3