Page MenuHomeFreeBSD

Add PDF targets to doc/documentation/Makefile
ClosedPublic

Authored by blackend on May 18 2021, 1:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 11:34 PM
Unknown Object (File)
Mar 11 2024, 2:01 PM
Unknown Object (File)
Jan 10 2024, 5:14 AM
Unknown Object (File)
Dec 20 2023, 8:48 AM
Unknown Object (File)
Dec 16 2023, 10:11 AM
Unknown Object (File)
Dec 14 2023, 6:32 AM
Unknown Object (File)
Aug 29 2023, 7:12 AM
Unknown Object (File)
Aug 15 2023, 11:41 PM
Subscribers

Details

Reviewers
ceri
gjb
Group Reviewers
doceng
Summary

Addition of PDF targets allowing to build PDF version of docs with selection of the language.
For example:
make DOC_LANG="en,fr" pdf-books
or
make DOC_LANG="it" pdf-books pdf-articles

Diff Detail

Repository
R9 FreeBSD doc repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

blackend created this revision.
blackend created this object with edit policy "Subscribers".

Other generic nit is that this places its outputs into the content directories, whereas I think they should go into public/ somewhere. Not really clear what the correct structure would be, or if we can rely on public/ existing.

I'm also seeing a difference in how includes work in the fdp-primer when using the "make pdf-books" vs "make run", which might be me but I will dig into tomorrow.

documentation/Makefile
23

Mental note to add rubygem-asciidoctor-pdf to textproc/docproj

24

I think this behaves more sensibly as '&&' - failing that we should add a test to do nothing if DOC_LANG is empty to the other targets

135

s/buil/build/

  • Switch to other theme to allow CJK and other fonts to be embedded. Our default theme is less good than the one provided by asciidoctor-pdf.
  • Updates with Ceri's comments. I still have to save the pdf to a better suited directory.
blackend added inline comments.
documentation/Makefile
23

I added ${LOCALBASE}/bin/asciidoctor-pdf as RUN_DEPENDS. But textproc/docproj still has to be updated.

blackend marked an inline comment as not done.May 19 2021, 7:42 AM

Hi.

Testing here and I've seen this detail on articles/contributors.

$ cd documentation
$ make DOC_LANG="en" pdf-books pdf-articles
...
asciidoctor: ERROR: _index.adoc: line 117: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-committers.adoc
asciidoctor: ERROR: _index.adoc: line 127: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-corealumni.adoc
asciidoctor: ERROR: _index.adoc: line 137: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-develalumni.adoc
asciidoctor: ERROR: _index.adoc: line 147: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-portmgralumni.adoc
asciidoctor: ERROR: _index.adoc: line 157: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-develinmemoriam.adoc
asciidoctor: ERROR: _index.adoc: line 172: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-additional.adoc
...
documentation/Makefile
23

It's already there, but it's not enabled by default. I'll enable it.

Hi.

Testing here and I've seen this detail on articles/contributors.

$ cd documentation
$ make DOC_LANG="en" pdf-books pdf-articles
...
asciidoctor: ERROR: _index.adoc: line 117: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-committers.adoc

Ah thanks - we know how to fix that, will update.

Built docs are now saved in matching public/lang/articles|books/ directory. Clean targets updated as well.

In D30331#682856, @ceri wrote:

Hi.

Testing here and I've seen this detail on articles/contributors.

$ cd documentation
$ make DOC_LANG="en" pdf-books pdf-articles
...
asciidoctor: ERROR: _index.adoc: line 117: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/contributors/content/en/articles/contributors/contrib-committers.adoc

Ah thanks - we know how to fix that, will update.

OK, I've pushed fixes for that.

ceri requested changes to this revision.May 24 2021, 11:34 AM

One other note: the pgpkeys article takes about two hours to build on my (admittedly single-CPU 2GB RAM) machine - is that common and do we need to work around that somehow?

documentation/Makefile
53

Can we add?

pdf: pdf-articles pdf-books

95

This needs a test for if there is no articles directory, for example:

