aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2017-01-18 21:20:31 +0800
committertijl <tijl@FreeBSD.org>2017-01-18 21:20:31 +0800
commitd7b51d6e3b9874fae397ddfa8717c3be71d84edb (patch)
tree62d2805fd9c9c4285034b54a2ccb3f498f302811 /Mk
parent2739bac9ff93a8cdeb834d5da5f0c2720bad7903 (diff)
downloadfreebsd-ports-gnome-d7b51d6e3b9874fae397ddfa8717c3be71d84edb.tar.gz
freebsd-ports-gnome-d7b51d6e3b9874fae397ddfa8717c3be71d84edb.tar.zst
freebsd-ports-gnome-d7b51d6e3b9874fae397ddfa8717c3be71d84edb.zip
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=<locale> that adds LANG=<locale> and LC_ALL=<locale> 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)
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/check-stagedir.sh1
-rw-r--r--Mk/Uses/elixir.mk2
-rw-r--r--Mk/Uses/gem.mk19
-rw-r--r--Mk/bsd.commands.mk2
-rw-r--r--Mk/bsd.port.mk14
5 files changed, 17 insertions, 21 deletions
diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh
index a5febb04183e..1ae6abc0f2d8 100644
--- a/Mk/Scripts/check-stagedir.sh
+++ b/Mk/Scripts/check-stagedir.sh
@@ -12,7 +12,6 @@
# c. Files in plist which are owned by dependencies/MTREEs
set -e
-export LC_ALL=C
. ${SCRIPTSDIR}/functions.sh
diff --git a/Mk/Uses/elixir.mk b/Mk/Uses/elixir.mk
index 0f89c49c2871..dfaf85bdecd7 100644
--- a/Mk/Uses/elixir.mk
+++ b/Mk/Uses/elixir.mk
@@ -44,7 +44,7 @@ ELIXIR_APP_ROOT?= ${PREFIX}/lib/elixir/lib/${ELIXIR_APP_NAME}
ELIXIR_HIDDEN?= "^${ELIXIR_APP_NAME}$$"
ELIXIR_LOCALE?= en_US.UTF-8
MIX_CMD?= ${LOCALBASE}/bin/mix
-MIX_COMPILE?= ${SETENV} ${MIX_ENV} LANG=${ELIXIR_LOCALE} MIX_ENV=${MIX_ENV_NAME} ELIXIR_HIDDEN=${ELIXIR_HIDDEN} ${MIX_CMD} ${MIX_TARGET}
+MIX_COMPILE?= ${SETENV} ${MIX_ENV} LANG=${ELIXIR_LOCALE} LC_ALL=${ELIXIR_LOCALE} MIX_ENV=${MIX_ENV_NAME} ELIXIR_HIDDEN=${ELIXIR_HIDDEN} ${MIX_CMD} ${MIX_TARGET}
MIX_REWRITE?=
MIX_BUILD_DEPS?=
MIX_RUN_DEPS?=
diff --git a/Mk/Uses/gem.mk b/Mk/Uses/gem.mk
index 18eb230dae26..6ea8c99166d3 100644
--- a/Mk/Uses/gem.mk
+++ b/Mk/Uses/gem.mk
@@ -44,23 +44,8 @@ GEM_CACHE?= ${CACHE_DIR}/${GEM_NAME}.gem
GEMSPEC= ${PORTNAME}.gemspec
GEM_ENV+= RB_USER_INSTALL=yes
-.if defined(LANG) && !empty(LANG)
-GEM_ENV+= LANG=${LANG}
-.else
-GEM_ENV+= LANG=en_US.UTF-8
-.endif
-
-.if defined(LC_ALL) && !empty(LC_ALL)
-GEM_ENV+= LC_ALL=${LC_ALL}
-.else
-GEM_ENV+= LC_ALL=en_US.UTF-8
-.endif
-
-.if defined(LC_CTYPE) && !empty(LC_CTYPE)
-GEM_ENV+= LC_CTYPE=${LC_CTYPE}
-.else
-GEM_ENV+= LC_CTYPE=UTF-8
-.endif
+USE_LOCALE?= en_US.UTF-8
+GEM_ENV+= LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE}
PLIST_SUB+= PORTVERSION="${PORTVERSION}" \
REV="${RUBY_GEM}" \
diff --git a/Mk/bsd.commands.mk b/Mk/bsd.commands.mk
index 31227f775f2a..cf9368f80d89 100644
--- a/Mk/bsd.commands.mk
+++ b/Mk/bsd.commands.mk
@@ -88,7 +88,7 @@ SU_CMD?= /usr/bin/su root -c
SYSCTL?= /sbin/sysctl
TAIL?= /usr/bin/tail
TEST?= test # Shell builtin
-TR?= LANG=C /usr/bin/tr
+TR?= /usr/bin/tr
TRUE?= true # Shell builtin
UMOUNT?= /sbin/umount
UNAME?= /usr/bin/uname
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)