+MO = Builder (action = 'msgfmt -o $TARGET $SOURCE',
+ suffix = '.mo', src_suffix = '.po')
+env.Append (BUILDERS = {'MO': MO})
+
+# ' '; ?
+ugh = 'ln -f po/lilypond.pot ${TARGET.dir}/lilypond.po ; '
+a = ugh + 'xgettext --default-domain=lilypond --join \
+--output-dir=${TARGET.dir} --add-comments \
+--keyword=_ --keyword=_f --keyword=_i $SOURCES'
+PO = Builder (action = a, suffix = '.pot',
+ src_suffix = ['.cc', '.hh', '.py'], multi = 1)
+env['potarget'] = os.path.join (env['absbuild'], 'po', env['out'],
+ 'lilypond.pot')
+env['pocommand'] = a
+
+ugh = '; mv ${TARGET} ${SOURCE}'
+a = 'msgmerge ${SOURCE} ${SOURCE.dir}/lilypond.pot -o ${TARGET}' + ugh
+POMERGE = Builder (action = a, suffix = '.pom', src_suffix = '.po')
+env.Append (BUILDERS = {'POMERGE': POMERGE})
+
+#UGRr
+a = 'BSTINPUTS=$BSTINPUTS $BIB2HTML -o $TARGET $SOURCE'
+BIB2HTML = Builder (action = a, suffix = '.html', src_suffix = '.bib')
+env.Append (BUILDERS = {'BIB2HTML': BIB2HTML})
+
+a = '$PYTHON $srcdir/buildscripts/lys-to-tely.py \
+--name=${TARGET.base} --title="$TITLE" $SOURCES'
+LYS2TELY = Builder (action = a, suffix = '.tely', src_suffix = '.ly')
+env.Append (BUILDERS = {'LYS2TELY': LYS2TELY})
+
+
+def mutopia (ly = None, abc = None):
+
+ # FIXME: ugr, huh? The values from ../SConstruct get appended
+ # to the predefined values from this builder context:
+
+ # abc2ly/usr/bin/python ..../abc2.py
+
+ # Override them again to fix web build...
+
+
+ BUILD_ABC2LY = '${set__x}$PYTHON $srcdir/scripts/abc2ly.py'
+ BUILD_LILYPOND = '${set__x}$PYTHON $srcdir/scripts/lilypond.py${__verbose}'
+ e = env.Copy (
+ LILYPOND = BUILD_LILYPOND,
+ ABC2LY = BUILD_ABC2LY,
+ )
+
+ if not abc:
+ abc = base_glob ('*.abc')
+ if not ly:
+ ly = base_glob ('*.ly') + map (e.ABC, abc)
+ pdf = map (e.LilyPond, ly)
+
+ # We need lily and mf to build these.
+ env.Depends (pdf, ['#/lily', '#/mf'])
+ env.Alias ('doc', pdf)
+
+Export ('mutopia')
+
+
+def collate (title = 'collated files'):
+ ly = base_glob ('*.ly')
+
+ e = env.Copy (
+ TITLE = title,
+ LILYPOND_BOOK_FLAGS = '''--process="lilypond-bin --header=texidoc -I$srcdir/input/test -e '(ly:set-option (quote internal-type-checking) #t)'"''',
+ __verbose = ' --verbose',
+ )
+ #
+ tely = e.LYS2TELY ('collated-files', ly)
+ texi = e.TEXI (tely)
+ # We need lily and mf to build these.
+ env.Depends (texi, ['#/lily', '#/mf'])
+ dvi = e.TEXIDVI (texi)
+ pspdf = e.DVIPDF (dvi)
+ pdf = e.PSPDF (pspdf)
+ html = e.HTML (texi)
+
+ env.Alias ('doc', pdf)
+ env.Alias ('doc', html)
+
+Export ('collate')
+
+Export ('env')