10 reldir = str (Dir ('.').srcnode ())
12 sources = glob.glob ('*.tely')
13 pngs = glob.glob ('*.png')
15 outdir = os.path.join (env['build'], reldir, env['out'])
17 def verbose_opt (env, opt):
22 LILYPOND_BIN = env['LILYPOND_BIN']
23 LILYPONDPREFIX = env['LILYPONDPREFIX']
25 mfbuild = os.path.join (env['absbuild'], 'mf', env['out'])
26 lilybuild = os.path.join (env['absbuild'], 'lily', env['out'])
27 userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out'])
29 # more of these? -- howto?
30 env.Depends ('lilypond.texi', os.path.join (mfbuild, 'feta16list.ly'))
31 env.Depends ('lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly'))
33 env.Depends ('doc', os.path.join (mfbuild, 'feta20.enc'))
34 env.Depends ('doc', os.path.join (mfbuild, 'feta20.enc'))
36 env.Depends ('lilypond.texi', LILYPOND_BIN)
37 env.Depends ('lilypond.texi', 'lilypond-internals.texi')
39 ##env.Depends ('lilypond.texi', 'fonts')
42 env.Depends ('doc', mfbuild)
44 png_stems = map (lambda x: os.path.splitext (x)[0], pngs)
45 epss = map (env.Png2eps, png_stems)
46 env.Depends ('lilypond.texi', epss)
48 env.Command ('lilypond-internals.texi', LILYPOND_BIN,
49 ('(cd ${TARGET.dir} && \
50 LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \
51 + verbose_opt (env, ' --verbose') \
52 + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\
55 doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
56 texis = map (env.Tely2texi, doc_stems)
57 dvis = map (env.Texi2dvi, doc_stems)
58 pss = map (env.PostScript, map (lambda x: x + '.dvi', doc_stems))
59 pdfs = map (env.Dvi2pdf, doc_stems)
62 def file_subst (file_name, find, subst):
63 find_re = re.compile (find, re.MULTILINE)
64 s = open (file_name).read ()
65 t = re.sub (find_re, subst, s)
67 os.rename (file_name, file_name + '~')
68 h = open (file_name, "w")
72 docdir = os.path.join (env['srcdir'], 'Documentation')
74 srcdir = env['srcdir']
75 verbose = verbose_opt (env, ' --verbose')
76 a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
77 + ' --output=${TARGET.dir}'\
78 + ' --css-include=%(docdir)s/texinfo.css'\
79 + ' --html%(verbose)s'\
81 + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \
82 + ' --output=$TARGET' \
83 + ' --css-include=%(docdir)s/texinfo.css' \
84 + ' --html --no-split --no-headers %(verbose)s' \
85 + ' $SOURCE') % vars ()
86 def url_fixup (target, source, env):
87 file_subst (str (target[0]),
88 '\.\./lilypond-internals', 'lilypond-internals/')
89 c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars ()
91 e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c])
92 e.Command ('lilypond-internals/lilypond-internals.html',
93 'lilypond-internals.texi', a)
95 env.Alias ('doc', texis)
96 env.Alias ('doc', dvis)
97 env.Alias ('doc', pss)
98 env.Alias ('doc', pdfs)
100 env.Alias ('doc', 'lilypond-internals/lilypond.html')
101 env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')
103 all_sources = ['SConscript',] + sources + pngs
104 ballprefix = env['ballprefix'] + '/Documentation/user'
105 ball = Builder (prefix = ballprefix + '/', action = 'ln $SOURCE $TARGET')
106 et = env.Copy (BUILDERS = {'BALL': ball})
107 ballize = map (et.BALL, all_sources)
108 tar = env.Tar (env['tarball'],
109 map (lambda x: os.path.join (ballprefix, x), all_sources))