]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/builder.py
* SConstruct: Further development.
[lilypond.git] / buildscripts / builder.py
index af47e29779cf10e1c764209331c0c4908f381bce..876eb580d414d6cffeabc6aa95e955de3b96f3d9 100644 (file)
@@ -27,7 +27,7 @@ INFO = Builder (action = a, suffix = '.info', src_suffix = '.texi')
 env.Append (BUILDERS = {'INFO': INFO})
 
 a = '$MAKEINFO $__verbose $MAKEINFO_INCLUDES  --html --no-split --no-headers \
---css-include=#/Documentation/texinfo.css --output=$TARGET $SOURCE'
+--css-include=$srcdir/Documentation/texinfo.css --output=$TARGET $SOURCE'
 HTML = Builder (action = a, suffix = '.html', src_suffix = '.texi')
 env.Append (BUILDERS = {'HTML': HTML})
 
@@ -41,7 +41,7 @@ env.PrependENVPath ('PATH',
 
 if os.environ.has_key ('TEXMF'):
        env.Append (ENV = {'TEXMF' : os.environ['TEXMF']})
-env.Append (ENV = {'TEXMF' : '{' + env['LILYPONDPREFIX'] + ',' \
+env.Append (ENV = {'TEXMF' : '{$LILYPONDPREFIX,' \
                   + os.popen ('kpsexpand \$TEXMF').read ()[:-1] + '}' })
 
 if os.environ.has_key ('LD_LIBRARY_PATH'):
@@ -56,7 +56,7 @@ env.Append (PYTHONPATH = [os.path.join (env['absbuild'], env['out'],
 env.Append (ENV = { 'PYTHONPATH' : string.join (env['PYTHONPATH'],
                                                os.pathsep) } )
 
-a = ['rm -f $$(grep -LF "\lilypondend" ${TARGET.dir}/lily-*.tex 2>/dev/null);',
+a = ['${__set_x}rm -f $$(grep -LF "\lilypondend" ${TARGET.dir}/lily-*.tex 2>/dev/null);',
      'LILYPONDPREFIX=$LILYPONDPREFIX \
      $PYTHON $LILYPOND_BOOK $__verbose \
      --include=${TARGET.dir} $LILYPOND_BOOK_INCLUDES \
@@ -64,8 +64,8 @@ a = ['rm -f $$(grep -LF "\lilypondend" ${TARGET.dir}/lily-*.tex 2>/dev/null);',
      --output=${TARGET.dir} --format=$LILYPOND_BOOK_FORMAT \
      $LILYPOND_BOOK_FLAGS \
      $SOURCE']
-TELY = Builder (action = a, suffix = '.texi', src_suffix = '.tely')
-env.Append (BUILDERS = {'TELY': TELY})
+TEXI = Builder (action = a, suffix = '.texi', src_suffix = '.tely')
+env.Append (BUILDERS = {'TEXI': TEXI})
 
 a = 'cd ${TARGET.dir} \
 && texi2dvi --batch $TEXINFO_PAPERSIZE_OPTION ${SOURCE.file}'
@@ -88,19 +88,16 @@ def add_ps_target (target, source, env):
        base = os.path.splitext (str (target[0]))[0]
        return (target + [base + '.ps'], source)
 
-debug = 'echo "PATH=$$PATH";'
-a = debug + 'LILYPONDPREFIX=$LILYPONDPREFIX \
-$PYTHON $LILYPOND_PY $__verbose \
+a = '${set__x}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 = debug + 'LILYPONDPREFIX=$LILYPONDPREFIX $PYTHON $ABC2LY_PY \
---strict --output=${TARGET.base} $SOURCE'
+a = '${set__x}LILYPONDPREFIX=$LILYPONDPREFIX $PYTHON $ABC2LY_PY \
+--strict --output=${TARGET} $SOURCE'
 ABC = Builder (action = a, suffix = '.ly', src_suffix = '.abc')
 env.Append (BUILDERS = {'ABC': ABC})
 
@@ -171,7 +168,7 @@ env['src_glob'] = src_glob
 
 def base_glob (env, s):
        return map (lambda x: os.path.splitext (x)[0], src_glob (env, s))
-env['base_glob'] = src_glob
+env['glob'] = base_glob
 
 atvars = [
 'BASH',
@@ -208,9 +205,38 @@ def at_copy (target, source, env):
     t = str (target[0])
     open (t, 'w').write (s)
     # wugh
-    if os.basename (os.dirname (str (target[0]))) == 'bin':
+    if os.path.basename (os.path.dirname (str (target[0]))) == 'bin':
            os.chmod (t, 0755)
 
-AT_COPY = Builder (action = at_copy)
+AT_COPY = Builder (action = at_copy, src_suffix = ['.in', '.py', '.sh',])
 env.Append (BUILDERS = {'AT_COPY': AT_COPY})
 
+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.Append (BUILDERS = {'PO': PO})
+##env.Command(env['absbuild'] + '/po/' + env['out'] + '/lilypond.pot',
+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})
+
+a = '$PYTHON $srcdir/buildscripts/bib2html.py -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})