From patchwork Tue Sep 1 22:49:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 7107391 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 36B189F36E for ; Tue, 1 Sep 2015 22:49:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D042205B8 for ; Tue, 1 Sep 2015 22:49:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1E0D205B1 for ; Tue, 1 Sep 2015 22:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753546AbbIAWte (ORCPT ); Tue, 1 Sep 2015 18:49:34 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:55964 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbbIAWtc (ORCPT ); Tue, 1 Sep 2015 18:49:32 -0400 Received: from deadeye.wl.decadent.org.uk ([192.168.4.249] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1ZWuMn-0003of-5h; Tue, 01 Sep 2015 23:49:25 +0100 Received: from ben by deadeye with local (Exim 4.86) (envelope-from ) id 1ZWuMi-0002Xm-0r; Tue, 01 Sep 2015 23:49:20 +0100 Message-ID: <1441147759.9215.44.camel@decadent.org.uk> Subject: [PATCH 2/2] DocBook: Use a fixed encoding for output From: Ben Hutchings To: Jonathan Corbet Cc: =?ISO-8859-1?Q?J=E9r=E9my?= Bobbio , reproducible-builds@lists.alioth.debian.org, linux-doc@vger.kernel.org, Randy Dunlap , Michal Marek , linux-kbuild Date: Tue, 01 Sep 2015 23:49:19 +0100 In-Reply-To: <1441147632.9215.42.camel@decadent.org.uk> References: <1441147632.9215.42.camel@decadent.org.uk> X-Mailer: Evolution 3.16.3-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.4.249 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the encoding of documents generated by DocBook depends on the current locale. Make the output reproducible independently of the locale, by setting the encoding to UTF-8 (LC_CTYPE=C.UTF-8) by preference, or ASCII (LC_CTYPE=C) as a fallback. LC_CTYPE can normally be overridden by LC_ALL, but the top-level Makefile unsets that. Signed-off-by: Ben Hutchings --- Documentation/DocBook/Makefile | 6 ++++++ Makefile | 2 +- scripts/Makefile | 7 +++++-- scripts/check-lc_ctype.c | 6 ++++++ 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 scripts/check-lc_ctype.c diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 198e9b5..9af25da 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -68,6 +68,12 @@ installmandocs: mandocs #External programs used KERNELDOC = $(srctree)/scripts/kernel-doc DOCPROC = $(objtree)/scripts/docproc +CHECK_LC_CTYPE = $(objtree)/scripts/check-lc_ctype + +# Use a fixed encoding - UTF-8 if the C library has support built-in +# or ASCII if not +LC_CTYPE := $(call try-run, LC_CTYPE=C.UTF-8 $(CHECK_LC_CTYPE),C.UTF-8,C) +export LC_CTYPE XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl XMLTOFLAGS += --skip-validation diff --git a/Makefile b/Makefile index 13270c0..5846c06 100644 --- a/Makefile +++ b/Makefile @@ -1338,7 +1338,7 @@ $(help-board-dirs): help-%: # Documentation targets # --------------------------------------------------------------------------- %docs: scripts_basic FORCE - $(Q)$(MAKE) $(build)=scripts build_docproc + $(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype $(Q)$(MAKE) $(build)=Documentation/DocBook $@ else # KBUILD_EXTMOD diff --git a/scripts/Makefile b/scripts/Makefile index 2016a64..6f0349f 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -7,6 +7,7 @@ # conmakehash: Create chartable # conmakehash: Create arrays for initializing the kernel console tables # docproc: Used in Documentation/DocBook +# check-lc_ctype: Used in Documentation/DocBook HOST_EXTRACFLAGS += -I$(srctree)/tools/include @@ -23,14 +24,16 @@ HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include always := $(hostprogs-y) $(hostprogs-m) # The following hostprogs-y programs are only build on demand -hostprogs-y += unifdef docproc +hostprogs-y += unifdef docproc check-lc_ctype # These targets are used internally to avoid "is up to date" messages -PHONY += build_unifdef build_docproc +PHONY += build_unifdef build_docproc build_check-lc_ctype build_unifdef: $(obj)/unifdef @: build_docproc: $(obj)/docproc @: +build_check-lc_ctype: $(obj)/check-lc_ctype + @: subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-y += mod diff --git a/scripts/check-lc_ctype.c b/scripts/check-lc_ctype.c new file mode 100644 index 0000000..51fe229 --- /dev/null +++ b/scripts/check-lc_ctype.c @@ -0,0 +1,6 @@ +#include + +int main(void) +{ + return !setlocale(LC_CTYPE, ""); +}