# -*-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')
-def verbose_opt (env, opt):
- if env['verbose']:
- return opt
- return ''
-
-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', env['LILYPOND_BIN'])
env.Depends ('lilypond.texi', 'lilypond-internals.texi')
env.Depends ('doc', mfbuild)
epss = map (env.Png2eps, png_stems)
env.Depends ('lilypond.texi', epss)
-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 ())
+lydir = Dir ('.').srcnode ().abspath + '/../../ly'
+env.Command ('lilypond-internals.texi', env['LILYPOND_BIN'],
+ 'cd ${TARGET.dir} \
+ && LILYPONDPREFIX=$LILYPONDPREFIX $LILYPOND_BIN $__verbose \
+ $lydir/generate-documentation')
doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
texis = map (env.Tely2texi, doc_stems)
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 (find, subst, s)
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 ()
+e = env.Copy ()
+e['usersrc'] = Dir ('.').srcnode ().abspath
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])
+a = ['$MAKEINFO -I$usersrc -I${SOURCE.dir} --html \
+--css-include=$usersrc/../texinfo.css $__verbose \
+--output=${TARGET.dir} $SOURCE',
+ '$MAKEINFO -I$usersrc -I${SOURCE.dir} --html --no-split --no-headers \
+ --css-include=$usersrc/../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)
+ '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/lilypond.html')
env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')
'''
Experimental scons (www.scons.org) building:
+scons TARGET builds from source directory ./TARGET (not recursive)
+
+
Usage:
scons
scons lily # build lily
LILYPONDPREFIX=out-scons/usr/share/lilypond lily/out-scons/lilypond-bin
scons doc # build web doc
- scons fonts # build all font stuff (split this? )
+? scons fonts # build all font stuff (split this? )
scons config # reconfigure
import sys
import string
+# SConscripts are only needed in directories where something needs
+# to be done, building or installing
+# TODO: Documentation/*, input/*/*, vim, po
+# rename Documentation/* to ./doc?
subdirs = ['flower', 'lily', 'mf', 'scm', 'ly', 'Documentation',
- 'Documentation/user', 'input']
+ 'Documentation/user', 'input', 'scripts', 'elisp',
+ 'buildscripts', 'cygwin', 'debian']
usage = r'''Usage:
scons [KEY=VALUE].. [TARGET]..
env['version'])
env['lilypondprefix'] = os.path.join (env['sharedir_package_version'])
-
if env['debugging']:
env.Append (CFLAGS = '-g')
env.Append (CXXFLAGS = '-g')
env.Append (CXXFLAGS = '-W')
env.Append (CXXFLAGS = '-Wall')
env.Append (CXXFLAGS = '-Wconversion')
+if env['verbose']:
+ env['__verbose'] = '--verbose'
+build = env['build']
+out = env['out']
-
-##Import ('env')
-here = os.getcwd ()
-reldir = str (Dir ('.').srcnode ())
-os.chdir (reldir)
-srcdir = os.getcwd ()
-os.chdir (here)
-##outdir = os.path.join (env['build'], reldir, env['out'])
-outdir = os.path.join (env['build'], env['out'])
+outdir = Dir ('.').path
+abs_srcdir = Dir ('.').srcnode ().abspath
+srcdir = abs_srcdir
+abs_outdir = Dir ('.').abspath
env['srcdir'] = srcdir
-build = env['build']
-out = env['out']
def list_sort (lst):
if 1 or not os.path.exists (config_h) or 'config' in COMMAND_LINE_TARGETS:
env = configure (env)
-env.Append (LIBPATH = ['#/flower/' + out,], CPPPATH = [outdir, '#',])
-
-Export ('env')
#ugr
if build == '.':
absbuild = build
env['absbuild'] = absbuild
-# duh
+env.Append (LIBPATH = [os.path.join (absbuild, 'flower', out),],
+ CPPPATH = [outdir, '#',])
+
+Export ('env')
+
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['LILYPONDPREFIX'] = os.path.join (absbuild, out, 'usr/share/lilypond')
env['LILYPOND_BOOK'] = srcdir + '/scripts/lilypond-book.py'
env['ABC2LY_PY'] = srcdir + '/scripts/abc2ly.py'
env['MF_TO_TABLE_PY'] = srcdir + '/buildscripts/mf-to-table.py'
SConscript ('buildscripts/builder.py')
for d in subdirs:
- b = os.path.join (build, d, out)
- # Support clean sourcetree build (--srcdir build)
- # and ./out build.
- if (build and build != '.') \
- or (out and out != '.'):
- env.BuildDir (b, d, duplicate=0)
- SConscript (os.path.join (b, 'SConscript'))
+ if os.path.exists (os.path.join (d, 'SConscript')):
+ b = os.path.join (build, d, out)
+ # Support clean sourcetree build (--srcdir build)
+ # and ./out build.
+ if (build and build != '.') or (out and out != '.'):
+ env.BuildDir (b, d, duplicate=0)
+ SConscript (os.path.join (b, 'SConscript'))
# as a builder?
def symlink_tree (prefix):
--- /dev/null
+# -*-python-*-
+
+Import ('env')
+sources = ['lilypond-profile.sh', 'lilypond-login.sh']
+gens = map (env.AT, sources)
import glob
import os
-import re
import string
Import ('env')
-def verbose_opt (env, opt):
- if env['verbose']:
- return opt
- return ''
-
+# junkme
srcdir = env['srcdir']
-build = env['build']
+
def join_path (path, infix=os.pathsep, prefix = ''):
def dir (x):
if x and x[0] == '#':
return x
return string.join (map (lambda x: prefix + dir (x), path), infix)
-verbose = verbose_opt (env, ' --verbose')
-MAKEINFO_INCLUDES = join_path (env['MAKEINFO_PATH'], '', ' -I')
-MAKEINFO = env['MAKEINFO']
-a = ('%(MAKEINFO)s%(verbose)s %(MAKEINFO_INCLUDES)s'\
- ' --no-split --no-headers --output=$TARGET $SOURCE') % vars ()
+env['MAKEINFO_INCLUDES'] = join_path (env['MAKEINFO_PATH'], '', ' -I')
+a = '$MAKEINFO $__verbose $MAKEINFO_INCLUDES --no-split --no-headers \
+--output=$TARGET $SOURCE'
texi2txt = Builder (action = a, suffix = '.txt', src_suffix = '.texi')
env.Append (BUILDERS = {'Texi2txt': texi2txt})
-
-PYTHON = env['PYTHON']
-ABC2LY_PY = env['ABC2LY_PY']
-LILYPOND_PY = env['LILYPOND_PY']
-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['LILYPOND_BOOK_INCLUDES'] = join_path (env['LILYPOND_BOOK_PATH'], '',
+ ' --include=')
# UGHR, lilypond.py uses lilypond-bin from PATH
#env.Append (ENV = {'PATH' : os.environ['PATH']})
if os.environ.has_key ('TEXMF'):
env.Append (ENV = {'TEXMF' : os.environ['TEXMF']})
-env.Append (ENV = {'TEXMF' : '{' + LILYPONDPREFIX + ',' \
+env.Append (ENV = {'TEXMF' : '{' + env['LILYPONDPREFIX'] + ',' \
+ os.popen ('kpsexpand \$TEXMF').read ()[:-1] + '}' })
if os.environ.has_key ('LD_LIBRARY_PATH'):
env.Append (ENV = { 'PYTHONPATH' : string.join (env['PYTHONPATH'],
os.pathsep) } )
-verbose = verbose_opt (env, ' --verbose')
-a = (r'''rm -f $$(grep -LF '\lilypondend' ${TARGET.dir}/lily-*.tex 2>/dev/null); ''' \
- + 'LILYPONDPREFIX=%(LILYPONDPREFIX)s '\
- + '%(PYTHON)s %(LILYPOND_BOOK)s%(verbose)s'\
- + ' --include=${TARGET.dir} %(LILYPOND_BOOK_INCLUDES)s'\
- + r""" --process='%(LILYPOND_BIN)s %(LILYPOND_BOOK_INCLUDES)s'"""\
- + ' --output=${TARGET.dir} --format=%(LILYPOND_BOOK_FORMAT)s\
- %(LILYPOND_BOOK_FLAGS)s\
- $SOURCE') % vars ()
+a = ['rm -f $$(grep -LF "\lilypondend" ${TARGET.dir}/lily-*.tex 2>/dev/null);',
+ 'LILYPONDPREFIX=$LILYPONDPREFIX \
+ $PYTHON $LILYPOND_BOOK $__verbose \
+ --include=${TARGET.dir} $LILYPOND_BOOK_INCLUDES \
+ --process="$LILYPOND_BIN $LILYPOND_BOOK_INCLUDES" \
+ --output=${TARGET.dir} --format=$LILYPOND_BOOK_FORMAT \
+ $LILYPOND_BOOK_FLAGS \
+ $SOURCE']
tely2texi = Builder (action = a, suffix = '.texi', src_suffix = '.tely')
env.Append (BUILDERS = {'Tely2texi': tely2texi})
-TEXINFO_PAPERSIZE_OPTION = env['TEXINFO_PAPERSIZE_OPTION']
-a = '(cd ${TARGET.dir} &&\
- texi2dvi --batch %(TEXINFO_PAPERSIZE_OPTION)s ${SOURCE.file})' % vars ()
+a = 'cd ${TARGET.dir} \
+&& texi2dvi --batch $TEXINFO_PAPERSIZE_OPTION ${SOURCE.file}'
texi2dvi = Builder (action = a, suffix = '.dvi', src_suffix = '.texi')
env.Append (BUILDERS = {'Texi2dvi': texi2dvi})
env.Append (DVIPSFLAGS = '-Ppdf -u+lilypond.map -u+ec-mftrace.map')
-DVIPS_PAPERSIZE = 'a4'
-DVIPSFLAGS = env['DVIPSFLAGS']
-a = ('set -x; dvips %(DVIPSFLAGS)s' \
- + ' -o ${TARGET}.pdfps'\
- + ' -t %(DVIPS_PAPERSIZE)s $SOURCE &&'\
- + ' ps2pdf -sPAPERSIZE=%(DVIPS_PAPERSIZE)s ${TARGET}.pdfps $TARGET') \
- % vars ()
+env ['DVIPS_PAPERSIZE'] = 'a4'
+a = ['dvips $DVIPSFLAGS -o ${TARGET}.pdfps -t $DVIPS_PAPERSIZE $SOURCE',
+ 'ps2pdf -sPAPERSIZE=$DVIPS_PAPERSIZE ${TARGET}.pdfps $TARGET']
dvi2pdf = Builder (action = a, suffix = '.pdf', src_suffix = '.dvi')
env.Append (BUILDERS = {'Dvi2pdf': dvi2pdf})
base = os.path.splitext (str (target[0]))[0]
return (target + [base + '.ps'], source)
-#a = ('echo "PATH=$$PATH"; echo "TEXMF=$$TEXMF"; which lilypond-bin;'\
-a = (' LILYPONDPREFIX=%(LILYPONDPREFIX)s '\
- + '%(PYTHON)s %(LILYPOND_PY)s%(verbose)s'\
- + ' --include=${TARGET.dir}'\
- + ' --output=${TARGET.base}'\
- + ' $SOURCE') % vars ()
+a = ' LILYPONDPREFIX=$LILYPONDPREFIX \
+$PYTHON $LILYPOND_PY $__verbose \
+--include=${TARGET.dir} \
+--output=${TARGET.base} $SOURCE'
lilypond = Builder (action = a, suffix = '.pdf', src_suffix = '.ly')
## emitter = add_ps_target)
env.Append (BUILDERS = {'LilyPond': lilypond})
#verbose = verbose_opt (env, ' --verbose')
verbose = ''
-a = ('LILYPONDPREFIX=%(LILYPONDPREFIX)s '\
- + '%(PYTHON)s %(ABC2LY_PY)s%(verbose)s'\
-# + ' --include=${TARGET.dir}'\
- + ' --strict'\
- + ' --output=${TARGET.base}'\
- + ' $SOURCE') % vars ()
+a = 'LILYPONDPREFIX=$LILYPONDPREFIX $PYTHON $ABC2LY_PY \
+--strict --output=${TARGET.base} $SOURCE'
abc2ly = Builder (action = a, suffix = '.ly', src_suffix = '.abc')
env.Append (BUILDERS = {'Abc2ly': abc2ly})
-
-MFMODE = env['MFMODE']
def add_log_target (target, source, env):
base = os.path.splitext (str (target[0]))[0]
return (target + [base + '.log'], source)
return (target + map (lambda x: base + x, target_suffixes),
source + map (lambda x: base + x, src_suffixes))
-scrdir = env['srcdir']
-a = ('(cd ${TARGET.dir} &&'\
- + ' MFINPUTS=.:${SOURCE.dir}:%(srcdir)s/${SOURCE.dir}'\
- + ' mf "\\mode:=%(MFMODE)s; nonstopmode;'\
- + ' input ${SOURCE.filebase};" ' \
- + ' | grep -v "@\|>>")') % vars ()
+a = 'cd ${TARGET.dir} && \
+MFINPUTS=.:${SOURCE.dir}:$srcdir/${SOURCE.dir} \
+mf "\\mode:=$MFMODE; nonstopmode; input ${SOURCE.filebase};" \
+| grep -v "@\|>>"'
tfm = Builder (action = a, suffix = '.tfm', src_suffix = '.mf',
# emitter = lambda t, s, e: add_suffixes (t, s, e, ['.log'], []))
emitter = add_log_target)
env.Append (BUILDERS = {'TFM': tfm})
-MF_TO_TABLE_PY = env['MF_TO_TABLE_PY']
-#verbose = verbose_opt (env, ' --verbose')
-verbose = ''
-a = ('%(PYTHON)s %(MF_TO_TABLE_PY)s%(verbose)s'\
- + ' --outdir=${TARGET.dir}'\
- + ' --afm=${TARGET.base}.afm' \
- + ' --enc=${TARGET.base}.enc' \
- + ' --tex=${TARGET.base}.tex' \
- + ' --ly=${TARGET.base}list.ly'\
- + ' ${TARGET.base}.log') % vars ()
+a = '$PYTHON $MF_TO_TABLE_PY \
+--outdir=${TARGET.dir} \
+--afm=${TARGET.base}.afm \
+--enc=${TARGET.base}.enc \
+--tex=${TARGET.base}.tex \
+--ly=${TARGET.base}list.ly \
+${TARGET.base}.log'
afm = Builder (action = a, suffix = '.afm', src_suffix = '.log',
emitter = add_enc_ly_tex_target)
env.Append (BUILDERS = {'AFM': afm})
return (target, source + [base + '.enc'])
# UGH, should fix --output option for mftrace
-verbose = verbose_opt (env, ' --verbose')
-a = ('(cd ${TARGET.dir} && '
- + ' if test -e ${SOURCE.filebase}.enc; then encoding="--encoding=${SOURCE.filebase}.enc"; fi;' \
-# + ' MFINPUTS=.:${TARGET.dir}:${SOURCE.dir}'\
-# ugrh
- + ' MFINPUTS=%(srcdir)s/mf}:.:'\
- + ' mftrace --pfa --simplify --keep-trying $$encoding%(verbose)s'\
- + ' --include=${TARGET.dir}'\
- + ' ${SOURCE.file})') % vars ()
+a = 'cd ${TARGET.dir} && \
+if test -e ${SOURCE.filebase}.enc; then encoding="--encoding=${SOURCE.filebase}.enc"; fi; \
+MFINPUTS=$srcdir/mf:.: \
+mftrace --pfa --simplify --keep-trying $$encoding $__verbose \
+--include=${TARGET.dir} \
+${SOURCE.file}'
pfa = Builder (action = a,
suffix = '.pfa',
emitter = add_enc_src)
env.Append (BUILDERS = {'PFA': pfa})
-# FIXME
-#verbose = verbose_opt (env, ' --verbose')
-verbose = ''
-DIFF_PY = os.path.join (srcdir, 'stepmake/bin/package-diff.py')
-verbose = ''
-a = ('%(PYTHON)s %(DIFF_PY)s%(verbose)s'\
- + ' --outdir=${TARGET.dir}') % vars ()
+env['DIFF_PY'] = os.path.join (srcdir, 'stepmake/bin/package-diff.py')
+a = '$PYTHON $DIFF_PY $__verbose --outdir=${TARGET.dir}'
patch = Builder (action = a, suffix = '.diff', src_suffix = '.tar.gz')
env.Append (BUILDERS = {'PATCH': patch})
os.chdir (here)
return result
env['src_glob'] = src_glob
+
+atvars = [
+'BASH',
+'DATE',
+'sharedstatedir',
+'GUILE',
+'bindir',
+'date',
+'datadir',
+'lilypond_datadir',
+'lilypond_libdir',
+'local_lilypond_datadir',
+'local_lilypond_libdir',
+'localedir',
+'PACKAGE',
+'package',
+'PATHSEP',
+'PERL',
+'prefix',
+'program_prefix',
+'program_suffix',
+'PYTHON',
+'SHELL',
+'TOPLEVEL_VERSION',
+'step-bindir',
+]
+
+#compat
+env['lilypond_datadir'] = env['sharedir_package']
+env['local_lilypond_datadir'] = env['sharedir_package_version']
+env['TOPLEVEL_VERSION'] = env['version']
+env['SHELL'] = '/bin/sh'
+env['BASH'] = '/bin/bash'
+
+def at (target, source, env):
+ s = open (str (source[0])).read ()
+ for i in atvars:
+ if env.has_key (i):
+ s = string.replace (s, '@%s@'% i, env[i])
+ t = str (target[0])
+ open (t, 'w').write (s)
+ # ugh
+ os.chmod (t, 0755)
+
+at = Builder (action = at)
+env.Append (BUILDERS = {'AT': at})
+
--- /dev/null
+# -*-python-*-
+
+import os
+
+Import ('env')
+sources = env['src_glob'] (env, '*.el') + ['lilypond-words']
+#gen_files = map (lambda x: os.path.splitext (x)[0], sources)
+#gens = map (env.AT, sources)
+
+e = env.Copy ()
+a = '$PYTHON $srcdir/buildscripts/lilypond-words.py --el --dir=${TARGET.dir}'
+e.Command ('lilypond-words.el', '#/lily/my-lily-lexer.cc', a)
+
+dir = env['sharedir_package_version'] + '/elisp'
+env.Install (dir, sources)
e.Depends ('lexer.cc', 'parser.cc')
e.Depends ('my-lily-lexer.o', 'parser.cc')
e.Depends ('my-lily-parser.o', 'parser.cc')
+map (e.Precious, ['parser.cc', 'lexer.cc', 'parser.hh'])
e.Append (LIBS = ['flower'])
e.ParseConfig ('guile-config link')
--- /dev/null
+# -*-python-*-
+
+Import ('env')
+texdir = env['sharedir_package_version'] + '/tex'
+psdir = env['sharedir_package_version'] + '/ps'
+env.Install (psdir, ['lilyponddefs',])
+env.Install (texdir, ['music-drawing-routines',])
+#env.Alias ('install', texdir)
+env.Alias ('install', psdir)
--- /dev/null
+# -*-python-*-
+
+import os
+
+Import ('env')
+sources = env['src_glob'] (env, '*.py')
+gen_files = map (lambda x: os.path.splitext (x)[0], sources)
+gens = map (env.AT, sources)
+dir = env['bindir']
+env.Install (dir, gen_files)
+#env.Install (dir, sources)
+#env.Install (dir, gens)
+#env.Alias ('install', dir)
--- /dev/null
+# -*-python-*-
+
+Import ('env')
+sources = env['src_glob'] (env, '*.tex') + ['latin1.enc']
+dir = env['sharedir_package_version'] + '/tex'
+env.Install (dir, sources)
+env.Alias ('install', dir)