mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: ptxdist@pengutronix.de
Cc: Clemens Gruber <clemens.gruber@pqgruber.com>
Subject: [ptxdist] [PATCH] ptxd_make_world_common.sh: fix meson build for non-Debian distros
Date: Tue, 16 Jan 2018 16:54:32 +0100	[thread overview]
Message-ID: <20180116155432.11130-1-clemens.gruber@pqgruber.com> (raw)

Debian patches glibc to add a special C.UTF-8 locale, which is not
available on most other distros.
For the meson build to work on other distros like ArchLinux, let's grep
the output of locale -a and use C.UTF-8/C.utf8 locale if available or
fall back to the first matching UTF-8 locale.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 scripts/lib/ptxd_make_world_common.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh
index 90f1c70b3..6b7045237 100644
--- a/scripts/lib/ptxd_make_world_common.sh
+++ b/scripts/lib/ptxd_make_world_common.sh
@@ -315,7 +315,16 @@ ptxd_make_world_init() {
 
 	    pkg_conf_opt="${pkg_conf_opt:-${!conf_opt_ptr}}"
 	    pkg_conf_env="PTXDIST_ICECC= ${pkg_conf_env}"
-	    pkg_env="${pkg_env} LC_ALL='C.UTF-8'"
+
+	    # Use Debian C.UTF-8 locale if available or fall back to first one found
+	    local c_locale=$(locale -a | grep -i "^C\.utf[-]\?8$")
+	    if [ ! -z "${c_locale}" ]; then
+		pkg_env="${pkg_env} LC_ALL='${c_locale}'"
+	    else
+		pkg_env="${pkg_env} LC_ALL='$(locale -a | grep -m 1 "\.utf[-]\?8")'"
+	    fi
+	    unset c_locale
+
 	    if [ "${PTXDIST_VERBOSE}" = "1" ]; then
 		pkg_make_opt="-v ${pkg_make_opt}"
 		pkg_install_opt="-v ${pkg_install_opt}"
-- 
2.15.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2018-01-16 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 15:54 Clemens Gruber [this message]
2018-01-17  9:40 ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180116155432.11130-1-clemens.gruber@pqgruber.com \
    --to=clemens.gruber@pqgruber.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox