Switch PDF manual generation to rst2pdf

This finally gets rid of the LaTeX dependency.

We should actually be using docultils directly here, but I didn't
do this because of all the potential Python 2/3 breakage.
This commit is contained in:
Martin Herkt 2014-01-08 16:00:40 +01:00
parent 49646f10f0
commit c2fe43361f
6 changed files with 17 additions and 58 deletions

View File

@ -1,19 +0,0 @@
[latex2e writer]
use-latex-docinfo: yes
use-latex-toc: yes
hyperlink-color: Blue!30!RoyalPurple!70!Black
latex-preamble: \usepackage[usenames,dvipsnames]{xcolor}
\usepackage{fullpage}
\usepackage{graphicx}
\renewcommand{\familydefault}{\sfdefault}
\makeatletter
\renewcommand{\maketitle}{
\begin{center}
\vspace*{-1.5em}
\begin{Huge}
\@title
\end{Huge}
\end{center}
}
\makeatother

View File

@ -10,11 +10,6 @@ a movie player
:Manual section: 1
:Manual group: multimedia
.. raw:: latex
\tableofcontents
\pagebreak
SYNOPSIS
========

View File

@ -934,19 +934,19 @@ else
fi
echores "$_build_man"
_rst2latex=rst2latex
if [ -f "$(which rst2latex.py)" ] ; then
_rst2latex=rst2latex.py
_rst2pdf=rst2pdf
if [ -f "$(which rst2pdf.py)" ] ; then
_rst2pdf=rst2pdf.py
fi
echocheck "whether to build manual PDFs with rst2latex"
texcheck() {
echo test | $_rst2latex --config=DOCS/man/docutils.conf | pdflatex -halt-on-error -draftmode -output-directory="$mplayer_tmpdir"
echocheck "whether to build manual PDFs with rst2pdf"
pdfcheck() {
echo test | $_rst2pdf -c --repeat-table-rows -o "$mplayer_tmpdir/test.pdf"
}
if test "$_build_pdf" = auto ; then
_build_pdf=no
command_check texcheck && _build_pdf=yes
command_check pdfcheck && _build_pdf=yes
else
_build_pdf=no
fi
@ -3269,7 +3269,7 @@ GETCH = $_getch
TIMER = $_timer
RST2MAN = $_rst2man
BUILD_MAN = $_build_man
RST2LATEX = $_rst2latex
RST2PDF = $_rst2pdf
BUILD_PDF = $_build_pdf
EXESUF = $_exesuf

View File

@ -373,11 +373,8 @@ endif
all: $(ALL_TARGETS)
%.tex: %.rst
$(RST2LATEX) --config=DOCS/man/docutils.conf $< $@
%.pdf: %.tex
pdflatex -interaction=batchmode -jobname=$(basename $@) $<; pdflatex -interaction=batchmode -jobname=$(basename $@) $<
%.pdf: %.rst
$(RST2PDF) -c --repeat-table-rows $< -o $@
%.1: %.rst
$(RST2MAN) $< $@
@ -536,7 +533,7 @@ clean:
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_EXESUFS,mpv)
-$(RM) $(call ADDSUFFIXES,.pdf .tex .log .aux .out .toc,DOCS/man/*/mpv)
-$(RM) $(call ADDSUFFIXES,.pdf,DOCS/man/*/mpv)
-$(RM) DOCS/man/*/mpv.1
-$(RM) version.h
-$(RM) input/input_conf.h

View File

@ -31,8 +31,7 @@ build_options = [
}, {
'name': '--pdf-build',
'desc': 'pdf manual generation',
'func': check_ctx_vars('RST2LATEX', 'PDFLATEX'),
'default': 'disable'
'func': check_ctx_vars('RST2PDF'),
}, {
'name': 'libdl',
'desc': 'dynamic loader',
@ -786,8 +785,7 @@ def configure(ctx):
ctx.find_program(pkg_config, var='PKG_CONFIG')
ctx.find_program('perl', var='BIN_PERL')
ctx.find_program('rst2man', var='RST2MAN', mandatory=False)
ctx.find_program('rst2latex', var='RST2LATEX', mandatory=False)
ctx.find_program('pdflatex', var='PDFLATEX', mandatory=False)
ctx.find_program('rst2pdf', var='RST2PDF', mandatory=False)
ctx.find_program(windres, var='WINDRES', mandatory=False)
for ident, _, _ in _INSTALL_DIRS_LIST:

View File

@ -24,26 +24,14 @@ def _build_pdf(ctx):
from waflib import TaskGen
TaskGen.declare_chain(
name = 'rst2latex',
rule = '${RST2LATEX} ${RST2LATEX_FLAGS} ${SRC} ${TGT}',
name = 'rst2pdf',
rule = '${RST2PDF} ${RST2PDF_FLAGS} ${SRC} -o ${TGT}',
ext_in = '.rst',
ext_out = '.tex' )
TaskGen.declare_chain(
name = 'pdflatex',
rule = '${PDFLATEX} ${PDFLATEX_FLAGS} ${SRC}; ' * 2,
ext_in = '.tex',
ext_out = '.pdf',
shell = True )
ctx.env.RST2LATEX_FLAGS = [
'--config=' + ctx.srcnode.abspath() + '/DOCS/man/docutils.conf'
]
ctx.env.PDFLATEX_FLAGS = [
'--interaction=batchmode',
'--output-directory=DOCS/man/en/',
'--jobname=mpv'
ctx.env.RST2PDF_FLAGS = [
'-c --repeat-table-rows'
]
ctx(source = 'DOCS/man/en/mpv.rst')