/usr/local/bin/asciidoctor-pdf -r ./shared/lib/man-macro.rb -r ./shared/lib/man-macro.rb -r ./shared/lib/git-macro.rb -r ./shared/lib/packages-macro.rb -r ./shared/lib/inter-document-references-macro.rb -r ./shared/lib/sectnumoffset-treeprocessor.rb --doctype=article -a skip-front-matter -a pdf-theme=default-with-fallback-font -o /usr/home/ceri/git/f/freebsd-doc/documentation/public/mn/articles/*/article.pdf /usr/home/ceri/git/f/freebsd-doc/documentation/content/mn/articles/*/_index.adoc
asciidoctor: FAILED: input file /usr/home/ceri/git/f/freebsd-doc/documentation/content/mn/articles/*/_index.adoc is missing

  • Error code 1

Stop.
make: stopped in /usr/home/ceri/git/f/freebsd-doc/documentation
{ceri@horror}-{f/freebsd-doc/documentation} % ls content/mn/
books

This revision now requires changes to proceed.May 24 2021, 11:34 AM
blackend added inline comments.
documentation/Makefile
53

Also added pdf-clean target

95

Test added for articles. Same should be added for books but the toc* generation target and scripts makes it difficult.

In D30331#683208, @ceri wrote:

One other note: the pgpkeys article takes about two hours to build on my (admittedly single-CPU 2GB RAM) machine - is that common and do we need to work around that somehow?

Same here now since we do it right with includes. I just launched a build on my machine (10 years old quad-core) 12 minutes ago and it's still running...
Indeed, we need a solution/workaround.

  • Add installation of static/articles/* files in articles target
  • Put tests of doc existence in pdf-*-targets
In D30331#683208, @ceri wrote:

One other note: the pgpkeys article takes about two hours to build on my (admittedly single-CPU 2GB RAM) machine - is that common and do we need to work around that somehow?

Same here now since we do it right with includes. I just launched a build on my machine (10 years old quad-core) 12 minutes ago and it's still running...
Indeed, we need a solution/workaround.

I've ruled out an include storm by pushing everything into a single file and it still takes over 90 minutes, so will rework the Makefile if I can to avoid as many .PHONY targets as there currently are. No need to hold up this review for it, I think.

Seems good to go now.

This revision is now accepted and ready to land.May 30 2021, 9:26 AM
gjb added a subscriber: gjb.

I cannot accept this review, due to some permission problem. Consider this comment as 'accepted'.

In D30331#686041, @ceri wrote:
In D30331#683208, @ceri wrote:

One other note: the pgpkeys article takes about two hours to build on my (admittedly single-CPU 2GB RAM) machine - is that common and do we need to work around that somehow?

Same here now since we do it right with includes. I just launched a build on my machine (10 years old quad-core) 12 minutes ago and it's still running...
Indeed, we need a solution/workaround.

I've ruled out an include storm by pushing everything into a single file and it still takes over 90 minutes, so will rework the Makefile if I can to avoid as many .PHONY targets as there currently are. No need to hold up this review for it, I think.

I think for now is better skip pdf for articles/pgpkeys, it seems the issue is not the includes but its content.

See here:
https://github.com/asciidoctor/asciidoctor-pdf/issues/941

$ wc -l documentation/static/pgpkeys/*.key
      [...]
      66 documentation/static/pgpkeys/zi.key
      43 documentation/static/pgpkeys/zml.key
     100 documentation/static/pgpkeys/zont.key
   94964 total

Without articles/pgpkeys:

$ cd documentation
$ time make DOC_LANG="en" pdf
...
make DOC_LANG="en" pdf  218.75s user 3.15s system 99% cpu 3:41.94 total

Just articles/pgpkeys:

 $ time /usr/local/bin/ruby27 \
/usr/local/bin/asciidoctor-pdf \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/git-macro.rb \
-r ./shared/lib/packages-macro.rb \
-r ./shared/lib/inter-document-references-macro.rb \
-r ./shared/lib/sectnumoffset-treeprocessor.rb \
--doctype=article -a skip-front-matter \
-a pdf-theme=default-with-fallback-font \
-o /usr/home/dbaio/FreeBSD/git/doc/documentation/public/en/articles/pgpkeys/article.pdf \
/usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/pgpkeys/_index.adoc
/usr/local/bin/ruby27 /usr/local/bin/asciidoctor-pdf -r  -r  -r  -r  -r  -r    3575.63s user 3.02s system 99% cpu 59:39.77 total

I've updated docs tree and applied this patch and I'm getting this error when not setting a language:

$ cd documentation
$ time make pdf
...
asciidoctor: ERROR: _index.adoc: line 50: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/shared/jp/mailing-lists.adoc
asciidoctor: ERROR: _index.adoc: line 51: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/shared/jp/teams.adoc
asciidoctor: ERROR: _index.adoc: line 52: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/shared/jp/urls.adoc
asciidoctor: ERROR: _index.adoc: line 72: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/{chapters-path}toc-figures.adoc
asciidoctor: ERROR: _index.adoc: line 74: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/{chapters-path}toc-tables.adoc
asciidoctor: WARNING: image to embed not found or not readable: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/fig1.png
asciidoctor: WARNING: image to embed not found or not readable: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/fig2.png
...
/usr/local/bin/asciidoctor-pdf  -r ./shared/lib/man-macro.rb  -r ./shared/lib/man-macro.rb  -r ./shared/lib/git-macro.rb  -r ./shared/lib/packages-macro.rb  -r ./shared/lib/inter-document-references-macro.rb  -r ./shared/lib/sectnumoffset-treeprocessor.rb  --doctype=book  -a skip-front-matter  -a pdf-theme=default-with-fallback-font  -o /usr/home/dbaio/FreeBSD/git/doc/documentation/public/zh-tw/books/porters-handbook/book.pdf  /usr/home/dbaio/FreeBSD/git/doc/documentation/content/zh-tw/books/porters-handbook/_index.adoc
asciidoctor: ERROR: failed to parse formatted text: It will have <code>MASTER_SITES</code> set to &#8220;<a href="https://gitlab.example.com&#8221" class="bare">https://gitlab.example.com&#8221</a>; and <code>WRKSRC</code> to <code>${WRKDIR}/bar-9c1669ce60c3f4f5eb43df874d7314483fb3f8a6-9c1669ce60c3f4f5eb43df874d7314483fb3f8a6</code>.
/usr/local/bin/asciidoctor-pdf  -r ./shared/lib/man-macro.rb  -r ./shared/lib/man-macro.rb  -r ./shared/lib/git-macro.rb  -r ./shared/lib/packages-macro.rb  -r ./shared/lib/inter-document-references-macro.rb  -r ./shared/lib/sectnumoffset-treeprocessor.rb  --doctype=book  -a skip-front-matter  -a pdf-theme=default-with-fallback-font  -o /usr/home/dbaio/FreeBSD/git/doc/documentation/public/ru/books/arch-handbook/book.pdf  /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ru/books/arch-handbook/_index.adoc
asciidoctor: FAILED: input file /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ru/books/arch-handbook/_index.adoc is missing
*** Error code 1

Stop.
make: stopped in /usr/home/dbaio/FreeBSD/git/doc/documentation
make pdf  4669.69s user 18.28s system 99% cpu 1:18:10.78 total

I've updated docs tree and applied this patch and I'm getting this error when not setting a language:

$ cd documentation
$ time make pdf
...
asciidoctor: ERROR: _index.adoc: line 50: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/shared/jp/mailing-lists.adoc
asciidoctor: ERROR: _index.adoc: line 51: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/shared/jp/teams.adoc
asciidoctor: ERROR: _index.adoc: line 52: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/shared/jp/urls.adoc
asciidoctor: ERROR: _index.adoc: line 72: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/{chapters-path}toc-figures.adoc
asciidoctor: ERROR: _index.adoc: line 74: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/{chapters-path}toc-tables.adoc
asciidoctor: WARNING: image to embed not found or not readable: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/fig1.png
asciidoctor: WARNING: image to embed not found or not readable: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ja/books/design-44bsd/fig2.png
...
/usr/local/bin/asciidoctor-pdf  -r ./shared/lib/man-macro.rb  -r ./shared/lib/man-macro.rb  -r ./shared/lib/git-macro.rb  -r ./shared/lib/packages-macro.rb  -r ./shared/lib/inter-document-references-macro.rb  -r ./shared/lib/sectnumoffset-treeprocessor.rb  --doctype=book  -a skip-front-matter  -a pdf-theme=default-with-fallback-font  -o /usr/home/dbaio/FreeBSD/git/doc/documentation/public/zh-tw/books/porters-handbook/book.pdf  /usr/home/dbaio/FreeBSD/git/doc/documentation/content/zh-tw/books/porters-handbook/_index.adoc
asciidoctor: ERROR: failed to parse formatted text: It will have <code>MASTER_SITES</code> set to &#8220;<a href="https://gitlab.example.com&#8221" class="bare">https://gitlab.example.com&#8221</a>; and <code>WRKSRC</code> to <code>${WRKDIR}/bar-9c1669ce60c3f4f5eb43df874d7314483fb3f8a6-9c1669ce60c3f4f5eb43df874d7314483fb3f8a6</code>.
/usr/local/bin/asciidoctor-pdf  -r ./shared/lib/man-macro.rb  -r ./shared/lib/man-macro.rb  -r ./shared/lib/git-macro.rb  -r ./shared/lib/packages-macro.rb  -r ./shared/lib/inter-document-references-macro.rb  -r ./shared/lib/sectnumoffset-treeprocessor.rb  --doctype=book  -a skip-front-matter  -a pdf-theme=default-with-fallback-font  -o /usr/home/dbaio/FreeBSD/git/doc/documentation/public/ru/books/arch-handbook/book.pdf  /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ru/books/arch-handbook/_index.adoc
asciidoctor: FAILED: input file /usr/home/dbaio/FreeBSD/git/doc/documentation/content/ru/books/arch-handbook/_index.adoc is missing
*** Error code 1

Stop.
make: stopped in /usr/home/dbaio/FreeBSD/git/doc/documentation
make pdf  4669.69s user 18.28s system 99% cpu 1:18:10.78 total

I know about these errors, only the last one is a stopping one. I'll fix them before committing the diff.

I think for now is better skip pdf for articles/pgpkeys, it seems the issue is not the includes but its content.

See here:
https://github.com/asciidoctor/asciidoctor-pdf/issues/941

$ wc -l documentation/static/pgpkeys/*.key
      [...]
      66 documentation/static/pgpkeys/zi.key
      43 documentation/static/pgpkeys/zml.key
     100 documentation/static/pgpkeys/zont.key
   94964 total

Without articles/pgpkeys:

$ cd documentation
$ time make DOC_LANG="en" pdf
...
make DOC_LANG="en" pdf  218.75s user 3.15s system 99% cpu 3:41.94 total

Just articles/pgpkeys:

 $ time /usr/local/bin/ruby27 \
/usr/local/bin/asciidoctor-pdf \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/git-macro.rb \
-r ./shared/lib/packages-macro.rb \
-r ./shared/lib/inter-document-references-macro.rb \
-r ./shared/lib/sectnumoffset-treeprocessor.rb \
--doctype=article -a skip-front-matter \
-a pdf-theme=default-with-fallback-font \
-o /usr/home/dbaio/FreeBSD/git/doc/documentation/public/en/articles/pgpkeys/article.pdf \
/usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/articles/pgpkeys/_index.adoc
/usr/local/bin/ruby27 /usr/local/bin/asciidoctor-pdf -r  -r  -r  -r  -r  -r    3575.63s user 3.02s system 99% cpu 59:39.77 total

Indeed asciidoctor-pdf is not really good with multiple content. As a quick workaround, I'm going to make the includes point on nothing. We'll get errors but nothing fatal.