From patchwork Mon Sep 28 00:09:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 7274911 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91EDFBEEA4 for ; Mon, 28 Sep 2015 00:10:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D415A207C7 for ; Mon, 28 Sep 2015 00:10:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1980D207C6 for ; Mon, 28 Sep 2015 00:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753614AbbI1AKH (ORCPT ); Sun, 27 Sep 2015 20:10:07 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:36181 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753398AbbI1AKF (ORCPT ); Sun, 27 Sep 2015 20:10:05 -0400 Received: from deadeye.wl.decadent.org.uk ([192.168.4.247] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1ZgM10-0002sn-0E; Mon, 28 Sep 2015 01:09:58 +0100 Received: from ben by deadeye with local (Exim 4.86) (envelope-from ) id 1ZgM0u-0000Ei-Ss; Mon, 28 Sep 2015 01:09:52 +0100 Message-ID: <1443398992.2517.13.camel@decadent.org.uk> Subject: [PATCH v2 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: Mon, 28 Sep 2015 01:09:52 +0100 In-Reply-To: <1443398870.2517.11.camel@decadent.org.uk> References: <1443398870.2517.11.camel@decadent.org.uk> X-Mailer: Evolution 3.16.5-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.4.247 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 --- v2: Rebase on 4.3-rc3. Add an explanatory comment to check-lc_type.c. Documentation/DocBook/Makefile | 6 ++++++ Makefile | 2 +- scripts/Makefile | 7 +++++-- scripts/check-lc_ctype.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 scripts/check-lc_ctype.c diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 93eff64..d254496 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -69,6 +69,12 @@ installmandocs: mandocs KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref 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 84f4b31..d23d2e9 100644 --- a/Makefile +++ b/Makefile @@ -1336,7 +1336,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 1b26617..fd0d53d 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 @@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto 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..9097ff5 --- /dev/null +++ b/scripts/check-lc_ctype.c @@ -0,0 +1,11 @@ +/* + * Check that a specified locale works as LC_CTYPE. Used by the + * DocBook build system to probe for C.UTF-8 support. + */ + +#include + +int main(void) +{ + return !setlocale(LC_CTYPE, ""); +}