]> git.donarmstrong.com Git - lilypond.git/commitdiff
New file.
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 7 Jul 2004 15:28:05 +0000 (15:28 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 7 Jul 2004 15:28:05 +0000 (15:28 +0000)
SConstruct
flower/SConscript
lily/SConscript
lily/main.cc
mf/SConscript [new file with mode: 0644]

index 5a043517726fa15e5bbb22070c2e9e2fa5bfdf88..6fa67078d76ddab24df74f8de5bd8361a1548357 100644 (file)
@@ -1,13 +1,33 @@
 # -*-python-*-
-#
-# Experimental scons building
+
+'''
+Experimental scons (www.scons.org) building:
+
+Usage:
+    scons
+    scons install
+    scons -c              # clean
+    scons -h              # help
+
+    scons build=DIR       # scrdir build, write to new tree =build
+    scons out=DIR         # write output to deeper dir DIR
+
+Optionally, make a custom.py.  I have
+
+import os
+out='out-scons'
+optimising=0
+debugging=1
+prefix=os.getcwd ()
+
+
+'''
+
+
 # TODO:
-#   * install
-#   * build in out/ ?
-#   * mf, Documentation, ly etc.
-#   * --srcdir ?  (mkdir =build; cd =build; scons -Y .. ;
-#     ===> os.chdir (Dir ('.').srcdir ()); glob.glob (*.cc); os.chdir (cwd) ?
-# 
+#   * mf: pfa
+#   *, Documentation, ly etc.
+
 
 import re
 import glob
@@ -17,9 +37,11 @@ import string
 
 env = Environment ()
 
-opts = Options (None, ARGUMENTS)
+# put your favourite stuff in custom.py
+opts = Options ('custom.py', ARGUMENTS)
 opts.Add ('prefix', 'Install prefix', '/usr/')
-opts.Add ('outdir', 'Output directory', 'out')
+opts.Add ('out', 'Output directory', 'out-scons')
+opts.Add ('build', 'Build directory', '.')
 opts.AddOptions (
        BoolOption ('warnings', 'compile with -Wall and similiar',
                   1),
@@ -37,6 +59,20 @@ Help (opts.GenerateHelpText (env))
 
 env = Environment (options = opts)
 
+env.CacheDir (os.path.join (env['build'], '=build-cache'))
+
+#ugh
+sys.path.append (os.path.join ('.', 'stepmake', 'bin'))
+import packagepython
+package = packagepython.Package ('.')
+
+env['version'] = packagepython.version_tuple_to_str (package.version)
+env['bindir'] = os.path.join (env['prefix'], 'bin')
+env['sharedir'] = os.path.join (env['prefix'], 'share')
+env['libdir'] = os.path.join (env['prefix'], 'lib')
+env['lilypondprefix'] = os.path.join (env['sharedir'], 'lilypond',
+                                     env['version'])
+
 if env['debugging']:
        env.Append (CFLAGS = '-g')
        env.Append (CXXFLAGS = '-g')
@@ -47,6 +83,8 @@ if env['warnings']:
        env.Append (CFLAGS = '-W -Wall')
        env.Append (CXXFLAGS = '-W -Wall -Wconversion')
 
+env['MFMODE'] = 'ljfour'
+
 conf = Configure (env)
 
 #ugh -- hardcode territory
@@ -88,43 +126,49 @@ if conf.CheckLib ('dl'):
 if conf.CheckLib ('kpathsea'):
        defines['KPATHSEA'] = '1'
 
-# ugh?
-config = open ('config.h', 'w')
-sort_helper = defines.keys ()
-sort_helper.sort ()
-#for i in defines.keys ():
-for i in sort_helper:
-       config.write ('#define %s %s\n' % (i[1:], defines[i]))
-config.close ()
 env = conf.Finish ()
 
-os.system (sys.executable \
-          + ' ./stepmake/bin/make-version.py VERSION > version.hh')
-
 Export ('env')
 
 #this could happen after flower...
 env.ParseConfig ('guile-config compile')
 
-builddir = ''
-outdir = env['outdir']
+build = env['build']
+out = env['out']
+##reldir = str (Dir ('.').srcnode ())
+reldir = os.getcwd ()
+outdir = os.path.join (env['build'], reldir, env['out'])
+if not os.path.exists (outdir):
+       os.mkdir (outdir)
+
+config = open (os.path.join (outdir, 'config.h'), 'w')
+sort_helper = defines.keys ()
+sort_helper.sort ()
+for i in sort_helper:
+       config.write ('#define %s %s\n' % (i[1:], defines[i]))
+config.close ()
+
+os.system (sys.executable \
+          + ' ./stepmake/bin/make-version.py VERSION > '\
+          + os.path.join (build, 'version.hh'))
 
 if os.path.exists ('parser'):
        env.Append (LIBPATH = ['#/flower', '#/lily', '#/parser', '#/gui',],
-                   CPPPATH = ['#',])
+                   CPPPATH = [outdir, '#',])
 else:  
-       env.Append (LIBPATH = ['#/flower/' + outdir,],
-                   CPPPATH = ['#',])
-
-
-#ugh: remove make config output
-if os.path.exists ('lily/out/config.h'):
-       os.unlink ('lily/out/config.h')
+       env.Append (LIBPATH = ['#/flower/' + out,],
+                   CPPPATH = [outdir, '#',])
 
-subdirs = ('flower', 'lily',)
+subdirs = ('flower', 'lily', 'mf')
+#subdirs = ('mf',)
 #subdirs = ('flower', 'lily', 'parser', 'gui', 'main',)
 for d in subdirs:
-       alias = os.path.join (builddir, d, outdir)
-       env.BuildDir (alias, d)
-       SConscript (os.path.join (alias, 'SConscript'))
+       b = os.path.join (build, d, out)
+       # Support clean sourctree build (srcdir build)
+       # and outdir build.
+       # TODO: figure out SConscript (dir, builddir, duplicate)) feature
+       if (build and build != '.') \
+          or (out and out != '.'):
+               env.BuildDir (b, d, duplicate=0)
+       SConscript (os.path.join (b, 'SConscript'))
 
index c9443d3529cee5d2b0acd32fb0f303c8d6ecf06e..1477b80cc371fb346343c19d7fbd6afd546ed1e3 100644 (file)
@@ -3,16 +3,17 @@
 import glob
 import os
 
-## this only works for BuildDir aliasing, not for scons -Y ../scrdir
 here = os.getcwd ()
-os.chdir (str (Dir ('.').srcnode ()))
+reldir = str (Dir ('.').srcnode ())
+os.chdir (reldir)
 sources = glob.glob ('*.cc')
 os.chdir (here)
 
 name = 'flower'
 Import ('env')
 e = env.Copy ()
-e.Append (CPPPATH = ['include'])
+outdir = os.path.join (env['build'], reldir, env['out'])
+e.Append (CPPPATH = [outdir, 'include'])
 if env['static']:
        e.Library (name, sources) 
 if not env['static'] or env['shared']:
index 2a0bb0d07f60f3bc27049011cb38dec0b78088fb..e67d938c550ede35df16b52bf5bb0f70bcdbe4f6 100644 (file)
@@ -3,9 +3,9 @@
 import glob
 import os
 
-## this only works for BuildDir aliasing, not for scons -Y ../scrdir
 here = os.getcwd ()
-os.chdir (str (Dir ('.').srcnode ()))
+reldir = str (Dir ('.').srcnode ())
+os.chdir (reldir)
 sources = glob.glob ('*.cc') + ['parser.yy', 'lexer.ll']
 os.chdir (here)
 
@@ -15,8 +15,11 @@ Import ('env')
 e = env.Copy ()
 
 e.Append (YACCFLAGS = '-d')
-e.Append (CPPPATH = ['include', '#/lily/include', '#/flower/include'])
+outdir = os.path.join (env['build'], reldir, env['out'])
+e.Append (CPPPATH = [outdir, '#/lily/include', '#/flower/include'])
 e.Depends ('lexer.cc', 'parser.cc')
+e.Depends ('my-lily-lexer.o', 'parser.cc')
+e.Depends ('my-lily-parser.o', 'parser.cc')
 
 # some stuff here from lily-as-lib
 if not os.path.exists ('main.cc'):
@@ -29,4 +32,6 @@ else:
        e.Append (LIBS = ['flower'])
        e.ParseConfig ('guile-config link')
        name = 'lilypond-bin'
-       e.Program (name, sources)
+       lily = e.Program (name, sources)
+       env.Install (env['bindir'], lily)
+       env.Alias ('install', env['bindir'])
index 4fc6dfb1f1300e583cb9dacd0d35db59e6eb6919..a7fd52973573c77b147ac44d61c535bbc4a05037 100644 (file)
@@ -226,7 +226,7 @@ setup_paths ()
 #if !KPATHSEA
        /* Urg: GNU make's $ (word) index starts at 1 */
        int i  = 1;
-       while (global_path.try_add (p + to_string (".") + to_string (i)))
+       while (global_path.try_append (p + to_string (".") + to_string (i)))
          i++;
 #endif
       }
