How to generate PDF documentation for LLVM?

2

LLVM comes with html documentation, there are no pdfs to be downloaded. Is there a way of generating PDF documentation for it?

Reinstate Monica

Posted 2013-12-08T22:58:58.647

Reputation: 223

Answers

2

LLVM uses sphinx to generate its documentation, and sphinx supports generating pdf documentation via latexpdf. Assuming you have both sphinx and latex installed, on a unix system, all you need is a small patch for the generated latex file to work around zealous use of some Unicode characters not supported by default by the inputenc package.

A complete procedure might look as follows:

#! /bin/bash
svn co http://llvm.org/svn/llvm-project/llvm/branches/release_34/docs llvm34-doc
cd llvm34-doc
make -f Makefile.sphinx latex
patch -p0 <<ZZZ
--- _build/latex/LLVM.tex   2013-12-08 17:54:29.000000000 -0500
+++ _build/latex/LLVM.tex   2013-12-08 17:54:08.000000000 -0500
@@ -3,6 +3,13 @@
 \documentclass[letterpaper,10pt,english]{sphinxmanual}
 \usepackage[utf8]{inputenc}
 \DeclareUnicodeCharacter{00A0}{\nobreakspace}
+\usepackage{pifont}
+\DeclareUnicodeCharacter{2264}{$\leq$}
+\DeclareUnicodeCharacter{2265}{$\geq$}
+\DeclareUnicodeCharacter{2260}{$\neq$}
+\DeclareUnicodeCharacter{21D2}{$\Rightarrow$}
+\DeclareUnicodeCharacter{2714}{\ding{51}}
+\DeclareUnicodeCharacter{2718}{\ding{55}}
 \usepackage[T1]{fontenc}
 \usepackage{babel}
 \usepackage{times}
ZZZ
cd _build/latex
make
cd ../..

Note that the documentation isn't really tested/maintained for pdf output, so there will be a few glitches here and there. The output is 820 pages long.

Reinstate Monica

Posted 2013-12-08T22:58:58.647

Reputation: 223

1

It is very easy. Download an app for your browser like Web2PDF for chrome (there are lots of such apps, this one can be found on the Chrome WebStore, just google for your browser), and it will convert the web page you are looking into a pdf.

If you prefer a CLI tool, wkhtmltopdf is a very nice instrument.

MariusMatutiae

Posted 2013-12-08T22:58:58.647

Reputation: 41 321

1Except that it will be a snapshot of a hypertext document that was styled for the web. I don't believe that Sphinx comes with stylesheets (and content!) that render reasonably on paper. For example, the table of contents will be missing. What you propose is of course a valid solution if latex isn't available. – Reinstate Monica – 2013-12-09T17:23:03.133