From patchwork Sun Mar 4 10:29:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 881158 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="on6O5sez"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zvK5p6gWjz9sWX for ; Sun, 4 Mar 2018 21:29:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B35AF86972; Sun, 4 Mar 2018 10:29:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5ARh52ey5-PZ; Sun, 4 Mar 2018 10:29:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 880A884288; Sun, 4 Mar 2018 10:29:14 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id C47261C00CC for ; Sun, 4 Mar 2018 10:29:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BA3AF86172 for ; Sun, 4 Mar 2018 10:29:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e7QhzNiPkPho for ; Sun, 4 Mar 2018 10:29:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 1EC1D860FF for ; Sun, 4 Mar 2018 10:29:11 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id 139so10339478wmn.2 for ; Sun, 04 Mar 2018 02:29:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=o6S6XnggQeVUYkx3fz3AdLfIYjirQ18xCklPJl/oGrA=; b=on6O5seze9C2KoGi74e+1eXSdEJ5jmy4C/UcZdFzd+aPHFPmVLUc0xVb65eoxgC+Eo 4/Koq7jN8O2YZlLtVI3RXzS4XMghaxFjmaYn12/5rxIS8VHceYFrbNUSwJwhuwEdiI9L Hkk3AtDw2GF9oSocz+t5S1ABiDKbKupar/KzoUD5SxVc+8ndK+dLh1qr1dal8cCAoiEy f/0Wn3qev3d6M916rhB36W1CU1hUg5PJt2ryx819yKdA+Mgw+FTT0+JKBAKG6VNHRMof lew3zPiQPYkHWGVdyKqUqMchNGeQJNql9u9OZrl+9TVQJ29h824IBG2SCGUt1HEdh+Jk 5kEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=o6S6XnggQeVUYkx3fz3AdLfIYjirQ18xCklPJl/oGrA=; b=LacTK75EMtvYYoqqcFsWQ7pvk1Eb7nh69QeikEfjMLMSq5Fc855Huf0RptGNd/ACu1 dWu0mnDDaqf6nWGpIFpJMK2VsH+iEXphKaB9zGUYjyPfkJ6ymkay8Z+pT5MG/nilckGr PYXn1ABX0Ar7iS5Ap8ibMz6MPnFeL8qgD5uADJQkktDfyXJLIEtM1xM16zy1MP+4CtKr MqFagGX5MYzKhFAG99s9oybGXZg+ESlguxgdvEJF9KBFneYaEOlDtksyzRPFDc6k/68I btJZfWsSyxN9oD6GX3VuaQFEt/ngxsvpSI6BtczfMmSq1N/Sv/+rT3NWKN9UEK9vn8ob q5/w== X-Gm-Message-State: AElRT7FhJSGt+7r1SANYKP8ZM/Qrko6KQfCLIDnV3Ny1uWwXLhaYUojn 7aiOMd0YXT4tseFWHrWWDXWKXA== X-Google-Smtp-Source: AG47ELuodUwgRoP0V7Z1jD1JPjH8WorPuBgl/E2uE4carAajUJHkRGD+IIdFbwglWjkiVtLlwOsm5Q== X-Received: by 10.28.172.130 with SMTP id v124mr5477904wme.16.1520159349376; Sun, 04 Mar 2018 02:29:09 -0800 (PST) Received: from scaer.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id n127sm500941wmb.5.2018.03.04.02.29.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Mar 2018 02:29:08 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 Mar 2018 11:29:04 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: Subject: [Buildroot] [PATCH 2/4] core: find a host UTF-8 locale X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Some packages really want to use an UTF-8 locale, or they break. However, there is no guarantee that any given locale is available on a system. For example,, while most mainstream distros (Debian and derivatives, Fedora...) do have the generic, language-agnostic C.UTF-8 locale, Gentoo does not provide it. So, find the first UTF-8 locale available on the system, and take any that is available. We however do favour using the user-set current locale, then using the language-agnostic C.UTF-8, and eventually any random C.UTF-8 locale. Note: we only need to enforce LC_ALL, because setting it implies everything else: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_02 """ 1. If the LC_ALL environment variable is defined and is not null, the value of LC_ALL shall be used. """ Signed-off-by: "Yann E. MORIN" --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 5fe3a34c47..aca4e66302 100644 --- a/Makefile +++ b/Makefile @@ -363,6 +363,22 @@ ifneq ($(firstword $(HOSTCC_VERSION)),4) HOSTCC_VERSION := $(firstword $(HOSTCC_VERSION)) endif +ifeq ($(BR2_NEEDS_HOST_UTF8_LOCALE),y) +# First, we try to use the user's configured locale (as that's the +# language they'd expect messages to be displayed), then we favour +# a non language-specific locale like C.UTF-8 if one is available, +# so we sort with the C locale to get it at the top. +# This is guaranteed to not be empty, because of the check in +# support/dependencies/dependencies.sh +HOST_UTF8_LOCALE := $(shell \ + ( echo $${LC_ALL:-$${LC_MESSAGES:-$${LANG}}}; \ + locale -a 2>/dev/null |LC_ALL=C sort \ + ) \ + |grep -i -E 'utf-?8' \ + |head -n 1) +HOST_UTF8_LOCALE_ENV := LC_ALL=$(HOST_UTF8_LOCALE) +endif + # Make sure pkg-config doesn't look outside the buildroot tree HOST_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH) unexport PKG_CONFIG_PATH