]> git.donarmstrong.com Git - lilypond.git/commitdiff
* SConstruct: Configure only pristine build tree or on user
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 13 Jul 2004 20:07:51 +0000 (20:07 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 13 Jul 2004 20:07:51 +0000 (20:07 +0000)
request.  Cleanups.

* Documentation/topdocs/SConscript: New file.

Documentation/SConscript
Documentation/topdocs/SConscript
Documentation/user/SConscript
SConstruct
buildscripts/builder.py
lily/SConscript

index 50b43fbaca8a63150c3b5c539a02f5b0fe016fcc..5813e917118c1da50f2c059e8761aa916616500e 100644 (file)
@@ -1,5 +1,5 @@
 # -*-python-*-
 
 Import ('env')
-env.AT_COPY ('index.html')
+env.AT_COPY ('index.html.in')
 
index ee3bc664bde73d2c5313356fa9b861f8820b2645..e60da4f0a4c73dedc7fb7f3173eb84764a73c32d 100644 (file)
@@ -4,7 +4,10 @@ import os
 
 Import ('env')
 telys = env['base_glob'] (env, '*.tely')
-texis = env['base_glob'] (env, '*.texi') + map (env.TELY, telys)
+texis = env['base_glob'] (env, '*.texi') + map (env.TEXI, telys)
 
 htmls = map (env.HTML, texis)
+# map (env.HTML, ['AUTHORS.html',])
+# map (env.HTML, ['AUTHORS.texi',])
 env.Alias ('doc', htmls)
+
index 2e58a0e6fe926fe7420fd6291d37bc1d88bddd76..42c48085b74f941a1bf29ef1044275fb5941389c 100644 (file)
@@ -25,7 +25,7 @@ env.Command ('lilypond-internals.texi', env['LILYPOND_BIN'],
             $lydir/generate-documentation')
 
 doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
-texis = map (env.TELY, doc_stems)
+texis = map (env.TEXI, doc_stems)
 dvis = map (env.Texi2dvi, doc_stems)
 pss = map (env.PostScript, map (lambda x: x + '.dvi', doc_stems))
 pdfs = map (env.Dvi2pdf, doc_stems)
index 94027d012006df945e1da8a77472113bb2be9229..7b627dac8b5e20fc1fa8595945c717145b7858d6 100644 (file)
@@ -59,12 +59,19 @@ import os
 import string
 import sys
 import stat
+import shutil
+
+# faster but scary: when changing #includes, do scons --implicit-deps-changed
+# SetOption ('implicit_cache', 1)
 
 # SConscripts are only needed in directories where something needs
 # to be done, building or installing
 # TODO: Documentation/*, input/*/*, vim, po
 # rename Documentation/* to ./doc?
 
+# somethin's broken wrt config.h checksums?
+FOOSUMS = 1
+
 subdirs = ['flower', 'lily', 'mf', 'scm', 'ly', 'Documentation',
           'Documentation/user', 'input', 'scripts', 'elisp',
           'buildscripts', 'cygwin', 'debian']
@@ -85,7 +92,8 @@ config_vars = (
        'CXXFLAGS',
        'DEFINES',
        'LIBS',
-       'METAFONT'
+       'METAFONT',
+       'PERL',
        'PYTHON',
        )
 
@@ -109,6 +117,8 @@ opts.AddOptions (
                    1),
        BoolOption ('verbose', 'run commands with verbose flag',
                    0),
+       BoolOption ('checksums', 'use checksums instead of timestamps',
+                   1),
        )
 
 srcdir = Dir ('.').srcnode ().abspath
@@ -117,61 +127,68 @@ srcdir = Dir ('.').srcnode ().abspath
 sys.path.append (os.path.join (srcdir, 'stepmake', 'bin'))
 import packagepython
 package = packagepython.Package (srcdir)
-
-
-prefix = '/usr/local'
-
 version = packagepython.version_tuple_to_str (package.version)
-bindir = os.path.join (prefix, 'bin')
-sharedir = os.path.join (prefix, 'share')
-libdir = os.path.join (prefix, 'lib')
-localedir = os.path.join (sharedir, 'locale')
-sharedir_package = os.path.join (sharedir, package.name)
-sharedir_package_version = os.path.join (sharedir_package, version)
-lilypondprefix = sharedir_package_version
 
 ENV = { 'PATH' : os.environ['PATH'] }
 for key in ['LD_LIBRARY_PATH', 'GUILE_LOAD_PATH', 'PKG_CONFIG_PATH']:
        if os.environ.has_key(key):
                ENV[key] = os.environ[key]
 
-
 env = Environment (
        ENV = ENV,
 
-       srcdir = srcdir,
-
-       bindir = bindir,
-       sharedir = sharedir,
-       TOPLEVEL_VERSION = version,
-       lilypond_datadir = sharedir_package,
-       local_lilypond_datadir = sharedir_package_version,
-       lilypondprefix = lilypondprefix,
-       sharedir_package = sharedir_package,
-       sharedir_package_version = sharedir_package_version,
-
-
-       SH = '/bin/sh',
        BASH = '/bin/bash',
-       PYTHON = '/usr/bin/python',
        MAKEINFO = 'LANG= makeinfo',
-       
-       LILYPOND_BOOK = srcdir + '/scripts/lilypond-book.py',
-       LILYPOND_PY = srcdir + '/scripts/lilypond.py',
+       PERL = '/usr/bin/perl',
+       PYTHON = '/usr/bin/python',
+       SH = '/bin/sh',
        
        ABC2LY_PY = srcdir + '/scripts/abc2ly.py',
-       MF_TO_TABLE_PY = srcdir + '/buildscripts/mf-to-table.py',
+       LILYPOND_BOOK = srcdir + '/scripts/lilypond-book.py',
        LILYPOND_BOOK_FLAGS = '',
        LILYPOND_BOOK_FORMAT = 'texi-html',
+       LILYPOND_PY = srcdir + '/scripts/lilypond.py',
+       MF_TO_TABLE_PY = srcdir + '/buildscripts/mf-to-table.py',
        
+       PKG_CONFIG_PATH = [os.path.join (os.environ['HOME'],
+                                        'usr/pkg/gnome/lib'),
+                          os.path.join (os.environ['HOME'],
+                                        'usr/pkg/pango/lib')],
+       MFMODE = 'ljfour',
        TEXINFO_PAPERSIZE_OPTION = '-t @afourpaper',
-       MFMODE = 'ljfour'
+       TOPLEVEL_VERSION = version,
        )
 
 Help (usage + opts.GenerateHelpText (env))
 
 map (lambda x: opts.AddOptions ((x,)), config_vars)
 opts.Update (env)
+
+if env['checksums']:
+       SetOption ('max_drift', 0)
+
+prefix = env['prefix']
+bindir = os.path.join (prefix, 'bin')
+sharedir = os.path.join (prefix, 'share')
+libdir = os.path.join (prefix, 'lib')
+localedir = os.path.join (sharedir, 'locale')
+sharedir_package = os.path.join (sharedir, package.name)
+sharedir_package_version = os.path.join (sharedir_package, version)
+lilypondprefix = sharedir_package_version
+
+# post-option environment-update
+env.Append (
+       srcdir = srcdir,
+       
+       bindir = bindir,
+       sharedir = sharedir,
+       lilypond_datadir = sharedir_package,
+       local_lilypond_datadir = sharedir_package_version,
+       lilypondprefix = lilypondprefix,
+       sharedir_package = sharedir_package,
+       sharedir_package_version = sharedir_package_version,
+       )
+
 env.CacheDir (os.path.join (env['build'], '=build-cache'))
 
 if env['debugging']:
@@ -191,12 +208,13 @@ if env['warnings']:
 if env['verbose']:
        env['__verbose'] = '--verbose'
 
-env.Append (PKG_CONFIG_PATH = [os.path.join (os.environ['HOME'],
-                                            'usr/pkg/gnome/lib'),
-                              os.path.join (os.environ['HOME'],
-                                            'usr/pkg/pango/lib')])
-
-env['srcdir'] = Dir ('.').srcnode ().abspath
+# Hmm
+#env.Append (ENV = {'PKG_CONFIG_PATH' : string.join (env['PKG_CONFIG_PATH'],
+#                                                  os.pathsep),
+#                 'LD_LIBRARY_PATH' : string.join (env['LD_LIBRARY_PATH'],
+#                                                  os.pathsep),
+#                 'GUILE_LOAD_PATH' : string.join (env['GUILE_LOAD_PATH'],
+#                                                  os.pathsep), })
 
 outdir = os.path.join (Dir (env['build']).abspath, env['out'])
 config_h = os.path.join (outdir, 'config.h')
@@ -212,9 +230,9 @@ if not COMMAND_LINE_TARGETS:
        env.Default ('lily')
 env.Alias ('all', '.')
 env.Alias ('doc',
-          'Documentation',
-          'Documentation/user',
-          'Documentation/topdocs')
+          ['Documentation',
+           'Documentation/user',
+           'Documentation/topdocs'])
 
 env.Depends ('doc', ['lily', 'mf'])
 env.Depends ('input', ['lily', 'mf'])
