Return-Path: 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 Message-ID: <1443398992.2517.13.camel@decadent.org.uk> Subject: [PATCH v2 2/2] DocBook: Use a fixed encoding for output From: Ben Hutchings 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> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-hR5s2AfaelOdsaljA0Ss" Mime-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org List-ID: 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 --=-hR5s2AfaelOdsaljA0Ss Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3DC.UTF-8) by preference, or ASCII (LC_CTYPE=3DC) 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/Makefil= e index 93eff64..d254496 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -69,6 +69,12 @@ installmandocs: mandocs KERNELDOCXMLREF =3D $(srctree)/scripts/kernel-doc-xml-ref KERNELDOC =3D $(srctree)/scripts/kernel-doc DOCPROC =3D $(objtree)/scripts/docproc +CHECK_LC_CTYPE =3D $(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 :=3D $(call try-run, LC_CTYPE=3DC.UTF-8 $(CHECK_LC_CTYPE),C.UTF-8= ,C) +export LC_CTYPE =20 XMLTOFLAGS =3D -m $(srctree)/$(src)/stylesheet.xsl XMLTOFLAGS +=3D --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)=3Dscripts build_docproc + $(Q)$(MAKE) $(build)=3Dscripts build_docproc build_check-lc_ctype $(Q)$(MAKE) $(build)=3DDocumentation/DocBook $@ =20 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 =20 HOST_EXTRACFLAGS +=3D -I$(srctree)/tools/include =20 @@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert =3D -lcrypto always :=3D $(hostprogs-y) $(hostprogs-m) =20 # The following hostprogs-y programs are only build on demand -hostprogs-y +=3D unifdef docproc +hostprogs-y +=3D unifdef docproc check-lc_ctype =20 # These targets are used internally to avoid "is up to date" messages -PHONY +=3D build_unifdef build_docproc +PHONY +=3D build_unifdef build_docproc build_check-lc_ctype build_unifdef: $(obj)/unifdef @: build_docproc: $(obj)/docproc @: +build_check-lc_ctype: $(obj)/check-lc_ctype + @: =20 subdir-$(CONFIG_MODVERSIONS) +=3D genksyms subdir-y +=3D 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, ""); +} --=20 Ben Hutchings All extremists should be taken out and shot. --=-hR5s2AfaelOdsaljA0Ss Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUAVgiFUOe/yOyVhhEJAQpZ9w//WH2d/R1SCS2oRLixuoxev94NirR4cDE6 N2nb6ImZd7O6gtW4yAmd1UsX26i45NXrD6u8pElzgLnEVlSKj1RGUSfOlzaMtpTw 24N8g/IpmCg0RXUurv0EEHWnibO6LR3dzzhPH2DbuSmaqp0Q0AIRDGV4t3Vu+5ba DQ9fgiroERp2qBwqMf1pbBbymqt3+j7se1ATnAMZCboBKrMVuGojlrN5+OS8kynr lmH5DIBHNT2OuysOWzFtgbPuVh6KA2f+cyaQSabJYb3hxFRBxzHwAydJ76sCQI26 msl3kJVTmE+pt+n30Fep65ZR/aiF0CmW2BIjhNaDTNmDc4pfJhQku2hgWJmFLMOK ufdWFQ5WzJqk2hVmnLQPBq+l8NV/7nWlnQ8tA8MGrjM0Pe8ZNsmYQfvwrajzsose 7HG3+z/bepprV5zoznRO9ny+u0E2Pw2zFwcF5cFDXkGGFF1MevC6iFtTDsgx+k8j UTmU8wWNsBlYAMnYsc1nSKFXyi+ScUb5CDI1JFpCO0RnYNfi8/gOmk+OYCmj+85c 0iXlkLN90aT+DzTxABe1oSiS7hBdqUntiZ2l3Ik6qTidXhYZCHJaigVxyXo6+Mey dagoDVfhyUk5LI5HI9Md0hISg1FtgPHUUIMv1YFHFrqV75ZJj1UujV2NxUUYg7xc BHgjI5CyNDw= =TQ9P -----END PGP SIGNATURE----- --=-hR5s2AfaelOdsaljA0Ss--