X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fuser%2FSConscript;h=5ef1efdd3d0ff17f2b797768f224a7d9e14d56e9;hb=543171165412bc915d8ea1f308d070c74924b2f1;hp=d0c237277ec7c6f619f3c0e5b66910f225e60de8;hpb=2b6a697fb743cf869858a1d58454d6192124a0d9;p=lilypond.git diff --git a/Documentation/user/SConscript b/Documentation/user/SConscript index d0c237277e..5ef1efdd3d 100644 --- a/Documentation/user/SConscript +++ b/Documentation/user/SConscript @@ -1,87 +1,83 @@ # -*-python-*- -import glob import os -import re -import sys +import string -Import ('env') -sources = env['src_glob'] (env, '*.tely') -pngs = env['src_glob'] (env, '*.png') +Import ('env', 'base_glob', 'src_glob') +tely = base_glob ('*.tely') +png = src_glob ('*.png') + map (env.EPS2PNG, base_glob ('*.eps')) -def verbose_opt (env, opt): - if env['verbose']: - return opt - return '' +# We need lily and mf to build these. +env.Depends ('lilypond.texi', ['#/lily', '#/mf', '#/python']) +env.Depends ('music-glossary.texi', ['#/lily', '#/mf', '#/python']) -LILYPOND_BIN = env['LILYPOND_BIN'] -LILYPONDPREFIX = env['LILYPONDPREFIX'] - -mfbuild = os.path.join (env['absbuild'], 'mf', env['out']) -lilybuild = os.path.join (env['absbuild'], 'lily', env['out']) -userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out']) - -env.Depends ('lilypond.texi', LILYPOND_BIN) env.Depends ('lilypond.texi', 'lilypond-internals.texi') -env.Depends ('doc', mfbuild) -png_stems = map (lambda x: os.path.splitext (x)[0], pngs) -epss = map (env.Png2eps, png_stems) -env.Depends ('lilypond.texi', epss) +eps = src_glob ('*.eps') + map (env.PNG2EPS, base_glob ('*.png')) +env.Depends ('lilypond.texi', eps + png) + +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" ''' +e = env.Copy ( +# LILYPOND_BOOK_FLAGS = '''--process="lilypond --backend=eps --formats=ps,png --header=texidoc -I#/input/manual -e '(ly:set-option (quote internal-type-checking) \#t)'"''', + LILYPOND_BOOK_FLAGS = lilypond_book_flags, + __verbose = ' --verbose', + GENERATE_DOCUMENTATION = '$srcdir/ly/generate-documentation', + ## TEXI2DVI_FLAGS = ['-I#Documentation/user'], + ) -env.Command ('lilypond-internals.texi', LILYPOND_BIN, - ('(cd ${TARGET.dir} && \ - LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \ - + verbose_opt (env, ' --verbose') \ - + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\ - + ')') % vars ()) +e.Command ('lilypond-internals.texi', ['#/lily', '#/mf', '#/python'], + 'cd ${TARGET.dir} && $LILYPOND $GENERATE_DOCUMENTATION') -doc_stems = map (lambda x: os.path.splitext (x)[0], sources) -texis = map (env.Tely2texi, doc_stems) -dvis = map (env.Texi2dvi, doc_stems) -pss = map (env.PostScript, map (lambda x: x + '.dvi', doc_stems)) -pdfs = map (env.Dvi2pdf, doc_stems) +## FIXME: implicit steps from [TE]LY -> PDF +texi = map (env.TEXI, tely) +dvi = map (env.TEXIDVI, tely) +ps = map (env.DVIPS, tely) ###map (lambda x: x + '.dvi', tely)) +dvipdf = map (env.DVIPDF, tely) +pdf = map (env.PSPDF, dvipdf) +# FIXME: install +info = map (env.INFO, tely) def file_subst (file_name, find, subst): - find_re = re.compile (find, re.MULTILINE) s = open (file_name).read () - t = re.sub (find_re, subst, s) + 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 () -##docdir = os.path.join (env['srcdir'], 'Documentation') -docdir = Dir ('.').srcnode ().abspath + '/..' -reldir = 'foe' -out = env['out'] -srcdir = env['srcdir'] -verbose = verbose_opt (env, ' --verbose') -a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\ - + ' --output=${TARGET.dir}'\ - + ' --css-include=%(docdir)s/texinfo.css'\ - + ' --html%(verbose)s'\ - + ' $SOURCE &&' \ - + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \ - + ' --output=$TARGET' \ - + ' --css-include=%(docdir)s/texinfo.css' \ - + ' --html --no-split --no-headers %(verbose)s' \ - + ' $SOURCE') % vars () -def url_fixup (target, source, env): - file_subst (str (target[0]), - '\.\./lilypond-internals', 'lilypond-internals/') -c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars () -e = env.Copy () -e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c]) -e.Command ('lilypond-internals/lilypond-internals.html', - 'lilypond-internals.texi', a) - -env.Alias ('doc', texis) -env.Alias ('doc', dvis) -env.Alias ('doc', pss) -env.Alias ('doc', pdfs) - -env.Alias ('doc', 'lilypond-internals/lilypond.html') -env.Alias ('doc', 'lilypond-internals/lilypond-internals.html') +e['usersrc'] = Dir ('.').srcnode ().abspath +e['userout'] = Dir ('.').abspath + +a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \ + --css-include=$srcdir/Documentation/texinfo.css $__verbose \ + --output=${TARGET.dir} $SOURCE', + 'ln -f ${SOURCE.dir}/*.png ${SOURCE.dir}/*.ly ${TARGET.dir}/',] + +e.Command ('lilypond/index.html', 'lilypond.texi', a) +e.Command ('lilypond-internals/index.html', 'lilypond-internals.texi', a) +e.Command ('music-glossary/index.html', 'music-glossary.texi', a) + +a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \ + --no-split --no-headers \ + --css-include=$srcdir/Documentation/texinfo.css $__verbose \ + --output=$TARGET $SOURCE'] + +e.Command ('lilypond.html', 'lilypond.texi', a) +e.Command ('lilypond-internals.html', 'lilypond-internals.texi', a) +e.Command ('music-glossary.html', 'music-glossary.texi', a) + +#Hmm -- why not just mv ./Documentation/{*,*/*} ./doc :-) +env.Alias ('doc', texi) +env.Alias ('doc', dvi) +env.Alias ('doc', ps) +env.Alias ('doc', pdf) + +env.Alias ('doc', 'lilypond/index.html') +env.Alias ('doc', 'lilypond-internals/index.html') +env.Alias ('doc', 'lilypond.html') +env.Alias ('doc', 'lilypond-internals.html') + +# install ('lilypond/*', env['sharedir_doc_package'] + '/html') +# install ('lilypond-user/*', env['sharedir_doc_package'] + '/html')