@@ -371,6 +389,12 @@ def configure (target, source, env):
 
        return conf.Finish ()
 
+def config_header (target, source, env):
+       config = open (str (target[0]), 'w')
+       for i in list_sort (env['DEFINES'].keys ()):
+               config.write ('#define %s %s\n' % (i, env['DEFINES'][i]))
+       config.close ()
+
 if os.path.exists (config_cache) and 'config' in COMMAND_LINE_TARGETS:
        os.unlink (config_cache)
 # WTF?
@@ -380,15 +404,52 @@ if not os.path.exists (config_cache) \
    or (os.stat ('SConstruct')[stat.ST_MTIME]
        > os.stat (config_cache)[stat.ST_MTIME]):
        env = configure (None, None, env)
+
+       # We 'should' save opts each time, but that makes config.h
+       # always out of date, and that triggers recompiles, even when
+       # using checksums?
+       if FOOSUMS: #not env['checksums']:
+
+               ## FIXME: Is this smart, using option cache for saving
+               ## config.cache?  I cannot seem to find the official method.
+               map (lambda x: opts.AddOptions ((x,)), config_vars)
+               opts.Save (config_cache, env)
+
+               env.Command (config_h, config_cache, config_header)
+
+# hmm?
+def xuniquify (lst):
+       n = []
+       for i in lst:
+               if not i in n:
+                       n.append (i)
+       lst = n
+       return lst
+
+def uniquify (lst):
+       d = {}
+       n = len (lst)
+       i = 0
+       while i < n:
+               if not d.has_key (lst[i]):
+                       d[lst[i]] = 1
+                       i += 1
+               else:
+                       del lst[i]
+                       n -= 1
+       return lst
+
+for i in config_vars:
+       if env.has_key (i) and type (env[i]) == type ([]):
+               env[i] = uniquify (env[i])
+
+if not FOOSUMS: #env['checksums']:
+       ## FIXME: Is this smart, using option cache for saving
+       ## config.cache?  I cannot seem to find the official method.
        map (lambda x: opts.AddOptions ((x,)), config_vars)
