author | Lennard de Rijk <ljvderijk@gmail.com> |
Sat, 04 Jul 2009 15:16:54 +0200 | |
changeset 2532 | 0b4dbe4b3fb7 |
parent 2311 | e8262ca32109 |
permissions | -rw-r--r-- |
2311
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
# vim: set filetype=python : |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
# arch-tag: general-purpose SCons build file for sgml-common |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
from glob import glob |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
import os, re |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
############################################################ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
# Setup |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
############################################################ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
SConsignFile('.sconsign-master') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
#Import('env') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
d = env.Dictionary() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
if not 'JADE' in d: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
d['JADE'] = 'jade' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
if not 'INDEXNODE' in d: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
17 |
d['INDEXNODE'] = 'ch.index' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
18 |
if not 'GTKIMGPATH' in d: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
d['GTKIMGPATH'] = '/usr/share/gtk-doc/data' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
20 |
if not 'PS2EPSI' in d: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
21 |
d['PS2EPSI'] = '../sgml-common/ps2epsi' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
def removeindex(l): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
while 'index/index.sgml' in l: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
l.remove('index/index.sgml') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
27 |
master = d['MASTERBASE'] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
mastersgml = master + '.sgml' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
sources = [mastersgml] + glob('*/*.sgml') + glob('*/*/*.sgml') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
30 |
removeindex(sources) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
31 |
db2htmlcmd = 'docbook-2-html -D $JADE ${HTMLARGS} ${SOURCE}' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
db2htmlindexcmd = 'docbook-2-html -D $JADE -O -V -O html-index ${HTMLARGS} ${SOURCE}' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
33 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
34 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
35 |
# SCANNERS |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
36 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
37 |
def recursescan(scanner, node, env): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
38 |
result = scanner(node, env) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
39 |
retval = [] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
40 |
for item in result: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
41 |
retval.append(item) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
42 |
retval.extend(recursescan(scanner, item, env)) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
43 |
return retval |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
44 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
45 |
SGML_includes_re = re.compile(r'<!ENTITY[^>]+SYSTEM[^>]+"(.+)"', re.M) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
46 |
def SGML_includes_scan(node, env, path): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
47 |
ret = SGML_includes_re.findall(node.get_contents()) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
48 |
removeindex(ret) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
49 |
return ret |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
50 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
51 |
SGML_includes_scanner = Scanner(name = 'SGML_includes', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
52 |
function = SGML_includes_scan, recursive = 1, skeys = ['.sgml', '.ent']) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
53 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
54 |
SGML_image_pdf_re = re.compile(r'<(graphic|imagedata).+?fileref="([^"]+\.pdf)"', re.S) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
55 |
SGML_image_png_re = re.compile(r'<(graphic|imagedata).+?fileref="([^"]+\.png)"', re.S) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
56 |
def SGML_image_scanner(node, env, path, arg): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
57 |
root, ext = os.path.splitext(str(node)) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
58 |
contents = node.get_contents() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
59 |
return SGML_includes_scan(node, env, path) + \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
60 |
[os.getcwd() + '/' + x[1] for x in arg.findall(contents)] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
61 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
62 |
SGML_pdf_scanner = Scanner(name = 'SGML_pdf', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
63 |
function = SGML_image_scanner, argument = SGML_image_pdf_re, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
64 |
recursive = 1) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
65 |
SGML_png_scanner = Scanner(name = 'SGML_png', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
66 |
function = SGML_image_scanner, argument = SGML_image_png_re, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
67 |
recursive = 1) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
68 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
69 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
70 |
# BUILDERS |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
71 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
72 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
73 |
#### PLAIN TEXT |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
74 |
Btxt = Builder(action="docbook2txt $SOURCE", src_suffix='.sgml', suffix='.txt') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
75 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
76 |
#### PDF / POSTSCRIPT |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
77 |
Bpdf = Builder(action="docbook-2-pdf -D ${JADE} -q -O -V -O paper-size=Letter ${PDFARGS} ${SOURCE}", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
78 |
src_suffix='.sgml', suffix='.pdf') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
79 |
Bpdf2ps = Builder(action="pdftops ${SOURCE}", src_suffix='.pdf', suffix='.ps') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
80 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
81 |
#### MAN PAGES |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
82 |
# FIXME: test this |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
83 |
Bman = Builder(action="docbook2man $SOURCE", src_suffix='.sgml', suffix='.1') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
84 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
85 |
#### HTML |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
86 |
Bhtml = Builder(action = [ \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
87 |
'if test -d ${TARGET.dir} ; then rm -r ${TARGET.dir} ; fi', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
88 |
'mkdir ${TARGET.dir}', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
89 |
db2htmlcmd, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
90 |
'mv ${MASTERBASE}-html/* ${TARGET.dir}/', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
91 |
'rmdir ${MASTERBASE}-html', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
92 |
'ln -s ${TOPNODE}.html ${TARGET.dir}/index.html', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
93 |
'cp ${GTKIMGPATH}/*.png ${TARGET.dir}/']) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
94 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
95 |
#### PNG |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
96 |
Bepip2png = Builder(action = 'gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 ' +\ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
97 |
'-r90 -dBATCH -dNOPAUSE -dSAFER -sOutputFile=$TARGET ' + \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
98 |
'-sDEVICE=png16m $SOURCE -c showpage', suffix='.png', src_suffix='.pngepi') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
99 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
100 |
#### EPI from PS |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
101 |
def getpagenumfromname(target, source, env, for_signature): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
102 |
return re.search('^.*_(\d+)\.(png){0,1}epi$', str(target[0])).group(1) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
103 |
d['GETPAGE'] = getpagenumfromname |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
104 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
105 |
Aps2epi = Action(['psselect -q ${GETPAGE} $SOURCE temp.ps', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
106 |
'psresize -w ${WIDTH} -h ${HEIGHT} temp.ps temp2.ps', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
107 |
'$PS2EPSI temp2.ps $TARGET', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
108 |
'rm temp.ps temp2.ps']) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
109 |
Bps2epi = Builder(action=Aps2epi, src_suffix='.ps', suffix='.epi') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
110 |
Bps2epip = Builder(action=Aps2epi, src_suffix='.ps', suffix='.pngepi') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
111 |
Bepi2pdf = Builder(action="epstopdf -o=${TARGET} ${SOURCE}", suffix='.pdf', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
112 |
src_suffix='.epi') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
113 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
114 |
#### PLUCKER |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
115 |
Bplucker = Builder(action = 'plucker-build --bpp=4 --compression=zlib ' + \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
116 |
'--doc-name="${MASTERBASE}" -H file:${SOURCE.abspath} -M 5 ' + \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
117 |
'--maxheight=320 --maxwidth=310 --staybelow=file:`pwd`/${SOURCE.dir} ' + \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
118 |
'--title="${MASTERBASE}" -p . -f ${MASTERBASE}') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
119 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
120 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
121 |
# General setup |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
122 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
123 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
124 |
env.Append(BUILDERS = {'Text': Btxt, 'PDF2PS': Bpdf2ps, 'PDF': Bpdf, 'HTML': Bhtml, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
125 |
'Plucker': Bplucker, 'PS2EPI': Bps2epi, 'PS2EPIP': Bps2epip, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
126 |
'EPI2PDF': Bepi2pdf, 'EPIP2PNG': Bepip2png, 'MAN': Bman}) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
127 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
128 |
#### INDEX GENERATION |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
129 |
if 'DOINDEX' in d: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
130 |
Bindex = Builder(action = ['if test -d ${TARGET.dir} ; then rm -r ${TARGET.dir} ; fi', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
131 |
"mkdir ${TARGET.dir}", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
132 |
"collateindex.pl -i $INDEXNODE -N -o $TARGET", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
133 |
db2htmlindexcmd, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
134 |
"mv ${MASTERBASE}-html/HTML.index ${TARGET.dir}/", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
135 |
"rm -r ${MASTERBASE}-html", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
136 |
"collateindex.pl -i $INDEXNODE -g -o $TARGET ${TARGET.dir}/HTML.index"]) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
137 |
env['BUILDERS']['Index'] = Bindex |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
138 |
index = env.Index('index/index.sgml', mastersgml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
139 |
env.Depends(index, sources) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
140 |
env.Clean(index, 'index') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
141 |
deps = sources + [index] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
142 |
else: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
143 |
deps = sources |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
144 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
145 |
################################################## |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
146 |
# BUILD RULES |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
147 |
################################################### |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
148 |
# Text |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
149 |
text = env.Text(mastersgml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
150 |
env.Depends(text, deps) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
151 |
env.Alias('text', text) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
152 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
153 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
154 |
pdfsgml = File(mastersgml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
155 |
pdf = env.PDF(pdfsgml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
156 |
figsindoc = [x for x in recursescan(SGML_pdf_scanner, pdfsgml, env) if str(x).endswith('.pdf')] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
157 |
epipdf = [] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
158 |
for file in figsindoc: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
159 |
pdfname = re.sub('_\d+\.pdf$', '.pdf', str(file)) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
160 |
if pdfname == str(file): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
161 |
# This is not a filename that fits our pattern; add unmodified. |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
162 |
epipdf.append(file) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
163 |
continue |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
164 |
psfile = env.PDF2PS(source = pdfname) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
165 |
epifile = env.PS2EPI(str(file).replace(".pdf", ".epi"), psfile, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
166 |
WIDTH='6.375in', HEIGHT='8.25in') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
167 |
epipdf.append(env.EPI2PDF(source = epifile)) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
168 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
169 |
env.Depends(pdf, deps) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
170 |
env.Depends(pdf, epipdf) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
171 |
env.Alias('pdf', pdf) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
172 |
env.Clean(pdf, ['jadetex.cfg', '${MASTERBASE}.aux', '${MASTERBASE}.dvi', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
173 |
'${MASTERBASE}.jtex', '${MASTERBASE}.log', '${MASTERBASE}.out', |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
174 |
'jade-out.fot']) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
175 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
176 |
# PS |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
177 |
ps = env.PDF2PS(source = pdf) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
178 |
env.Alias('ps', ps) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
179 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
180 |
# HTML |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
181 |
htmlsgml = File(mastersgml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
182 |
buildhtml = env.HTML('html/index.html', htmlsgml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
183 |
figsindoc = [x for x in recursescan(SGML_png_scanner, htmlsgml, env) if str(x).endswith('.png')] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
184 |
epipng = [] |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
185 |
for file in figsindoc: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
186 |
pdfname = re.sub('_\d+\.png$', '.pdf', str(file)) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
187 |
if pdfname == str(file): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
188 |
# This is not a filename that fits our pattern; add unmodified. |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
189 |
epipng.append(file) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
190 |
continue |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
191 |
psfile = env.PDF2PS(source = pdfname) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
192 |
epifile = env.PS2EPIP(str(file).replace(".png", ".pngepi"), psfile, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
193 |
WIDTH='8.5in', HEIGHT='11in') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
194 |
epipng.append(env.EPIP2PNG(source = epifile)) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
195 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
196 |
env.Depends(buildhtml, epipng) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
197 |
env.Depends(buildhtml, deps) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
198 |
pnginstalls = env.InstallAs(['html/' + str(x) for x in epipng], epipng) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
199 |
env.Depends(pnginstalls, buildhtml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
200 |
html = env.Alias('html', buildhtml) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
201 |
html = env.Alias('html', pnginstalls) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
202 |
env.Clean(buildhtml, 'html') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
203 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
204 |
# Plucker |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
205 |
plucker = env.Plucker(master + '.pdb', 'html/index.html') |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
206 |
env.Alias('plucker', plucker) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
207 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
208 |
env.Default(html) |