+
+def src_glob (s):
+ here = os.getcwd ()
+ os.chdir (env.Dir ('.').srcnode ().abspath)
+ result = glob.glob (s)
+ os.chdir (here)
+ return result
+
+Export ('src_glob')
+
+def base_glob (s):
+ return map (lambda x: os.path.splitext (x)[0], src_glob (s))
+
+Export ('base_glob')
+
+def install (target, dir):
+ dest = env['DESTDIR'] + dir
+ if type (target) == type ([]):
+ map (lambda x: env.Install (dir, x), target)
+ else:
+ env.Install (dir, target)
+ env.Alias ('install', dir)
+
+Export ('install')
+
+def _fixme (s):
+ x = string.replace (s, '#', env['srcdir'])
+ x = string.replace (x, '@', env['absbuild'])
+ return x
+
+# Clean separation between generic action + flags and actual
+# configuration and flags in environment for this build.
+
+# Generic builders could/should be part of SCons.
+
+
+HH = Builder (action = 'bison -d -o ${TARGET.base}.cc $SOURCE',
+ suffix = '.hh', src_suffix = '.yy')
+env.Append (BUILDERS = {'HH' : HH})
+
+
+# Setup LilyPond environment. For the LilyPond build, we override
+# some of these commands in the ENVironment.
+
+env.Append (
+ _fixme = _fixme,
+ ##ABC2LY = 'abc2ly',
+ ##LILYPOND = 'lilypond',
+ LILYOND_BOOK = 'lilypond-book',
+
+ #ugr
+ #LILYPOND_BOOK_FORMAT = 'texi',
+ LILYPOND_BOOK_FORMAT = '',
+ #LILYPOND_BOOK_FLAGS = ['--format=$LILYPOND_BOOK_FORMAT'],
+ LILYPOND_BOOK_FLAGS = '''--format=$LILYPOND_BOOK_FORMAT --process="lilypond --backend=eps --formats=ps,png --header=texidoc -I$srcdir/input/test -e '(ly:set-option (quote internal-type-checking) #t)'" ''',
+
+ LILYPOND_PATH = [],
+ # The SCons way around FOO_PATH:
+ ##LILYPOND_INCFLAGS = '$( ${_concat(INCPREFIX, LILYPOND_PATH, INCSUFFIX, __env__, RDirs)} $)',
+ LILYPOND_INCFLAGS = '$( ${_concat(INCPREFIX, LILYPOND_PATH, INCSUFFIX, __env__)} $)',
+
+ MAKEINFO_PATH = [],
+ MAKEINFO_FLAGS = [],
+ MAKEINFO_INCFLAGS = '$( ${_concat(INCPREFIX, MAKEINFO_PATH, INCSUFFIX, __env__, RDirs)} $)',
+ # should not be necessary
+ # PYTHONPATH = ['$absbuild/python/$out'],
+ TEXI2DVI_FLAGS = [],
+ _TEXI2DVI_FLAGS = '$( ${_concat(" ", TEXI2DVI_FLAGS,)} $)',
+ )
+
+TXT =\
+ Builder (action = '$MAKEINFO --output=$TARGET $MAKEINFO_INCFLAGS\
+ --no-split --no-headers $SOURCE',
+ suffix = '.txt', src_suffix = '.texi')