+       
        opts.Save (config_cache, env)
-
-def config_header (target, source, env):
-       config = open (str (target[0]), 'w')
-       for i in list_sort (env['DEFINES'].keys ()):
-               config.write ('#define %s %s\n' % (i, env['DEFINES'][i]))
-       config.close ()
-env.Command (config_h, config_cache, config_header)
+       env.Command (config_h, config_cache, config_header)
 
 env.Command (version_h, '#/VERSION',
             '$PYTHON ./stepmake/bin/make-version.py VERSION > $TARGET')
@@ -396,6 +457,7 @@ env.Command (version_h, '#/VERSION',
 absbuild = Dir (env['build']).abspath
 run_prefix = os.path.join (absbuild, os.path.join (env['out'], 'usr'))
 
+# post-config environment update
 env.Append (
        absbuild = absbuild,
        run_prefix = run_prefix,
@@ -445,6 +507,7 @@ def symlink_tree (target, source, env):
                        depth = len (string.split (dir, '/'))
                        frm = os.path.join ('../' * depth, src, env['out'])
                os.symlink (frm, os.path.basename (dst))
+       shutil.rmtree (run_prefix)
        prefix = os.path.join (env['out'], 'usr')
        map (lambda x: symlink (x[0], os.path.join (prefix, x[1])),
             (('python', 'lib/lilypond/python'),
@@ -464,8 +527,8 @@ def symlink_tree (target, source, env):
 
 if env['debugging']:
        stamp = os.path.join (run_prefix, 'stamp')
-       env.Depends ('.', stamp)
-       env.Command (stamp, 'VERSION', [symlink_tree, 'touch $TARGET'])
+       env.Command (stamp, 'SConstruct', [symlink_tree, 'touch $TARGET'])
+       env.Depends ('lily', stamp)
 
 #### dist, tar
 def plus (a, b):
index af47e29779cf10e1c764209331c0c4908f381bce..a9438ebcf4e87f5db0f35718cb39910a5d3216da 100644 (file)
@@ -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,7 +88,8 @@ def add_ps_target (target, source, env):
        base = os.path.splitext (str (target[0]))[0]
        return (target + [base + '.ps'], source)
 
-debug = 'echo "PATH=$$PATH";'
+#debug = 'echo "PATH=$$PATH";'
+debug = ''
 a = debug + 'LILYPONDPREFIX=$LILYPONDPREFIX \
 $PYTHON $LILYPOND_PY $__verbose \
 --include=${TARGET.dir} \
@@ -100,7 +101,7 @@ env.Append (BUILDERS = {'LilyPond': lilypond})
 #verbose = verbose_opt (env, ' --verbose')
 verbose = ''
 a = debug + 'LILYPONDPREFIX=$LILYPONDPREFIX $PYTHON $ABC2LY_PY \
---strict --output=${TARGET.base} $SOURCE'
+--strict --output=${TARGET} $SOURCE'
 ABC = Builder (action = a, suffix = '.ly', src_suffix = '.abc')
 env.Append (BUILDERS = {'ABC': ABC})
 
@@ -208,7 +209,7 @@ 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)
index ab2ea797b0b06cda7d318b879221ffcc90c038f2..0564d6c939a0d83983ae16587e4d8be43cb7b3f3 100644 (file)
@@ -8,12 +8,17 @@ outdir = Dir ('.').abspath
 e = env.Copy ()
 e.Append (YACCFLAGS = '-d')
 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')
+#e.Depends ('lexer.cc', 'parser.cc')
+#e.Depends ('my-lily-lexer.o', 'parser.cc')
+#e.Depends ('my-lily-parser.o', 'parser.cc')
 
-map (e.Precious, ['parser.cc', 'lexer.cc', 'parser.hh'])
+e.SideEffect ('parser.hh', 'parser.cc')
+e.Depends ('lexer.cc', 'parser.hh')
+e.Depends ('my-lily-lexer.o', 'parser.hh')
+e.Depends ('my-lily-parser.o', 'parser.hh')
+
+# map (e.Precious, ['parser.cc', 'lexer.cc', 'parser.hh'])
 
 e.Append (LIBS = ['flower'])
 e.ParseConfig ('guile-config link')