X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fbuilder.py;h=e9ccd4f6d33d5afcc95790d62b34f16422892ddd;hb=4982a25860ae7403a40ae916dc9212504a7e87dd;hp=71c983ed849aebb64bf68debc391f0edeaa7f0ce;hpb=0dca2577a4539483fa8077bf050853c133584035;p=lilypond.git diff --git a/buildscripts/builder.py b/buildscripts/builder.py index 71c983ed84..e9ccd4f6d3 100644 --- a/buildscripts/builder.py +++ b/buildscripts/builder.py @@ -67,15 +67,15 @@ env.Append (BUILDERS = {'HH' : HH}) env.Append ( _fixme = _fixme, - ABC2LY = 'abc2ly', - LILYPOND = 'lilypond', - LILYPOND_BIN = 'lilypond-bin', + ##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'], + 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: @@ -85,7 +85,8 @@ env.Append ( 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,)} $)', ) @@ -111,7 +112,7 @@ TEXI =\ Builder (action = '$LILYPOND_BOOK --output=${TARGET.dir} \ --include=${TARGET.dir} $LILYPOND_INCFLAGS \ - --process="$LILYPOND_BIN $LILYPOND_INCFLAGS" \ + --process="$LILYPOND $LILYPOND_INCFLAGS" \ $LILYPOND_BOOK_FLAGS \ $SOURCE', suffix = '.texi', src_suffix = '.tely') @@ -124,12 +125,12 @@ TEXIDVI =\ env.Append (BUILDERS = {'TEXIDVI': TEXIDVI}) DVIPS =\ - Builder (action = 'dvips -o $TARGET $DVIPS_FLAGS $SOURCE', + Builder (action = 'TEXINPUTS=${TARGET.dir}:$$TEXINPUTS $DVIPS -o $TARGET $DVIPS_FLAGS $SOURCE', suffix = '.ps', src_suffix = '.dvi') env.Append (BUILDERS = {'DVIPS': DVIPS}) DVIPDF =\ - Builder (action = 'dvips -o $TARGET -Ppdf $DVIPS_FLAGS $SOURCE', + Builder (action = 'TEXINPUTS=${TARGET.dir}:$$TEXINPUTS $DVIPS -o $TARGET -Ppdf $DVIPS_FLAGS $SOURCE', suffix = '.pdfps', src_suffix = '.dvi') env.Append (BUILDERS = {'DVIPDF': DVIPDF}) @@ -145,8 +146,6 @@ env.Append (BUILDERS = {'PNG2EPS': PNG2EPS}) - - # FIXME: cleanup, see above @@ -162,8 +161,6 @@ def add_ps_target (target, source, env): base = os.path.splitext (str (target[0]))[0] return (target + [base + '.ps'], source) -# TODO: -# FIXME: INCLUDES, FLAGS, use LILYPOND_BIN for building ? lilypond =\ Builder (action = '$LILYPOND --output=${TARGET.base} --include=${TARGET.dir} $SOURCE', suffix = '.pdf', src_suffix = '.ly') @@ -178,14 +175,25 @@ def add_log_target (target, source, env): base = os.path.splitext (str (target[0]))[0] return (target + [base + '.log'], source) -def add_enc_ly_tex_target (target, source, env): +def add_tfm_target (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target + [base + '.tfm'], source) + +def add_lisp_enc_tex_ly_target (target, source, env): base = os.path.splitext (str (target[0]))[0] - return (target + [base + '.enc', base + '.tex', base + 'list.ly'], + return (target + [base + '.lisp', base + '.enc', base + '.tex', + base + 'list.ly'], source) -a = 'cd ${TARGET.dir} && \ -MFINPUTS=.:${SOURCE.dir}:$srcdir/${SOURCE.dir}: \ -mf "\\mode:=$MFMODE; nonstopmode; input ${SOURCE.filebase};" \ -| grep -v "@\|>>"' + +def add_cff_cffps_svg (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target + [base + '.cff', base + '.cff.ps', base + '.svg'], + source) + +a = 'cd ${TARGET.dir} \ +&& MFINPUTS=.:${SOURCE.dir}:$srcdir/${SOURCE.dir}: \ +$MF "\\mode:=$MFMODE; nonstopmode; input ${SOURCE.filebase};" \ +| grep -v "@\|>>\|w:\|h:";' tfm = Builder (action = a, suffix = '.tfm', src_suffix = '.mf', # emitter = lambda t, s, e: add_suffixes (t, s, e, ['.log'], [])) emitter = add_log_target) @@ -193,25 +201,26 @@ env.Append (BUILDERS = {'TFM': tfm}) a = '$PYTHON $MF_TO_TABLE_PY \ --outdir=${TARGET.dir} \ ---afm=${TARGET.base}.afm \ +--global-lisp=${TARGET.base}.otf-gtable \ +--lisp=${TARGET.base}.lisp \ --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}) +gtable = Builder (action = a, suffix = '.otf-gtable', src_suffix = '.log', + emitter = add_lisp_enc_tex_ly_target) +env.Append (BUILDERS = {'GTABLE': gtable}) def add_enc_src (target, source, env): base = os.path.splitext (str (target[0]))[0] return (target, source + [base + '.enc']) -# UGH, should fix --output option for mftrace -# mftrace --verbose is too verbose +# FIXME UGH, should fix --output option for mftrace a = 'cd ${TARGET.dir} && \ if test -e ${SOURCE.filebase}.enc; then encoding="--encoding=${SOURCE.filebase}.enc"; fi; \ MFINPUTS=$srcdir/mf:.: \ -mftrace --formats=pfa --simplify --keep-trying $$encoding $TOO__verbose \ +$MFTRACE --formats=pfa --simplify --keep-trying --no-afm \ +$$encoding $__verbose \ --include=${TARGET.dir} \ ${SOURCE.file}' @@ -221,10 +230,21 @@ pfa = Builder (action = a, emitter = add_enc_src) env.Append (BUILDERS = {'PFA': pfa}) +a = ['(cd ${TARGET.dir} && $FONTFORGE -script ${SOURCE.file})', +# '$PYTHON $srcdir/buildscripts/ps-embed-cff.py ${SOURCE.base}.cff $$(cat ${SOURCE.base}.fontname) ${SOURCE.base}.cff.ps', + 'rm -f ${TARGET.dir}/*.scale.pfa'] +otf = Builder (action = a, + suffix = '.otf', + src_suffix = '.pe', +# emitter = add_cff_cffps_svg + ) +env.Append (BUILDERS = {'OTF': otf}) + + # Specific builders env['DIFF_PY'] = '$srcdir/stepmake/bin/package-diff.py' -a = '$PYTHON $DIFF_PY $__verbose --outdir=${TARGET.dir}' +a = '$PYTHON $DIFF_PY $NO__verbose --outdir=${TARGET.dir}' patch = Builder (action = a, suffix = '.diff', src_suffix = '.tar.gz') env.Append (BUILDERS = {'PATCH': patch}) @@ -256,7 +276,8 @@ atvars = [ # naming def at_copy (target, source, env): - s = open (str (source[0])).read () + n = str (source[0]) + s = open (n).read () for i in atvars: if env.has_key (i): s = string.replace (s, '@%s@'% i, env[i]) @@ -269,6 +290,22 @@ def at_copy (target, source, env): AT_COPY = Builder (action = at_copy, src_suffix = ['.in', '.py', '.sh',]) env.Append (BUILDERS = {'AT_COPY': AT_COPY}) +# naming +def at_copy_ext (target, source, env): + n = str (source[0]) + s = open (n).read () + for i in atvars: + if env.has_key (i): + s = string.replace (s, '@%s@'% i, env[i]) + # whugh + e = os.path.splitext (n)[1] + t = str (target[0]) + e + open (t, 'w').write (s) + +AT_COPY_EXT = Builder (action = at_copy_ext, src_suffix = ['.py', '.sh',]) +env.Append (BUILDERS = {'AT_COPY_EXT': AT_COPY_EXT}) + + MO = Builder (action = 'msgfmt -o $TARGET $SOURCE', suffix = '.mo', src_suffix = '.po') env.Append (BUILDERS = {'MO': MO}) @@ -310,11 +347,11 @@ def mutopia (ly = None, abc = None): # 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}' + #BUILD_ABC2LY = '${set__x}$PYTHON $srcdir/scripts/abc2ly.py' + #BUILD_LILYPOND = '$absbuild/$out/lilypond ${__verbose}' e = env.Copy ( - LILYPOND = BUILD_LILYPOND, - ABC2LY = BUILD_ABC2LY, + #LILYPOND = BUILD_LILYPOND, + #ABC2LY = BUILD_ABC2LY, ) if not abc: @@ -335,10 +372,10 @@ def collate (title = 'collated files'): 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', - ) - # + LILYPOND_BOOK_FLAGS = '''--process="lilypond --backend=eps --formats=ps,png --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.