blob: 111e446d0ff86d64b3ee0fa3f7e4561f677448ab (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#! /usr/bin/env bash
version=0.10.0-a.0.z
date="$(date +"%B %Y")"
trap 'exit 1' ERR
set -o errtrace # Trap in functions.
function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }
while [ $# -gt 0 ]; do
case $1 in
--clean)
rm -f build2-toolchain-intro.xhtml \
build2-toolchain-intro.tex \
build2-toolchain-intro*.ps \
build2-toolchain-intro*.pdf
rm -f build2-toolchain-install.xhtml \
build2-toolchain-install.tex \
build2-toolchain-install*.ps \
build2-toolchain-install*.pdf
exit 0
;;
*)
error "unexpected $1"
;;
esac
done
function gen () # <name> <prefix> <...>
{
local n="$1"; shift
local prefix="$1"; shift
gen_html "$n" "$prefix" "${@}"
gen_latex "$n" "$prefix" "a4" "${@}"
gen_latex "$n" "$prefix" "letter" "${@}"
}
function gen_html () # <name> <prefix> <...>
{
local n="$1"; shift
local prefix="$1"; shift
cli -I .. \
-v version="$(echo "$version" | sed -e 's/^\([^.]*\.[^.]*\).*/\1/')" \
-v date="$date" \
--generate-html --html-suffix .xhtml \
--html-prologue-file doc-prologue.xhtml \
--html-epilogue-file doc-epilogue.xhtml \
--link-regex '%b([-.].+)%../../build2/doc/b$1%' \
--link-regex '%bpkg([-.].+)%../../bpkg/doc/bpkg$1%' \
--link-regex '%bdep([-.].+)%../../bdep/doc/bdep$1%' \
--link-regex '%b(#.+)?%../../build2/doc/build2-build-system-manual.xhtml$1%' \
--link-regex '%bpkg(#.+)?%../../bpkg/doc/build2-package-manager-manual.xhtml$1%' \
--link-regex '%bbot(#.+)?%../../bbot/doc/build2-build-bot-manual.xhtml$1%' \
--link-regex '%testscript(#.+)?%../../build2/doc/build2-testscript-manual.xhtml$1%' \
--output-prefix "$prefix" "${@}" $n.cli
}
function run_pdflatex () # <name> <paper>
{
local n="$1"
local paper="$2"
if [ "$paper" == "letter" ]; then
sed -i 's/a4paper/letterpaper/' "$n.tex"
fi
pdflatex -output-format dvi -jobname="$n-$paper" "$n"
dvips "$n-$paper.dvi"
pdflatex -output-format pdf -jobname="$n-$paper" "$n"
rm -f "$n-$paper".{aux,dvi,log,out,toc}
}
function gen_latex () # <name> <prefix> <paper> <...>
{
local n="$1"; shift
local prefix="$1"; shift
local paper="$1"; shift
cli -I .. \
-v version="$(echo "$version" | sed -e 's/^\([^.]*\.[^.]*\).*/\1/')" \
-v date="$date" \
--generate-latex \
--latex-prologue-file doc-prologue.tex \
--latex-epilogue-file doc-epilogue.tex \
--link-regex '%bbot(#.+)?%../../bbot/doc/build2-build-bot-manual-'"$paper"'.pdf$1%' \
--link-regex '%bpkg([-.].+)?\.pdf%../../bpkg/doc/bpkg$1-'"$paper"'.pdf%' \
--link-regex '%bpkg(#.+)?%../../bpkg/doc/build2-package-manager-manual-'"$paper"'.pdf$1%' \
--link-regex '%bdep([-.].+)?\.pdf%../../bdep/doc/bdep$1-'"$paper"'.pdf%' \
--link-regex '%testscript(#.+)?%../../build2/doc/build2-testscript-manual-'"$paper"'.pdf$1%' \
--link-regex '%b([-.].+)%../../build2/doc/b-'"$paper"'$1%' \
--link-regex '%b(#.+)?%../../build2/doc/build2-build-system-manual-'"$paper"'.pdf$1%' \
--output-prefix "$prefix" "${@}" $n.cli
run_pdflatex "$prefix$n" "$paper"
}
gen intro build2-toolchain-
#gen intro1
# Auto-heading doesn't work since it is broken into multiple doc strings.
#
gen install build2-toolchain- --html-heading-map 2=h2
# Generate INSTALL/BOOTSTRAP/UPGRADE file in ../
#
function gen_txt () # <name>
{
cli --generate-txt --omit-link-check --link-regex '%#(.*)%\U\1\E file%' \
-o .. --txt-suffix "" ../$1.cli
}
gen_txt INSTALL
gen_txt UPGRADE
gen_txt BOOTSTRAP-MACOSX
gen_txt BOOTSTRAP-MINGW
gen_txt BOOTSTRAP-MSVC
gen_txt BOOTSTRAP-UNIX
gen_txt BOOTSTRAP-WINDOWS
|