Commit b479bfd0 authored by Ben Hutchings's avatar Ben Hutchings Committed by Jonathan Corbet

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: default avatarBen Hutchings <ben@decadent.org.uk>
[jc: added check-lc_ctype to .gitignore]
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent c51edfb1
...@@ -69,6 +69,12 @@ installmandocs: mandocs ...@@ -69,6 +69,12 @@ installmandocs: mandocs
KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref
KERNELDOC = $(srctree)/scripts/kernel-doc KERNELDOC = $(srctree)/scripts/kernel-doc
DOCPROC = $(objtree)/scripts/docproc 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 = -m $(srctree)/$(src)/stylesheet.xsl
XMLTOFLAGS += --skip-validation XMLTOFLAGS += --skip-validation
......
...@@ -1336,7 +1336,7 @@ $(help-board-dirs): help-%: ...@@ -1336,7 +1336,7 @@ $(help-board-dirs): help-%:
# Documentation targets # Documentation targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
%docs: scripts_basic FORCE %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 $@ $(Q)$(MAKE) $(build)=Documentation/DocBook $@
else # KBUILD_EXTMOD else # KBUILD_EXTMOD
......
...@@ -8,6 +8,7 @@ unifdef ...@@ -8,6 +8,7 @@ unifdef
ihex2fw ihex2fw
recordmcount recordmcount
docproc docproc
check-lc_ctype
sortextable sortextable
asn1_compiler asn1_compiler
extract-cert extract-cert
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# conmakehash: Create chartable # conmakehash: Create chartable
# conmakehash: Create arrays for initializing the kernel console tables # conmakehash: Create arrays for initializing the kernel console tables
# docproc: Used in Documentation/DocBook # docproc: Used in Documentation/DocBook
# check-lc_ctype: Used in Documentation/DocBook
HOST_EXTRACFLAGS += -I$(srctree)/tools/include HOST_EXTRACFLAGS += -I$(srctree)/tools/include
...@@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto ...@@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto
always := $(hostprogs-y) $(hostprogs-m) always := $(hostprogs-y) $(hostprogs-m)
# The following hostprogs-y programs are only build on demand # 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 # 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_unifdef: $(obj)/unifdef
@: @:
build_docproc: $(obj)/docproc build_docproc: $(obj)/docproc
@: @:
build_check-lc_ctype: $(obj)/check-lc_ctype
@:
subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-y += mod subdir-y += mod
......
/*
* Check that a specified locale works as LC_CTYPE. Used by the
* DocBook build system to probe for C.UTF-8 support.
*/
#include <locale.h>
int main(void)
{
return !setlocale(LC_CTYPE, "");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment