aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2015-09-27 20:09:52 -0400
committerJonathan Corbet <corbet@lwn.net>2015-09-28 03:31:48 -0400
commitb479bfd00e463034a73a9894d4f6d87988cbc559 (patch)
tree6ee8eaaf8fe73ff66da96bd980d76b3e57f45c3e
parentc51edfb10e6b6e8cfd1bd80ab9f54e51e55ea62a (diff)
DocBook: Use a fixed encoding for output
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 <ben@decadent.org.uk> [jc: added check-lc_ctype to .gitignore] Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r--Documentation/DocBook/Makefile6
-rw-r--r--Makefile2
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile7
-rw-r--r--scripts/check-lc_ctype.c11
5 files changed, 24 insertions, 3 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 93eff64387cd..d2544961b67a 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -69,6 +69,12 @@ installmandocs: mandocs
69KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref 69KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref
70KERNELDOC = $(srctree)/scripts/kernel-doc 70KERNELDOC = $(srctree)/scripts/kernel-doc
71DOCPROC = $(objtree)/scripts/docproc 71DOCPROC = $(objtree)/scripts/docproc
72CHECK_LC_CTYPE = $(objtree)/scripts/check-lc_ctype
73
74# Use a fixed encoding - UTF-8 if the C library has support built-in
75# or ASCII if not
76LC_CTYPE := $(call try-run, LC_CTYPE=C.UTF-8 $(CHECK_LC_CTYPE),C.UTF-8,C)
77export LC_CTYPE
72 78
73XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl 79XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl
74XMLTOFLAGS += --skip-validation 80XMLTOFLAGS += --skip-validation
diff --git a/Makefile b/Makefile
index 84f4b31e3c6e..d23d2e97a835 100644
--- a/Makefile
+++ b/Makefile
@@ -1336,7 +1336,7 @@ $(help-board-dirs): help-%:
1336# Documentation targets 1336# Documentation targets
1337# --------------------------------------------------------------------------- 1337# ---------------------------------------------------------------------------
1338%docs: scripts_basic FORCE 1338%docs: scripts_basic FORCE
1339 $(Q)$(MAKE) $(build)=scripts build_docproc 1339 $(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype
1340 $(Q)$(MAKE) $(build)=Documentation/DocBook $@ 1340 $(Q)$(MAKE) $(build)=Documentation/DocBook $@
1341 1341
1342else # KBUILD_EXTMOD 1342else # KBUILD_EXTMOD
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 12efbbefd4d7..1f78169d4254 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -8,6 +8,7 @@ unifdef
8ihex2fw 8ihex2fw
9recordmcount 9recordmcount
10docproc 10docproc
11check-lc_ctype
11sortextable 12sortextable
12asn1_compiler 13asn1_compiler
13extract-cert 14extract-cert
diff --git a/scripts/Makefile b/scripts/Makefile
index 1b2661712d44..fd0d53d4a234 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -7,6 +7,7 @@
7# conmakehash: Create chartable 7# conmakehash: Create chartable
8# conmakehash: Create arrays for initializing the kernel console tables 8# conmakehash: Create arrays for initializing the kernel console tables
9# docproc: Used in Documentation/DocBook 9# docproc: Used in Documentation/DocBook
10# check-lc_ctype: Used in Documentation/DocBook
10 11
11HOST_EXTRACFLAGS += -I$(srctree)/tools/include 12HOST_EXTRACFLAGS += -I$(srctree)/tools/include
12 13
@@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto
27always := $(hostprogs-y) $(hostprogs-m) 28always := $(hostprogs-y) $(hostprogs-m)
28 29
29# The following hostprogs-y programs are only build on demand 30# The following hostprogs-y programs are only build on demand
30hostprogs-y += unifdef docproc 31hostprogs-y += unifdef docproc check-lc_ctype
31 32
32# These targets are used internally to avoid "is up to date" messages 33# These targets are used internally to avoid "is up to date" messages
33PHONY += build_unifdef build_docproc 34PHONY += build_unifdef build_docproc build_check-lc_ctype
34build_unifdef: $(obj)/unifdef 35build_unifdef: $(obj)/unifdef
35 @: 36 @:
36build_docproc: $(obj)/docproc 37build_docproc: $(obj)/docproc
37 @: 38 @:
39build_check-lc_ctype: $(obj)/check-lc_ctype
40 @:
38 41
39subdir-$(CONFIG_MODVERSIONS) += genksyms 42subdir-$(CONFIG_MODVERSIONS) += genksyms
40subdir-y += mod 43subdir-y += mod
diff --git a/scripts/check-lc_ctype.c b/scripts/check-lc_ctype.c
new file mode 100644
index 000000000000..9097ff5449fb
--- /dev/null
+++ b/scripts/check-lc_ctype.c
@@ -0,0 +1,11 @@
1/*
2 * Check that a specified locale works as LC_CTYPE. Used by the
3 * DocBook build system to probe for C.UTF-8 support.
4 */
5
6#include <locale.h>
7
8int main(void)
9{
10 return !setlocale(LC_CTYPE, "");
11}