From: janneke Date: Fri, 9 Jul 2004 02:10:54 +0000 (+0000) Subject: * buildscripts/builder.py: X-Git-Tag: release/2.3.9^2~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=62bec94a2061ba9ce945eaf0a35682d07f381450;p=lilypond.git * buildscripts/builder.py: * Documentation/SConscript (outdir): New file. --- diff --git a/ChangeLog b/ChangeLog index df4f66525e..9fe008e67c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-07-09 Jan Nieuwenhuizen + + * buildscripts/builder.py: + * Documentation/SConscript (outdir): New file. + 2004-07-08 Jan Nieuwenhuizen * SConstruct: Add Tar target (incomplete), fix install issues, fix diff --git a/Documentation/SConscript b/Documentation/SConscript new file mode 100644 index 0000000000..ce873d728b --- /dev/null +++ b/Documentation/SConscript @@ -0,0 +1,52 @@ +# -*-python-*- + +import glob +import os + +here = os.getcwd () +reldir = str (Dir ('.').srcnode ()) +os.chdir (reldir) +sources = glob.glob ('*.tely') + glob.glob ('user/*.tely') +os.chdir (here) + +Import ('env') +e = env.Copy () +outdir = os.path.join (env['build'], reldir, env['out']) + +# Too late +e.Append (LILYPOND_BOOK_PATH = [os.path.join (env['srcdir'], reldir, 'user')]) +e['LILYPOND_BOOK_PATH'].append (os.path.join (env['srcdir'], reldir, 'user')) + + + +def verbose_opt (env, opt): + if env['verbose']: + return opt + return '' + +LILYPOND_BIN = env['LILYPOND_BIN'] +LILYPONDPREFIX = env['LILYPONDPREFIX'] + +# $(outdir)/lilypond-internals.nexi $(outdir)/lilypond-internals.texi: $(builddir)/lily/$(outconfbase)/lilypond-bin +# cd $(outdir) && $(builddir)/lily/$(outconfbase)/lilypond-bin --verbose $(abs-srcdir)/ly/generate-documentation +# rm -f $(outdir)/lilypond-internals.nexi +# -ln $(outdir)/lilypond-internals.texi $(outdir)/lilypond-internals.nexi + +e.Depends ('lilypond.texi', 'feta16list.ly') +e.Depends ('lilypond.texi', 'parmesan16list.ly') +e.Depends ('lilypond.texi', 'lilypond-internals.texi') + +e.Command ('lilypond-internals.texi', LILYPOND_BIN, + ('(cd $$(dirname $TARGET) && \ + LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \ + + verbose_opt (env, ' --verbose') \ + + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\ + + ')') % vars ()) + +docs = e.Tely2pdf (sources) + +e.Alias ('doc', docs) + +#testing +all_sources = ['SConscript',] + sources +x = env.Tar (env['tarball'], all_sources) diff --git a/SConstruct b/SConstruct index 390f3da7dc..5b1286f8e1 100644 --- a/SConstruct +++ b/SConstruct @@ -52,6 +52,7 @@ env = Environment () # put your favourite stuff in custom.py opts = Options ('custom.py', ARGUMENTS) +#opts = Options (None, ARGUMENTS) opts.Add ('prefix', 'Install prefix', '/usr/') opts.Add ('out', 'Output directory', 'out-scons') opts.Add ('build', 'Build directory', '.') @@ -241,6 +242,13 @@ if env['gui']: env = conf.Finish () +here = os.getcwd () +reldir = str (Dir ('.').srcnode ()) +os.chdir (reldir) +srcdir = os.getcwd () +os.chdir (here) +env['srcdir'] = srcdir + build = env['build'] out = env['out'] ##reldir = str (Dir ('.').srcnode ()) @@ -300,10 +308,35 @@ if 'tar' in COMMAND_LINE_TARGETS: Export ('env') +#ugr +if build == '.': + absbuild = os.getcwd () +else: + absbuild = build + +# duh +env['MAKEINFO'] = 'LANG= makeinfo' +env['PYTHON'] = 'python' +env['LILYPOND_BIN'] = os.path.join (absbuild, 'lily', out, 'lilypond-bin') +env['LILYPONDPREFIX'] = os.path.join (outdir, 'usr/share/lilypond') +env['LILYPOND_BOOK'] = srcdir + '/scripts/lilypond-book.py' +env['LILYPOND_BOOK_FLAGS'] = '' +env['LILYPOND_BOOK_FORMAT'] = 'texi-html' +env['LILYPOND_BOOK_PATH'] = ['.', '#/input', '#/input/regression', + '#/input/test', '#/input/tutorial', + os.path.join (absbuild, 'mf', out), + '#/Documentation/user', + os.path.join (absbuild, 'Documentation', out)] + +## TEXINFO_PAPERSIZE_OPTION= $(if $(findstring $(PAPERSIZE),a4),,-t @afourpaper) +env['TEXINFO_PAPERSIZE_OPTION'] = '-t@afourpaper' + +SConscript ('buildscripts/builder.py') #subdirs = ['mf',] #subdirs = ['flower', 'lily', 'parser', 'gui', 'main',] -subdirs = ['flower', 'lily', 'mf', 'scm', 'ly'] +#subdirs = ['flower', 'lily', 'mf', 'scm', 'ly'] +subdirs = ['flower', 'lily', 'mf', 'scm', 'ly', 'Documentation'] for d in subdirs: b = os.path.join (build, d, out) # Support clean sourctree build (srcdir build) @@ -319,6 +352,10 @@ readme_txt = ['AUTHORS.txt', 'README.txt', 'INSTALL.txt', 'NEWS.txt'] # to be [re]moved after spit patch_files = ['emacsclient.patch', 'server.el.patch', 'darwin.patch'] +map (lambda x: env.Texi2txt (x, os.path.join ('Documentation/topdocs', + os.path.splitext (x)[0])), + readme_txt) + #testing env.Append (TARFLAGS = '-z --owner=0 --group=0') env.Append (GZIPFLAGS = '-9') @@ -328,6 +365,7 @@ all_sources = ['SConstruct',] + subdirs \ tar = env.Tar (env['tarball'], all_sources) +# as a builder? def symlink_tree (prefix): def mkdirs (dir): def mkdir (dir): @@ -340,7 +378,7 @@ def symlink_tree (prefix): os.mkdir (dir) os.chdir (dir) map (mkdir, string.split (dir, os.sep)) - srcdir = os.getcwd () + #srcdir = os.getcwd () def symlink (src, dst): dir = os.path.dirname (dst) mkdirs (dir) diff --git a/buildscripts/builder.py b/buildscripts/builder.py new file mode 100644 index 0000000000..fa6c989dbf --- /dev/null +++ b/buildscripts/builder.py @@ -0,0 +1,79 @@ +# -*-python-*- + +import os +import string + +Import ('env') + +def verbose_opt (env, opt): + if env['verbose']: + return opt + return '' + +srcdir = env['srcdir'] +build = env['build'] +def join_path (path, infix=os.pathsep, prefix = ''): + def dir (x): + if x and x[0] == '#': + return srcdir + x[1:] + return x + return string.join (map (lambda x: prefix + dir (x), path), infix) + +a = env['MAKEINFO'] + verbose_opt (env, ' --verbose') \ + + ' --no-split --no-headers --output=$TARGET $SOURCE' + +texi2txt = Builder (action = a, suffix = '.txt', src_suffix = '.texi') + +env.Append (BUILDERS = {'Texi2txt': texi2txt}) + + +PYTHON = env['PYTHON'] +LILYPOND_BIN = env['LILYPOND_BIN'] +LILYPOND_BOOK = env['LILYPOND_BOOK'] +LILYPOND_BOOK_FLAGS = env['LILYPOND_BOOK_FLAGS'] +LILYPOND_BOOK_FORMAT = env['LILYPOND_BOOK_FORMAT'] +LILYPOND_BOOK_INCLUDES = join_path (env['LILYPOND_BOOK_PATH'], '', + ' --include=') +LILYPONDPREFIX = env['LILYPONDPREFIX'] + +env.Append (ENV = {'PATH' : os.environ['PATH']}) +if os.environ.has_key ('LD_LIBRARY_PATH'): + env.Append (ENV = {'LD_LIBRARY_PATH' : os.environ['LD_LIBRARY_PATH']}) +if os.environ.has_key ('GUILE_LOAD_PATH'): + env.Append (ENV = {'GUILE_LOAD_PATH' : os.environ['GUILE_LOAD_PATH']}) + +if os.environ.has_key ('TEXMF'): + env.Append (ENV = {'TEXMF' : os.environ['TEXMF']}) +env.Append (ENV = {'TEXMF' : '{' + LILYPONDPREFIX + ',' \ + + os.popen ('kpsexpand \$TEXMF').read ()[:-1] + '}' }) + +a = (r'''rm -f $$(grep -LF '\lilypondend' $$(dirname $TARGET))/lily-*.tex 2>/dev/null;''' \ + + 'LILYPONDPREFIX=%(LILYPONDPREFIX)s '\ + + PYTHON + ' ' + LILYPOND_BOOK + verbose_opt (env, ' --verbose')\ + + ' --include=$$(dirname $TARGET) %(LILYPOND_BOOK_INCLUDES)s'\ + + r""" --process='%(LILYPOND_BIN)s %(LILYPOND_BOOK_INCLUDES)s'"""\ + + ' --output=$$(basename $TARGET) --format=%(LILYPOND_BOOK_FORMAT)s\ + %(LILYPOND_BOOK_FLAGS)s\ + $SOURCE') % vars () + +tely2pdf = Builder (action = a, suffix = '.texi', src_suffix = '.tely') + +env.Append (BUILDERS = {'Tely2pdf': tely2pdf}) + +TEXINFO_PAPERSIZE_OPTION = env['TEXINFO_PAPERSIZE_OPTION'] +a = '(cd $$(dirname $TARGET) &&\ + texi2dvi --batch %(TEXINFO_PAPERSIZE_OPTION)s $$(basename $SOURCE)' % vars () + +texi2dvi = Builder (action = a, suffix = '.dvi', src_suffix = '.texi') + +env.Append (BUILDERS = {'Texi2dvi': texi2dvi}) + + +# $(outdir)/lilypond/lilypond.html: $(outdir)/lilypond.texi +# mkdir -p $(dir $@) +# $(MAKEINFO) -I$(outdir) --output=$(outdir)/lilypond --css-include=$(builddir)/Documentation/texinfo.css --html $< +# $(MAKEINFO) -I$(outdir) --output=$@ --css-include=$(builddir)/Documentation/texinfo.css --html --no-split --no-headers $< +# perl -i~ -pe 's!../lilypond-internals!lilypond-internals/!g' $(outdir)/lilypond.html +# rm -f $(outdir)/lilypond/*.png $(outdir)/lilypond/*.ly +# -ln -f $(outdir)/*.png $(outdir)/*.ly $(outdir)/lilypond/ + diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index 10f62acf83..f3b9c2e661 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -263,7 +263,7 @@ for opt in options: texfile_nm = a elif o == '--enc': enc_nm = a - elif o == '--ly' or o == '-': + elif o == '--ly' or o == '-l': lyfile_nm = a elif o== '--help' or o == '-h': help() @@ -291,7 +291,7 @@ for filenm in files: del g['DesignSize'] write_afm_metric (afm, g, m) - + write_tex_defs (open (texfile_nm, 'w'), g, m) enc_name = 'FetaEncoding' if re.search ('parmesan', filenm) : @@ -306,7 +306,7 @@ for filenm in files: [base + '.dvi', base + '.pfa', base + '.pfb', texfile_nm, afmfile_nm]) if lyfile_nm: - write_fontlist(open (lyfile_nm, 'w'), g, m) + write_fontlist (open (lyfile_nm, 'w'), g, m) diff --git a/mf/SConscript b/mf/SConscript index a12f880efc..6f871d9cb7 100644 --- a/mf/SConscript +++ b/mf/SConscript @@ -21,10 +21,14 @@ os.chdir (here) Import ('env') MFMODE = env['MFMODE'] -def add_log_enc_ly_tex_target (target, source, env): +def add_log_target (target, source, env): base = os.path.splitext (str (target[0]))[0] - et = (map (lambda x: base + x, ['.log', '.enc', '.ly', '.tex'])) - return (target + et, source) + return (target + [base + '.log'], source) + +def add_enc_ly_tex_target (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target + [base + '.enc', base + '.tex', base + 'list.ly'] + , source) outdir = os.path.join (env['build'], reldir, env['out']) tfm = Builder (action = ('(cd ' + outdir + ' && ' \ @@ -34,18 +38,19 @@ tfm = Builder (action = ('(cd ' + outdir + ' && ' \ + ' | grep -v "@\|>>")') % vars (), suffix = '.tfm', src_suffix = '.mf', - emitter = add_log_enc_ly_tex_target) + emitter = add_log_target) -afm = Builder (action = (sys.executable +afm = Builder (action = (sys.executable \ + ' buildscripts/mf-to-table.py ' \ - + ' --package=. --outdir=%(outdir)s '\ - + ' --afm %(outdir)s/$$(basename $TARGET .afm).afm' \ - + ' --enc %(outdir)s/$$(basename $TARGET .afm).enc' \ - + ' --tex %(outdir)s/$$(basename $TARGET .afm).tex' \ - + ' --ly %(outdir)s/$$(basename $TARGET .afm).ly'\ + + ' --outdir=%(outdir)s '\ + + ' --afm=%(outdir)s/$$(basename $TARGET .afm).afm' \ + + ' --enc=%(outdir)s/$$(basename $TARGET .afm).enc' \ + + ' --tex=%(outdir)s/$$(basename $TARGET .afm).tex' \ + + ' --ly=%(outdir)s/$$(basename $TARGET .afm)list.ly'\ + ' %(outdir)s/$$(basename $SOURCE)') % vars (), suffix = '.afm', - src_suffix = '.log') + src_suffix = '.log', + emitter = add_enc_ly_tex_target) def add_enc_src (target, source, env): base = os.path.splitext (str (target[0]))[0]