gendoc infra refactoring
v2 cover gendoc infra refactoring
Hi all,
2nd round of this short series about gendoc. The major change concerns the xsltproc workaround.
Regards,
Samuel Martin (6):
gendoc infra: cosmetic fixes
gendoc infra: move manual build location into $(BUILD_DIR)/manual gendoc infra: avoid a2x warning
gendoc infra: disable pdf manual generation
gendoc infra: Remove the manual* target from .PHONY gendoc infra: Move the manual-clean target outside of the infra
docs/manual/manual.mk | 80 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 14 deletions(-)
--
2.1.0
PATCH v2 1/6 gendoc infra: cosmetic fixes
- wrap lines to 80 characters
- fix space/tab mixup
---
changes v1 -> v2:
- more tabs/space cleanup (ThomasDS)
- fix line mess (ThomasDS)
--- docs/manual/manual.mk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
docs/manual/manual.mk +8 -5
@@ -70,8 +70,8 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$(Q)mkdir -p $$(@D)/.build $$(Q)rsync -au docs/$(1)/*.txt $$(@D)/.build $$(Q)a2x $(6) -f $(2) -d book -L -r $$(TOPDIR)/docs/images \ - -D $$(@D) $$(@D)/.build/$(1).txt \ - --asciidoc-opts="$$(MANUAL_$(2)_ASCIIDOC_OPTS)" + --asciidoc-opts="$$(MANUAL_$(2)_ASCIIDOC_OPTS)" \ + -D $$(@D) $$(@D)/.build/$(1).txt -$$(Q)rm -rf $$(@D)/.build endef
@@ -84,9 +84,12 @@ endef # The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. ################################################################################ define GENDOC -$(call GENDOC_INNER,$(pkgname),xhtml,html,html,HTML,--xsltproc-opts "--stringparam toc.section.depth 1") -$(call GENDOC_INNER,$(pkgname),chunked,split-html,chunked,split HTML,--xsltproc-opts "--stringparam toc.section.depth 1") -$(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,--dblatex-opts "-P latex.output.revhistory=0") +$(call GENDOC_INNER,$(pkgname),xhtml,html,html,HTML,\ + --xsltproc-opts "--stringparam toc.section.depth 1") +$(call GENDOC_INNER,$(pkgname),chunked,split-html,chunked,split HTML,\ + --xsltproc-opts "--stringparam toc.section.depth 1") +$(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\ + --dblatex-opts "-P latex.output.revhistory=0") $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean
Signature · 1 line
2.1.0
PATCH v2 2/6 gendoc infra: move manual build location into $(BUILD_DIR)/manual
In reply to Samuel MartinThis patch reworks the mannual source preparetion by:
- moving the build directory under $(BUILD_DIR)/, this keeps consistency with the other Buildroot infrastructure;
- adding a couple of targets: 'manual-rsync' and 'manual-prepare-sources', to deal more efficiently the manual sources and avoid rsync-ing them on every single manual-* target.
The 'manual-rsync' target only copy the manual sources under git, while the 'manual-prepare-sources' also takes care of the generated ones. These targets are now run only once, and the manual build is no longer cleaned after each manual format generation.
Now, the 'manual-clean' target only remove the manual build directory, but keep the output one $(O)/output/doc/manual unchanged.
Doing so (moving the manual build directory and keeping it between 2 manual format generation) ensures that all generated sources are taking in account when generating the manual [1].
[1] http://lists.busybox.net/pipermail/buildroot/2014-August/104421.html
---
changes v1 -> v2:
- remove trailing '\'
--- docs/manual/manual.mk | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
docs/manual/manual.mk +16 -8
@@ -1,11 +1,20 @@ +$(BUILD_DIR)/$(pkgname): + $(Q)mkdir -p $@ + +manual-rsync: $(BUILD_DIR)/$(pkgname) + $(Q)$(call MESSAGE,"Preparing the manual sources...") + $(Q)rsync -au docs/$(pkgname)/ $(BUILD_DIR)/$(pkgname) + # Packages included in BR2_EXTERNAL are not part of buildroot, so they # should not be included in the manual. -manual-update-lists: manual-check-dependencies-lists +manual-update-lists: manual-check-dependencies-lists $(BUILD_DIR)/$(pkgname) $(Q)$(call MESSAGE,"Updating the manual lists...") - $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(O)/docs/manual/.build \ + $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(BUILD_DIR)/$(pkgname) \ BR2_EXTERNAL=$(TOPDIR)/support/dummy-external \ python -B $(TOPDIR)/support/scripts/gen-manual-lists.py +manual-prepare-sources: manual-rsync manual-update-lists + # we can't use suitable-host-package here because that's not available in # the context of 'make release' manual-check-dependencies:
@@ -65,14 +74,13 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$($$(call UPPERCASE,$(1))_SOURCES) \ manual-check-dependencies \ manual-check-dependencies-$(3) \ - manual-update-lists + manual-prepare-sources $$(Q)$$(call MESSAGE,"Generating $(5) $(1)...") - $$(Q)mkdir -p $$(@D)/.build - $$(Q)rsync -au docs/$(1)/*.txt $$(@D)/.build + $$(Q)mkdir -p $$(@D) $$(Q)a2x $(6) -f $(2) -d book -L -r $$(TOPDIR)/docs/images \ --asciidoc-opts="$$(MANUAL_$(2)_ASCIIDOC_OPTS)" \ - -D $$(@D) $$(@D)/.build/$(1).txt - -$$(Q)rm -rf $$(@D)/.build + -D $$(@D) \ + $$(BUILD_DIR)/$(1)/$(1).txt endef ################################################################################
@@ -94,7 +102,7 @@ $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean $(pkgname)-clean: - $$(Q)$$(RM) -rf $$(O)/docs/$(pkgname) + $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) .PHONY: $(pkgname) $(pkgname)-clean manual-update-lists endef
Signature · 1 line
2.1.0
PATCH v2 3/6 gendoc infra: avoid a2x warning
In reply to Samuel MartinThough the --destination-dir option works as expected, a2x displays the following message when generating the pdf and text manual:
a2x: WARNING: --destination-dir option is only applicable to HTML based outputs
To avoid this warning, we now just build the manual in its build location, then move the generated files into $(O)/docs/manual.
---
changes v1 -> v2:
- remove remaining '-D $$(@D)' arguments in the a2x command line
--- docs/manual/manual.mk | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
docs/manual/manual.mk +16 -1
@@ -70,6 +70,19 @@ ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) MANUAL_$(2)_ASCIIDOC_OPTS += -f $$(MANUAL_$(2)_ASCIIDOC_CONF) endif +# Handle a2x warning about --destination-dir option only applicable to HTML +# based outputs. So: +# - use the --destination-dir option if possible (html and split-html), +# - otherwise copy the generated manual to the output directory +MANUAL_$(2)_A2X_OPTS = +ifneq ($$(filter $(3),html split-html),) +MANUAL_$(2)_A2X_OPTS += --destination-dir="$$(@D)" +else +define MANUAL_$(2)_INSTALL_CMDS + $$(Q)cp -f $$(BUILD_DIR)/$(1)/$(1).$(4) $$(@D) +endef +endif + $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$($$(call UPPERCASE,$(1))_SOURCES) \ manual-check-dependencies \
@@ -78,9 +91,11 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$(Q)$$(call MESSAGE,"Generating $(5) $(1)...") $$(Q)mkdir -p $$(@D) $$(Q)a2x $(6) -f $(2) -d book -L -r $$(TOPDIR)/docs/images \ + $$(MANUAL_$(2)_A2X_OPTS) \ --asciidoc-opts="$$(MANUAL_$(2)_ASCIIDOC_OPTS)" \ - -D $$(@D) \ $$(BUILD_DIR)/$(1)/$(1).txt +# install the generated manual + $$(MANUAL_$(2)_INSTALL_CMDS) endef ################################################################################
Signature · 1 line
2.1.0
PATCH v2 4/6 gendoc infra: disable pdf manual generation
In reply to Samuel MartinThe PDF manual generation reaches the default xsltproc's template recursion limit when processing the target package list; this makes the PDF manual generation failed [1-3].
This limit an be raised with the '--maxvars' option. Unfortunately, this option is not correctly handled in the latest xsltproc/libxslt release (1.1.28), but this bug is already fixed in the libxslt repository [4].
This patch disables the PDF manual generation (makes it failed with a meaningful error message) when the xsltproc program found in the PATH does not support the --maxvars option.
So, one can still generate the PDF manual if he/she extends PATH with the location of a working xsltproc, by running:
$ PATH=/path/to/custom-xsltproc/bin:${PATH} make manual-pdf[1] http://lists.busybox.net/pipermail/buildroot/2014-August/104390.html
[2] http://lists.busybox.net/pipermail/buildroot/2014-August/104418.html
[3] http://lists.busybox.net/pipermail/buildroot/2014-August/104421.html
[4] https://gitorious.org/libxslt/libxslt/commit/5af7ad745323004984287e48b42712e7305de35c
---
changes v1 -> v2:
- simplify the xsltproc check logic
--- docs/manual/manual.mk | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
docs/manual/manual.mk +26 -1
@@ -83,6 +83,27 @@ define MANUAL_$(2)_INSTALL_CMDS endef endif +# PDF manual generation is currently broken because of a bug in xsltproc +# program (provided by libxslt), which does not honor an option we need to set. +# Fortunately, this bug is already fixed upstream: +# https://gitorious.org/libxslt/libxslt/commit/5af7ad745323004984287e48b42712e7305de35c +# +# So, bail out when trying to build the pdf manual using a buggy version of the +# xsltproc program. +# +# So, to overcome this issue and being able to build the pdf manual, you can +# build xsltproc from it source repository, then run: +# $ PATH=/path/to/custom-xsltproc/bin:${PATH} make manual +USE_BUGGY_XSLTPROC = $$(shell xsltproc --maxvars 0 >/dev/null 2>/dev/null || echo y) + +ifeq ($(4)-$$(USE_BUGGY_XSLTPROC),pdf-y) +$$(O)/docs/$(1)/$(1).$(4): + $$(error PDF manual generation is disabled because of a bug in \ + xsltproc program. To be able to generate the PDF manual, you \ + should build xsltproc from the libxslt sources >=1.1.29 and \ + passed it to make through the command line: \ + 'PATH=/path/to/custom-xsltproc/bin:$$$${PATH} make manual-pdf') +else $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$($$(call UPPERCASE,$(1))_SOURCES) \ manual-check-dependencies \
@@ -96,6 +117,7 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$(BUILD_DIR)/$(1)/$(1).txt # install the generated manual $$(MANUAL_$(2)_INSTALL_CMDS) +endif endef ################################################################################
@@ -111,8 +133,11 @@ $(call GENDOC_INNER,$(pkgname),xhtml,html,html,HTML,\ --xsltproc-opts "--stringparam toc.section.depth 1") $(call GENDOC_INNER,$(pkgname),chunked,split-html,chunked,split HTML,\ --xsltproc-opts "--stringparam toc.section.depth 1") +# dblatex needs to pass '--maxvars ...' option to xsltproc to prevent it from +# reaching the template recursion limit when processing the (long) target +# package table and bailing out. $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\ - --dblatex-opts "-P latex.output.revhistory=0") + --dblatex-opts "-P latex.output.revhistory=0 -x '--maxvars 100000'") $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean
Signature · 1 line
2.1.0
PATCH v2 5/6 gendoc infra: Remove the manual* target from .PHONY
In reply to Samuel MartinThis is not needed because none of these targets are also the name of a generated file.
---
changes v1 -> v2:
- no change
--- docs/manual/manual.mk | 1 - 1 file changed, 1 deletion(-)
docs/manual/manual.mk +0 -1
@@ -143,7 +143,6 @@ $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean $(pkgname)-clean: $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) -.PHONY: $(pkgname) $(pkgname)-clean manual-update-lists endef MANUAL_SOURCES = $(sort $(wildcard docs/manual/*.txt) $(wildcard docs/images/*))
Signature · 1 line
2.1.0
PATCH v2 6/6 gendoc infra: Move the manual-clean target outside of the infra
In reply to Samuel Martin---
changes v1 -> v2:
- no change
--- docs/manual/manual.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
docs/manual/manual.mk +4 -2
@@ -140,10 +140,12 @@ $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\ --dblatex-opts "-P latex.output.revhistory=0 -x '--maxvars 100000'") $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) +endef + clean: $(pkgname)-clean + $(pkgname)-clean: - $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) -endef + $(Q)$(RM) -rf $(BUILD_DIR)/$(pkgname) MANUAL_SOURCES = $(sort $(wildcard docs/manual/*.txt) $(wildcard docs/images/*)) $(eval $(call GENDOC))
Signature · 1 line
2.1.0
PATCH v2 1/6 gendoc infra: cosmetic fixes
In reply to Samuel MartinQuoted 4 lines · Samuel Martin
- wrap lines to 80 characters
- fix space/tab mixupSigned-off-by Samuel Martin <[email protected]>
PATCH v2 2/6 gendoc infra: move manual build location into $(BUILD_DIR)/manual
In reply to Samuel MartinHi Samuel,
Quoted 1 line · Samuel Martin
This patch reworks the mannual source preparetion by:
manual
preparation
Quoted 2 lines
- moving the build directory under $(BUILD_DIR)/, this keeps consistency with the other Buildroot infrastructure;
infrastructures
Quoted 2 lines
- adding a couple of targets: 'manual-rsync' and 'manual-prepare-sources', to deal more efficiently the manual sources and avoid rsync-ing them on
_with_ the manual sources
Quoted 3 lines
every single manual-* target.
The 'manual-rsync' target only copy the manual sources under git, while
copies
Quoted 6 lines
the 'manual-prepare-sources' also takes care of the generated ones. These targets are now run only once, and the manual build is no longer cleaned after each manual format generation.
Now, the 'manual-clean' target only remove the manual build directory, but keep the output one $(O)/output/doc/manual unchanged.
keeps
Quoted 3 lines
Doing so (moving the manual build directory and keeping it between 2 manual format generation) ensures that all generated sources are taking
taken
Quoted 19 lines
in account when generating the manual [1].
[1] http://lists.busybox.net/pipermail/buildroot/2014-August/104421.html
Cc Thomas De Schampheleire <[email protected]>Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- remove trailing '\'--- docs/manual/manual.mk | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)docs/manual/manual.mk +0
-0
docs/manual/manual.mk line 6
Quoted 6 lines
docs/manual/manual.mk +6
-0@@ -1,11 +1,20 @@ +$(BUILD_DIR)/$(pkgname): + $(Q)mkdir -p $@ + +manual-rsync: $(BUILD_DIR)/$(pkgname) + $(Q)$(call MESSAGE,"Preparing the manual sources...") + $(Q)rsync -au docs/$(pkgname)/ $(BUILD_DIR)/$(pkgname)
Why are you using 'rsync -au' and not 'rsync -a'?
-u means: "-u, --update : skip files that are newer on the receiver" and I can't see why we would want that behavior?
I realize that this was already present in the original code, but still I wonder if it's needed.
Quoted 36 lines
docs/manual/manual.mk +9
-7+ # Packages included in BR2_EXTERNAL are not part of buildroot, so they # should not be included in the manual. -manual-update-lists: manual-check-dependencies-lists +manual-update-lists: manual-check-dependencies-lists $(BUILD_DIR)/$(pkgname) $(Q)$(call MESSAGE,"Updating the manual lists...") - $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(O)/docs/manual/.build \ + $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(BUILD_DIR)/$(pkgname) \ BR2_EXTERNAL=$(TOPDIR)/support/dummy-external \ python -B $(TOPDIR)/support/scripts/gen-manual-lists.py +manual-prepare-sources: manual-rsync manual-update-lists + # we can't use suitable-host-package here because that's not available in # the context of 'make release' manual-check-dependencies:@@ -65,14 +74,13 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$($$(call UPPERCASE,$(1))_SOURCES) \ manual-check-dependencies \ manual-check-dependencies-$(3) \ - manual-update-lists + manual-prepare-sources $$(Q)$$(call MESSAGE,"Generating $(5) $(1)...") - $$(Q)mkdir -p $$(@D)/.build - $$(Q)rsync -au docs/$(1)/*.txt $$(@D)/.build + $$(Q)mkdir -p $$(@D) $$(Q)a2x $(6) -f $(2) -d book -L -r $$(TOPDIR)/docs/images \ --asciidoc-opts="$$(MANUAL_$(2)_ASCIIDOC_OPTS)" \ - -D $$(@D) $$(@D)/.build/$(1).txt - -$$(Q)rm -rf $$(@D)/.build + -D $$(@D) \ + $$(BUILD_DIR)/$(1)/$(1).txt endef ################################################################################
docs/manual/manual.mk $(call GENDOC_INNER,$(pkgname),text,text,text,text) · line 108
Quoted 8 lines
docs/manual/manual.mk +1
-1@@ -94,7 +102,7 @@ $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean $(pkgname)-clean: - $$(Q)$$(RM) -rf $$(O)/docs/$(pkgname) + $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) .PHONY: $(pkgname) $(pkgname)-clean manual-update-lists endef
Best regards,
Thomas
PATCH v2 3/6 gendoc infra: avoid a2x warning
In reply to Samuel MartinHi Samuel,
Quoted 7 lines · Samuel Martin
Though the --destination-dir option works as expected, a2x displays the following message when generating the pdf and text manual:
a2x: WARNING: --destination-dir option is only applicable to HTML based outputs
To avoid this warning, we now just build the manual in its build location, then move the generated files into $(O)/docs/manual.
What you are saying is that even though there is a warning, the option --destination-dir is taken into account even for non-HTML based outputs?
In that case, is it not more logical to fix the issue in a2x and ignore the warning for now?
Besides this general comment, see below if we pursue this patch anyway...
Quoted 17 lines
Reported-by Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- remove remaining '-D $$(@D)' arguments in the a2x command line--- docs/manual/manual.mk | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)docs/manual/manual.mk +0
-0
docs/manual/manual.mk ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) · line 77
Quoted 8 lines
docs/manual/manual.mk +5
-0@@ -70,6 +70,19 @@ ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) MANUAL_$(2)_ASCIIDOC_OPTS += -f $$(MANUAL_$(2)_ASCIIDOC_CONF) endif +# Handle a2x warning about --destination-dir option only applicable to HTML +# based outputs. So: +# - use the --destination-dir option if possible (html and split-html), +# - otherwise copy the generated manual to the output directory +MANUAL_$(2)_A2X_OPTS =
Why do you do this? The variable will be empty by default.
docs/manual/manual.mk ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) · line 83
Quoted 6 lines
docs/manual/manual.mk +6
-0+ifneq ($$(filter $(3),html split-html),) +MANUAL_$(2)_A2X_OPTS += --destination-dir="$$(@D)" +else +define MANUAL_$(2)_INSTALL_CMDS + $$(Q)cp -f $$(BUILD_DIR)/$(1)/$(1).$(4) $$(@D) +endef
Is it really needed to have this dual approach?
The patch would be simpler if we just use the manual install, even for html manuals.
Best regards,
Thomas
PATCH v2 4/6 gendoc infra: disable pdf manual generation
In reply to Samuel MartinHi Samuel,
Quoted 3 lines · Samuel Martin
The PDF manual generation reaches the default xsltproc's template recursion limit when processing the target package list; this makes the PDF manual generation failed [1-3].
fail
Quoted 2 lines
This limit an be raised with the '--maxvars' option. Unfortunately,
can
Quoted 5 lines
this option is not correctly handled in the latest xsltproc/libxslt release (1.1.28), but this bug is already fixed in the libxslt repository [4].
This patch disables the PDF manual generation (makes it failed with a
fail
Quoted 7 lines
meaningful error message) when the xsltproc program found in the PATH does not support the --maxvars option.
So, one can still generate the PDF manual if he/she extends PATH with the location of a working xsltproc, by running:$ PATH=/path/to/custom-xsltproc/bin:${PATH} make manual-pdf
Quoted 9 lines
[1] http://lists.busybox.net/pipermail/buildroot/2014-August/104390.html
[2] http://lists.busybox.net/pipermail/buildroot/2014-August/104418.html
[3] http://lists.busybox.net/pipermail/buildroot/2014-August/104421.html
[4] https://gitorious.org/libxslt/libxslt/commit/5af7ad745323004984287e48b42712e7305de35cReported-by Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>Signed-off-by Samuel Martin <[email protected]>
I must say that the commit summary 'disable pdf manual generation' was confusing to me: it is _conditionally_ disabled depending on the xsltproc check.
Quoted 12 lines
---
changes v1 -> v2:
- simplify the xsltproc check logic--- docs/manual/manual.mk | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)docs/manual/manual.mk +0
-0
docs/manual/manual.mk define MANUAL_$(2)_INSTALL_CMDS · line 89
Quoted 7 lines
docs/manual/manual.mk +4
-0@@ -83,6 +83,27 @@ define MANUAL_$(2)_INSTALL_CMDS endef endif +# PDF manual generation is currently broken because of a bug in xsltproc +# program (provided by libxslt), which does not honor an option we need to set. +# Fortunately, this bug is already fixed upstream: +# https://gitorious.org/libxslt/libxslt/commit/5af7ad745323004984287e48b42712e7305de35c
This message is not timeless: the 'currently' will remain in the buildroot sources even in a few releases. I think it would be better to rewrite this in a way that is accurate even in the future. Something like: 'in certain versions of xsltproc', for example, or if you know the version specify that.
docs/manual/manual.mk define MANUAL_$(2)_INSTALL_CMDS · line 97
Quoted 8 lines
docs/manual/manual.mk +8
-0+# +# So, bail out when trying to build the pdf manual using a buggy version of the +# xsltproc program. +# +# So, to overcome this issue and being able to build the pdf manual, you can +# build xsltproc from it source repository, then run: +# $ PATH=/path/to/custom-xsltproc/bin:${PATH} make manual +USE_BUGGY_XSLTPROC = $$(shell xsltproc --maxvars 0 >/dev/null 2>/dev/null || echo y)
The name 'USE_BUGGY_XSLTPROC' is confusing to me: it sounds like it can be set when you want to build the pdf manual even though xsltproc is buggy. What about something like: MANUAL_XSLTPROC_IS_BROKEN (I prefixed with MANUAL to avoid a confusion with the variables of a possible xsltproc (target) package.
docs/manual/manual.mk define MANUAL_$(2)_INSTALL_CMDS · line 102
Quoted 5 lines
docs/manual/manual.mk +5
-0+ +ifeq ($(4)-$$(USE_BUGGY_XSLTPROC),pdf-y) +$$(O)/docs/$(1)/$(1).$(4): + $$(error PDF manual generation is disabled because of a bug in \ + xsltproc program. To be able to generate the PDF manual, you \
I would remove 'program' here.
docs/manual/manual.mk define MANUAL_$(2)_INSTALL_CMDS · line 104
Quoted 2 lines
docs/manual/manual.mk +2
-0+ should build xsltproc from the libxslt sources >=1.1.29 and \ + passed it to make through the command line: \
pass
Quoted 14 lines
docs/manual/manual.mk +3
-0+ 'PATH=/path/to/custom-xsltproc/bin:$$$${PATH} make manual-pdf') +else $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$($$(call UPPERCASE,$(1))_SOURCES) \ manual-check-dependencies \@@ -96,6 +117,7 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \ $$(BUILD_DIR)/$(1)/$(1).txt # install the generated manual $$(MANUAL_$(2)_INSTALL_CMDS) +endif endef ################################################################################
docs/manual/manual.mk $(call GENDOC_INNER,$(pkgname),xhtml,html,html,HTML,\ · line 136
Quoted 4 lines
docs/manual/manual.mk +1
-0@@ -111,8 +133,11 @@ $(call GENDOC_INNER,$(pkgname),xhtml,html,html,HTML,\ --xsltproc-opts "--stringparam toc.section.depth 1") $(call GENDOC_INNER,$(pkgname),chunked,split-html,chunked,split HTML,\ --xsltproc-opts "--stringparam toc.section.depth 1") +# dblatex needs to pass '--maxvars ...' option to xsltproc to prevent it from
the '--maxvars ...' option
Quoted 11 lines
docs/manual/manual.mk +3
-2+# reaching the template recursion limit when processing the (long) target +# package table and bailing out. $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\ - --dblatex-opts "-P latex.output.revhistory=0") + --dblatex-opts "-P latex.output.revhistory=0 -x '--maxvars 100000'") $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean --2.1.0
Best regards,
Thomas
PATCH v2 5/6 gendoc infra: Remove the manual* target from .PHONY
In reply to Samuel MartinQuoted 17 lines · Samuel Martin
This is not needed because none of these targets are also the name of a generated file.
Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- no change--- docs/manual/manual.mk | 1 - 1 file changed, 1 deletion(-)docs/manual/manual.mk +0
-0
docs/manual/manual.mk $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) · line 146
Quoted 4 lines
docs/manual/manual.mk +0
-1@@ -143,7 +143,6 @@ $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean $(pkgname)-clean: $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) -.PHONY: $(pkgname) $(pkgname)-clean manual-update-lists
I do not agree with your reasoning that because these targets are not a file, PHONY is not needed.
The same could be said for the
.PHONY: $(1)-$(3)
line in GENDOC_INNER, and yet PHONY is not removed there.
From the make manual [1]
"There are two reasons to use a phony target: to avoid a conflict with a file of the same name, and to improve performance.
...
Since it knows that phony targets do not name actual files that could be remade from other files, make skips the implicit rule search for phony targets (see Implicit Rules). This is why declaring a target phony is good for performance, even if you are not worried about the actual file existing"
So according to me, the PHONY declarations should remain.
In fact, all package infrastructures could use such PHONY declarations, but they currently do not have them.
Best regards,
Thomas
[1] http://www.gnu.org/software/make/manual/make.html#Phony-Targets
PATCH v2 6/6 gendoc infra: Move the manual-clean target outside of the infra
In reply to Samuel MartinQuoted 19 lines · Samuel Martin
Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- no change--- docs/manual/manual.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)docs/manual/manual.mk +2
-0@@ -140,10 +140,12 @@ $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\ --dblatex-opts "-P latex.output.revhistory=0 -x '--maxvars 100000'") $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) +endef +
docs/manual/manual.mk $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\
Quoted 10 lines
docs/manual/manual.mk +2
-3clean: $(pkgname)-clean + $(pkgname)-clean: - $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) -endef + $(Q)$(RM) -rf $(BUILD_DIR)/$(pkgname) MANUAL_SOURCES = $(sort $(wildcard docs/manual/*.txt) $(wildcard docs/images/*)) $(eval $(call GENDOC)) --
This kind of defeats the purpose of having a GENDOC infra: suppose we add a new type of document next to 'manual'. In this case, we will have to create a new directory docs/XXXX/ and make sure that the GENDOC infra moves to another file, say package/pkg-gendoc.mk Then, we want XXXX-clean to exist too, which is why it should be within GENDOC.
If we don't care about such a case, then we could also simply remove GENDOC and only keep GENDOC_INNER.
In that case we don't even need $(pkgname).
Best regards,
Thomas
PATCH v2 2/6 gendoc infra: move manual build location into $(BUILD_DIR)/manual
In reply to Thomas De SchampheleireHi Thomas,
Quoted 69 lines · Thomas De Schampheleire
Hi Samuel,
Quoted 1 line · Samuel Martin
This patch reworks the mannual source preparetion by:
manual
preparationQuoted 2 lines
- moving the build directory under $(BUILD_DIR)/, this keeps consistency with the other Buildroot infrastructure;
infrastructures
Quoted 2 lines
- adding a couple of targets: 'manual-rsync' and 'manual-prepare-sources', to deal more efficiently the manual sources and avoid rsync-ing them on
_with_ the manual sources
Quoted 3 lines
every single manual-* target.
The 'manual-rsync' target only copy the manual sources under git, while
copies
Quoted 6 lines
the 'manual-prepare-sources' also takes care of the generated ones. These targets are now run only once, and the manual build is no longer cleaned after each manual format generation.
Now, the 'manual-clean' target only remove the manual build directory, but keep the output one $(O)/output/doc/manual unchanged.
keeps
Quoted 3 lines
Doing so (moving the manual build directory and keeping it between 2 manual format generation) ensures that all generated sources are taking
taken
Quoted 19 lines
in account when generating the manual [1].
[1] http://lists.busybox.net/pipermail/buildroot/2014-August/104421.html
Cc Thomas De Schampheleire <[email protected]>Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- remove trailing '\'--- docs/manual/manual.mk | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)docs/manual/manual.mk +0
-0docs/manual/manual.mk line 6
Quoted 6 lines
docs/manual/manual.mk +6
-0@@ -1,11 +1,20 @@ +$(BUILD_DIR)/$(pkgname): + $(Q)mkdir -p $@ + +manual-rsync: $(BUILD_DIR)/$(pkgname) + $(Q)$(call MESSAGE,"Preparing the manual sources...") + $(Q)rsync -au docs/$(pkgname)/ $(BUILD_DIR)/$(pkgname)Why are you using 'rsync -au' and not 'rsync -a'?
-u means: "-u, --update : skip files that are newer on the receiver" and I can't see why we would want that behavior?
Quoted 2 lines
I realize that this was already present in the original code, but still I wonder if it's needed.
As you noticed, I just keep the original code. But that's true, we certainly don't want the '-u' behavior.
I'll change this in the next submission (+ all the typoes pointed out above ;-]).
Regards,
Signature · 1 line
Samuel
PATCH v2 3/6 gendoc infra: avoid a2x warning
In reply to Thomas De SchampheleireHi Thomas, all,
Quoted 6 lines · Thomas De Schampheleire
Hi Samuel,
Quoted 3 lines · Samuel Martin
Though the --destination-dir option works as expected, a2x displays the following message when generating the pdf and text manual:
Quoted 8 lines
Quoted 4 lines
a2x: WARNING: --destination-dir option is only applicable to HTML based outputs
To avoid this warning, we now just build the manual in its build location, then move the generated files into $(O)/docs/manual.
What you are saying is that even though there is a warning, the option --destination-dir is taken into account even for non-HTML based outputs?
AFAICS, here the --destination-dir option works as expected, even for pdf and text outputs (the only difference is the warning).
Quoted 2 lines
In that case, is it not more logical to fix the issue in a2x and ignore the warning for now?
Humm... I agree with this, but it is not really what the a2x history shows [1]:
You can see the commit [2] fixing the original issue only triggered when generating pdf output (using dblatex backend) [3].
Then, the next commit [4] does kind of reverse the previous commit and add the warning. But in the end, this particular option seems to work correctly.
Quoted 23 lines
Besides this general comment, see below if we pursue this patch anyway...
Quoted 20 lines
Reported-by Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- remove remaining '-D $$(@D)' arguments in the a2x command line--- docs/manual/manual.mk | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)docs/manual/manual.mk +0
-0@@ -70,6 +70,19 @@ ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) MANUAL_$(2)_ASCIIDOC_OPTS += -f $$(MANUAL_$(2)_ASCIIDOC_CONF) endif
Quoted 7 lines
docs/manual/manual.mk ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) · line 77
Quoted 5 lines
docs/manual/manual.mk +5
-0+# Handle a2x warning about --destination-dir option only applicable to HTML +# based outputs. So: +# - use the --destination-dir option if possible (html and split-html), +# - otherwise copy the generated manual to the output directory +MANUAL_$(2)_A2X_OPTS =Why do you do this? The variable will be empty by default.
humm... remains... at first, I did: MANUAL_$(2)_A2X_OPTS =$(6) I'll clean this.
Quoted 11 lines
docs/manual/manual.mk ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),) · line 83
Quoted 7 lines
docs/manual/manual.mk +6
-0+ifneq ($$(filter $(3),html split-html),) +MANUAL_$(2)_A2X_OPTS += --destination-dir="$$(@D)" +else +define MANUAL_$(2)_INSTALL_CMDS + $$(Q)cp -f $$(BUILD_DIR)/$(1)/$(1).$(4) $$(@D) +endefIs it really needed to have this dual approach?
The patch would be simpler if we just use the manual install, even for html manuals.
The thing that makes me choose this dual approach is that for the html output, there are the logo.png and a *.css file to copy as well. Not really a big deal, but in case some images (or others resources) are added, I'd prefer let a2x handles all the output files.
Quoted 3 lines
Best regards,
Thomas
Regards,
[1] https://code.google.com/r/c0710204-a2x/source/list
[2] https://code.google.com/r/c0710204-a2x/source/detail?r=531e926fd958b45ad99a5a64990df16e8bec37f3
[3] https://groups.google.com/forum/#!topic/asciidoc/le79ORSb1nU
[4] https://code.google.com/r/c0710204-a2x/source/detail?r=7c0bc8eacba98ad4f7f5bad838ef33d5801cc15d
Signature · 1 line
Samuel
PATCH v2 5/6 gendoc infra: Remove the manual* target from .PHONY
In reply to Thomas De SchampheleireThomas,
Quoted 40 lines · Thomas De Schampheleire
Quoted 17 lines · Samuel Martin
This is not needed because none of these targets are also the name of a generated file.
Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- no change--- docs/manual/manual.mk | 1 - 1 file changed, 1 deletion(-)docs/manual/manual.mk +0
-0docs/manual/manual.mk $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) · line 146
Quoted 4 lines
docs/manual/manual.mk +0
-1@@ -143,7 +143,6 @@ $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) clean: $(pkgname)-clean $(pkgname)-clean: $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) -.PHONY: $(pkgname) $(pkgname)-clean manual-update-listsI do not agree with your reasoning that because these targets are not a file, PHONY is not needed.
The same could be said for the
.PHONY: $(1)-$(3)
line inGENDOC_INNER, and yet PHONY is not removed there.From the make manual [1]
"There are two reasons to use a phony target: to avoid a conflict with a file of the same name, and to improve performance.
...
Since it knows that phony targets do not name actual files that could be remade from other files, make skips the implicit rule search for phony targets (see Implicit Rules). This is why declaring a target phony is good for performance, even if you are not worried about the actual file existing"
Quoted 5 lines
So according to me, the PHONY declarations should remain.
In fact, all package infrastructures could use such PHONY declarations, but they currently do not have them.
Arf! Though I did read this paragraph, I miss the performance point :-s I drop this patch from the series.
Quoted 4 lines
Best regards,
Thomas[1] http://www.gnu.org/software/make/manual/make.html#Phony-Targets
Regards,
Signature · 1 line
Samuel
PATCH v2 6/6 gendoc infra: Move the manual-clean target outside of the infra
In reply to Thomas De SchampheleireThomas,
Quoted 27 lines · Thomas De Schampheleire
Quoted 26 lines · Samuel Martin
Signed-off-by Samuel Martin <[email protected]>---
changes v1 -> v2:
- no change--- docs/manual/manual.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)docs/manual/manual.mk +4
-2@@ -140,10 +140,12 @@ $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\ --dblatex-opts "-P latex.output.revhistory=0 -x '--maxvars 100000'") $(call GENDOC_INNER,$(pkgname),text,text,text,text) $(call GENDOC_INNER,$(pkgname),epub,epub,epub,ePUB) +endef + clean: $(pkgname)-clean + $(pkgname)-clean: - $$(Q)$$(RM) -rf $$(BUILD_DIR)/$(pkgname) -endef + $(Q)$(RM) -rf $(BUILD_DIR)/$(pkgname)
Quoted 9 lines
docs/manual/manual.mk $(call GENDOC_INNER,$(pkgname),pdf,pdf,pdf,PDF,\
Quoted 3 lines
docs/manual/manual.mk +0
-1MANUAL_SOURCES = $(sort $(wildcard docs/manual/*.txt) $(wildcard docs/images/*)) $(eval $(call GENDOC)) --This kind of defeats the purpose of having a GENDOC infra: suppose we add a new type of document next to 'manual'. In this case, we will have to create a new directory docs/XXXX/ and make sure that the GENDOC infra moves to another file, say
package/pkg-gendoc.mkThen, we want XXXX-clean to exist too, which is why it should be within GENDOC.
Got the point!
Quoted 5 lines
If we don't care about such a case, then we could also simply remove GENDOC and only keep
GENDOC_INNER.
In that case we don't even need $(pkgname).
Well, I drop this patch.
Quoted 2 lines
Best regards,
Thomas
Regards,
Signature · 1 line
Samuel