-
Notifications
You must be signed in to change notification settings - Fork 120
/
build_pdf.sh
executable file
·38 lines (32 loc) · 1.33 KB
/
build_pdf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# Parse languages
cd source || exit 1
VERSION="$(python -c 'import conf; print(conf.version)')"
LANGUAGES="$(python -c 'import conf; print(" ".join(sorted((lang for lang in conf.supported_languages.keys()), reverse=True)))')"
cd .. || exit 1
NUM_LANGUAGES="$(printf '%s' "$LANGUAGES" | wc -w)"
i=1
OUTPUT_DIR="build/pdf/${VERSION}"
mkdir -p "${OUTPUT_DIR}"
for lang in $LANGUAGES
do
printf -- '----- Building language "%s"... [%d/%d] -----\n' "$lang" "$i" "$NUM_LANGUAGES"
SPHINXOPTS="-q -j $(nproc) -Dlanguage=${lang}"
LATEXMKOPTS="-f -interaction=nonstopmode -pdf"
BUILDDIR="build/latex/${lang}"
if [ "${lang}" = "ja-JP" ]
then
SPHINXOPTS="${SPHINXOPTS} -Dlatex_engine=platex"
elif [ "${lang}" = "zh-CN" ] || [ "${lang}" = "zh-TW" ]
then
SPHINXOPTS="${SPHINXOPTS} -Dlatex_engine=xelatex -Dlatex_elements.preamble=\\usepackage[UTF8]{ctex}\\n"
LATEXMKOPTS="${LATEXMKOPTS} -xelatex"
else
SPHINXOPTS="${SPHINXOPTS} -Dlatex_engine=xelatex"
LATEXMKOPTS="${LATEXMKOPTS} -xelatex"
fi
sphinx-build -b latex source "${BUILDDIR}" ${SPHINXOPTS}
make -C "${BUILDDIR}" LATEXMKOPTS="${LATEXMKOPTS}" all-pdf >/dev/null
[ -e "${BUILDDIR}/Mixxx-Manual.pdf" ] && cp "${BUILDDIR}/Mixxx-Manual.pdf" "${OUTPUT_DIR}/mixxx-manual-${VERSION}-${lang}.pdf"
i=$((i + 1))
done