# -*-python-*- import os import string Import ('env') telys = env['glob'] (env, '*.tely') pngs = env['glob'] (env, '*.png') # We need lily and mf to build these. env.Depends ('lilypond.texi', ['#/lily', '#/mf']) env.Depends ('music-glossary.texi', ['#/lily', '#/mf']) env.Depends ('lilypond.texi', 'lilypond-internals.texi') epss = map (env.Png2eps, pngs) env.Depends ('lilypond.texi', epss) e = env.Copy ( LILYPOND_BOOK_FLAGS = '''--process="lilypond-bin -I$srcdir/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"''', __verbose = ' --verbose', ) e.Command ('lilypond-internals.texi', env['LILYPOND_BIN'], 'cd ${TARGET.dir} \ && LILYPONDPREFIX=$LILYPONDPREFIX $LILYPOND_BIN $__verbose \ $srcdir/ly/generate-documentation') texis = map (env.TEXI, telys) dvis = map (env.Texi2dvi, telys) pss = map (env.PostScript, map (lambda x: x + '.dvi', telys)) pdfs = map (env.Dvi2pdf, telys) infos = map (env.INFO, telys) def file_subst (file_name, find, subst): s = open (file_name).read () t = string.replace (s, find, subst) if s != t: os.rename (file_name, file_name + '~') h = open (file_name, "w") h.write (t) h.close () e['usersrc'] = Dir ('.').srcnode ().abspath e['userout'] = Dir ('.').abspath def url_fixup (target, source, env): file_subst (str (target[0]), '../lilypond-internals', 'lilypond-internals/') a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \ --css-include=$srcdir/Documentation/texinfo.css $__verbose \ --output=${TARGET.dir} $SOURCE', '$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \ --no-split --no-headers \ --css-include=$srcdir/Documentation/texinfo.css $__verbose \ --output=$TARGET $SOURCE', url_fixup, 'ln -f ${SOURCE.dir}/*.png ${SOURCE.dir}/*.ly ${TARGET.dir}/',] e.Command ('lilypond/lilypond.html', 'lilypond.texi', a) e.Command ('lilypond-internals/lilypond-internals.html', 'lilypond-internals.texi', a) #Hmm -- why not just mv ./Documentation/{*,*/*} ./doc :-) env.Alias ('doc', texis) env.Alias ('doc', dvis) env.Alias ('doc', pss) env.Alias ('doc', pdfs) env.Alias ('doc', 'lilypond/lilypond.html') env.Alias ('doc', 'lilypond-internals/lilypond-internals.html') #dir = env['DESTDIR'] + env['sharedir_doc_package'] + '/html' #env.Install (dir, 'lilypond') #env.Install (dir, 'lilypond-user') #env.Alias ('install', dir)