]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/SConscript
Clean up buildscripts
[lilypond.git] / Documentation / user / SConscript
1 # -*-python-*-
2
3 import os
4 import string
5
6 Import ('env', 'base_glob', 'src_glob')
7 tely = base_glob ('*.tely')
8 png = src_glob ('*.png') + map (env.EPS2PNG, base_glob ('*.eps'))
9
10 # We need lily and mf to build these.
11 env.Depends ('lilypond.texi', ['#/lily', '#/mf', '#/python'])
12 env.Depends ('music-glossary.texi', ['#/lily', '#/mf', '#/python'])
13
14 env.Depends ('lilypond.texi', 'lilypond-internals.texi')
15
16 eps = src_glob ('*.eps') + map (env.PNG2EPS, base_glob ('*.png'))
17 env.Depends ('lilypond.texi', eps + png)
18
19 lilypond_book_flags = '''--format=$LILYPOND_BOOK_FORMAT --process="lilypond -I$srcdir/input/manual/ $__verbose --backend=eps --formats=ps,png --header=texidoc -dcheck-internal-types -ddump-signatures -danti-alias-factor=2 -dgs-load-fonts" '''
20 e = env.Copy (
21 #       LILYPOND_BOOK_FLAGS = '''--process="lilypond --backend=eps --formats=ps,png --header=texidoc -I#/input/manual -e '(ly:set-option (quote internal-type-checking) \#t)'"''',
22         LILYPOND_BOOK_FLAGS = lilypond_book_flags,
23         __verbose = ' --verbose',
24         GENERATE_DOCUMENTATION = '$srcdir/ly/generate-documentation',
25         ## TEXI2DVI_FLAGS = ['-I#Documentation/user'],
26         )
27
28 e.Command ('lilypond-internals.texi', ['#/lily', '#/mf', '#/python'],
29            'cd ${TARGET.dir} && $LILYPOND $GENERATE_DOCUMENTATION')
30
31 ## FIXME: implicit steps from [TE]LY -> PDF
32 texi = map (env.TEXI, tely)
33 dvi = map (env.TEXIDVI, tely)
34 ps = map (env.DVIPS, tely) ###map (lambda x: x + '.dvi', tely))
35 dvipdf = map (env.DVIPDF, tely)
36 pdf = map (env.PSPDF, dvipdf)
37
38 # FIXME: install
39 info = map (env.INFO, tely)
40
41 def file_subst (file_name, find, subst):
42         s = open (file_name).read ()
43         t = string.replace (s, find, subst)
44         if s != t:
45                 os.rename (file_name, file_name + '~')
46                 h = open (file_name, "w")
47                 h.write (t)
48                 h.close ()
49
50 e['usersrc'] = Dir ('.').srcnode ().abspath
51 e['userout'] = Dir ('.').abspath
52
53 a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \
54      --css-include=$srcdir/Documentation/texinfo.css $__verbose \
55      --output=${TARGET.dir} $SOURCE',
56      'ln -f ${SOURCE.dir}/*.png ${SOURCE.dir}/*.ly ${TARGET.dir}/',]
57
58 e.Command ('lilypond/index.html', 'lilypond.texi', a)
59 e.Command ('lilypond-internals/index.html', 'lilypond-internals.texi', a)
60 e.Command ('music-glossary/index.html', 'music-glossary.texi', a)
61
62 a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \
63      --no-split --no-headers \
64      --css-include=$srcdir/Documentation/texinfo.css $__verbose \
65      --output=$TARGET $SOURCE']
66
67 e.Command ('lilypond.html', 'lilypond.texi', a)
68 e.Command ('lilypond-internals.html', 'lilypond-internals.texi', a)
69 e.Command ('music-glossary.html', 'music-glossary.texi', a)
70
71 #Hmm -- why not just mv ./Documentation/{*,*/*} ./doc :-)
72 env.Alias ('doc', texi)
73 env.Alias ('doc', dvi)
74 env.Alias ('doc', ps)
75 env.Alias ('doc', pdf)
76
77 env.Alias ('doc', 'lilypond/index.html')
78 env.Alias ('doc', 'lilypond-internals/index.html')
79 env.Alias ('doc', 'lilypond.html')
80 env.Alias ('doc', 'lilypond-internals.html')
81
82 # install ('lilypond/*', env['sharedir_doc_package'] + '/html')
83 # install ('lilypond-user/*', env['sharedir_doc_package'] + '/html')