diff --git a/mf/SConscript b/mf/SConscript
new file mode 100644 (file)
index 0000000..824022a
--- /dev/null
@@ -0,0 +1,95 @@
+# -*-python-*-
+
+import glob
+import os
+import string
+import sys
+
+here = os.getcwd ()
+reldir = str (Dir ('.').srcnode ())
+os.chdir (reldir)
+#mf_sources = reduce (+,
+mf_sources = reduce (lambda x, y: x + y,
+                    map (glob.glob,
+                         ('feta[0-9]*.mf',
+                          'feta-braces-[a-z].mf',
+                          'feta-din*[0-9].mf',
+                          'feta-nummer*[0-9].mf',
+                          'parmesan[0-9]*.mf',)))
+os.chdir (here)
+
+Import ('env')
+MFMODE = env['MFMODE']
+#ugh
+outdir = os.path.join (env['build'], reldir, env['out'])
+tfm = Builder (action = ('cd ' + outdir + ' && ' \
+                        + '(MFINPUTS=:' + str (Dir ('#/mf')) \
+                        + ' mf "\\mode:=%(MFMODE)s; nonstopmode; ' \
+                        + ' input $$(basename $SOURCE);"' \
+                        + ' | grep -v "@\\|>>")') % vars (),
+              suffix = '.tfm',
+              src_suffix = '.mf')
+
+afm = Builder (action = (sys.executable
+                        + ' buildscripts/mf-to-table.py ' \
+                        + ' --package=. --outdir=%(outdir)s '\
+                        + ' --afm %(outdir)s/$$(basename $TARGET .afm).afm' \
+                        + ' --enc %(outdir)s/$$(basename $TARGET .afm).enc' \
+                        + ' --tex %(outdir)s/$$(basename $TARGET .afm).tex' \
+                        + ' --ly %(outdir)s/$$(basename $TARGET .afm).ly'\
+                        + ' %(outdir)s/$$(basename $SOURCE)') % vars (),
+              suffix = '.afm',
+              src_suffix = '.log')
+
+# UGH, should fix --output option for mftrace
+pfa = Builder (action = ('mftrace -I%(outdir)s --pfa --simplify --keep-trying'\
+                        + ' $$(basename $SOURCE .mf) ' \
+                        + ' && mv $$(basename $TARGET) $TARGET') % vars (),
+              suffix = '.pfa',
+              src_suffix = '.mf')
+
+e = env.Copy (BUILDERS = {'Tfm' : tfm, 'Afm' : afm, 'Pfa' : pfa},
+             MFINPUTS = '#/mf')
+
+mf_sources = ('feta16.mf',)
+sources = map (lambda x: os.path.splitext (x)[0], mf_sources)
+
+##t = map (e.Tfm, mf_sources)
+#a = map (e.Afm, map (lambda x: outdir + os.path.splitext (x)[0] + '.log',
+#                   mf_sources))
+#p = map (e.Pfa, mf_sources)
+
+out_sources = map (lambda x: os.path.join (outdir, x), sources)
+
+#t = e.Tfm (os.path.join (outdir, 'feta16.tfm'))
+#a = e.Afm (os.path.join (outdir, 'feta16.afm'))
+#p = e.Pfa (os.path.join (outdir, 'feta16.pfa'))
+#t = e.Tfm ('feta16.tfm'))
+#a = e.Afm ('feta16.afm'))
+#p = e.Pfa ('feta16.pfa'))
+
+t = e.Tfm (os.path.join (outdir, 'feta16'))
+a = e.Afm (os.path.join (outdir, 'feta16'))
+p = e.Pfa (os.path.join (outdir, 'feta16'))
+
+#t = map (e.Tfm, out_sources)
+#a = map (e.Afm, out_sources)
+#p = map (e.Pfa, out_sources)
+
+e.Depends ('feta16.log', 'feta16.tfm')
+e.Depends ('feta16.afm', 'feta16.log')
+
+#map (lambda x: e.Depends (x + '.log', x + '.tfm'), out_sources)
+#map (lambda x: e.Depends (x + '.afm', x + '.log'), out_sources)
+
+tfmdir = os.path.join (env['lilypondprefix'], 'fonts/tfm')
+afmdir = os.path.join (env['lilypondprefix'], 'afm')
+pfadir = os.path.join (env['lilypondprefix'], 'fonts/type1')
+env.Install (tfmdir, t)
+env.Install (afmdir, a)
+env.Install (pfadir, p)
+env.Alias ('install', tfmdir)
+env.Alias ('install', afmdir)
+env.Alias ('install', pfadir)
+
+