diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2015-09-27 20:09:52 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2015-09-28 03:31:48 -0400 |
commit | b479bfd00e463034a73a9894d4f6d87988cbc559 (patch) | |
tree | 6ee8eaaf8fe73ff66da96bd980d76b3e57f45c3e | |
parent | c51edfb10e6b6e8cfd1bd80ab9f54e51e55ea62a (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/Makefile | 6 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | scripts/.gitignore | 1 | ||||
-rw-r--r-- | scripts/Makefile | 7 | ||||
-rw-r--r-- | scripts/check-lc_ctype.c | 11 |
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 | |||
69 | KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref | 69 | KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref |
70 | KERNELDOC = $(srctree)/scripts/kernel-doc | 70 | KERNELDOC = $(srctree)/scripts/kernel-doc |
71 | DOCPROC = $(objtree)/scripts/docproc | 71 | DOCPROC = $(objtree)/scripts/docproc |
72 | CHECK_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 | ||
76 | LC_CTYPE := $(call try-run, LC_CTYPE=C.UTF-8 $(CHECK_LC_CTYPE),C.UTF-8,C) | ||
77 | export LC_CTYPE | ||
72 | 78 | ||
73 | XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl | 79 | XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl |
74 | XMLTOFLAGS += --skip-validation | 80 | XMLTOFLAGS += --skip-validation |
@@ -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 | ||
1342 | else # KBUILD_EXTMOD | 1342 | else # 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 | |||
8 | ihex2fw | 8 | ihex2fw |
9 | recordmcount | 9 | recordmcount |
10 | docproc | 10 | docproc |
11 | check-lc_ctype | ||
11 | sortextable | 12 | sortextable |
12 | asn1_compiler | 13 | asn1_compiler |
13 | extract-cert | 14 | extract-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 | ||
11 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | 12 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
12 | 13 | ||
@@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto | |||
27 | always := $(hostprogs-y) $(hostprogs-m) | 28 | always := $(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 |
30 | hostprogs-y += unifdef docproc | 31 | hostprogs-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 |
33 | PHONY += build_unifdef build_docproc | 34 | PHONY += build_unifdef build_docproc build_check-lc_ctype |
34 | build_unifdef: $(obj)/unifdef | 35 | build_unifdef: $(obj)/unifdef |
35 | @: | 36 | @: |
36 | build_docproc: $(obj)/docproc | 37 | build_docproc: $(obj)/docproc |
37 | @: | 38 | @: |
39 | build_check-lc_ctype: $(obj)/check-lc_ctype | ||
40 | @: | ||
38 | 41 | ||
39 | subdir-$(CONFIG_MODVERSIONS) += genksyms | 42 | subdir-$(CONFIG_MODVERSIONS) += genksyms |
40 | subdir-y += mod | 43 | subdir-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 | |||
8 | int main(void) | ||
9 | { | ||
10 | return !setlocale(LC_CTYPE, ""); | ||
11 | } | ||