]> git.donarmstrong.com Git - lilypond.git/blobdiff - SConstruct
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / SConstruct
index aeba869546cceedd30f62a5e26d84acb63442e71..3f6f15007bba70081929d93b91e50c9d63a9d16e 100644 (file)
@@ -248,6 +248,8 @@ prefix = env['prefix']
 bindir = os.path.join (prefix, 'bin')
 sharedir = os.path.join (prefix, 'share')
 libdir = os.path.join (prefix, 'lib')
+libdir_package = os.path.join (libdir, package.name)
+libdir_package_version = os.path.join (libdir_package, version)
 localedir = os.path.join (sharedir, 'locale')
 sharedir_doc_package = os.path.join (sharedir, 'doc', package.name)
 sharedir_package = os.path.join (sharedir, package.name)
@@ -318,14 +320,14 @@ def configure (target, source, env):
                print f
                return test_version (lst, program, minimal, description, package)
 
-       def test_lib (lst, program, minimal, description):
+       def test_lib (lst, program, minimal, description, package):
                # FIXME: test for Debian or RPM (or -foo?) based dists
                # to guess (or get correct!: apt-cache search?)
                # package name.
                #if os.system ('pkg-config --atleast-version=0 freetype2'):
                # barf
                if test_version (lst, program, minimal, description,
-                                'lib%(program)s-dev or %(program)s-devel'
+                                'lib%(package)s-dev or %(package)s-devel'
                                 % vars ()):
                        env.ParseConfig ('pkg-config --cflags --libs %(program)s'
                                         % vars ())
@@ -339,9 +341,11 @@ def configure (target, source, env):
        test_program (required, 'guile-config', '1.6', 'GUILE development',
                        'libguile-dev or guile-devel')
        test_program (required, 'mf', '0.0', 'Metafont', 'tetex-bin')
-       test_program (required, 'mftrace', '1.1.6', 'mftrace (http://xs4all.nl/~hanwen/mftrace)', 'mftrace')
+       test_program (required, 'mftrace', '1.1.9',
+                     'mftrace (http://xs4all.nl/~hanwen/mftrace)', 'mftrace')
        test_program (required, 'potrace', '0.0', 'Potrace', 'potrace')
-       test_program (required, 'python', '2.1', 'Python (www.python.org)', 'python')
+       test_program (required, 'python', '2.1', 'Python (www.python.org)',
+                     'python')
        test_program (required, 'sh', '0.0', 'Bourne shell', 'sh')
 
        optional = []
@@ -350,10 +354,14 @@ def configure (target, source, env):
        test_program (optional, 'bison', '1.25', 'Bison -- parser generator',
                        'bison')
        test_program (optional, 'dvips', '0.0', 'Dvips', 'tetex-bin')
-       test_program (optional, 'fontforge', '0.0.20041224', 'FontForge', 'fontforge')
-       test_program (optional, 'flex', '0.0', 'Flex -- lexer generator', 'flex')
+#      test_program (optional, 'fontforge', '0.0.20041224', 'FontForge',
+#                    'fontforge')
+       test_program (optional, 'flex', '0.0', 'Flex -- lexer generator',
+                     'flex')
        test_program (optional, 'guile', '1.6', 'GUILE scheme', 'guile')
-       test_program (optional, 'gs', '8.14', 'Ghostscript PostScript interpreter', 'gs or gs-afpl or gs-esp or gs-gpl')
+       test_program (optional, 'gs', '8.14',
+                     'Ghostscript PostScript interpreter',
+                     'gs or gs-afpl or gs-esp or gs-gpl')
        test_program (optional, 'mftrace', '1.1.0', 'Metafont tracing Type1',
                        'mftrace')
        test_program (optional, 'makeinfo', '4.7', 'Makeinfo tool', 'texinfo')
@@ -363,7 +371,7 @@ def configure (target, source, env):
 
        def CheckYYCurrentBuffer (context):
                context.Message ('Checking for yy_current_buffer... ')
-               ret = conf.TryLink ("""using namespace std;
+               ret = conf.TryCompile ("""using namespace std;
                #include <FlexLexer.h>
                class yy_flex_lexer: public yyFlexLexer
                {
@@ -483,24 +491,26 @@ def configure (target, source, env):
        test_program (required, 'pkg-config', '0.9.0',
                      'pkg-config library compile manager', 'pkg-config')
        if test_lib (required, 'freetype2', '0.0',
-                    'Development files for FreeType 2 font engine'):
+                    'Development files for FreeType 2 font engine',
+                    'freetype6'):
                conf.env['DEFINES']['HAVE_FREETYPE2'] = '1'
                
        if test_lib (required, 'pangoft2', '1.6.0',
-                    'Development files for pango, with fontconfig2'):
+                    'Development files for pango, with FreeType2',
+                    'pango1.0'):
                conf.env['DEFINES']['HAVE_PANGO_FT2'] = '1'
                conf.env['DEFINES']['HAVE_PANGO16'] = '1'
 
        if test_lib (optional, 'fontconfig', '2.2.0',
-                    'Development files for fontconfig'):
+                    'Development files for fontconfig', 'fontconfig1'):
                conf.env['DEFINES']['HAVE_FONTCONFIG'] = '1'
        
        #this could happen only for compiling pango-*
        if env['gui']:
                test_lib (required, 'gtk+-2.0', '2.4.0',
-                         'Development files for GTK+')
+                         'Development files for GTK+', 'gtk2.0')
                if test_lib (required, 'pango', '1.6.0',
-                         'Development files for pango'):
+                         'Development files for pango', 'pango1.0'):
                        conf.env['DEFINES']['HAVE_PANGO16'] = '1'
                        
                if conf.CheckCHeader ('pango/pangofc-fontmap.h'):
@@ -579,11 +589,16 @@ def save_config_cache (env):
                sys.stdout.write ('\n')
                sys.stdout.write ('\n')
                sys.stdout.write ('Examples:')
+               sys.stdout.write ('\n')
                sys.stdout.write ('    scons lily    # build lilypond')
+               sys.stdout.write ('\n')
                sys.stdout.write ('    scons all     # build everything')
+               sys.stdout.write ('\n')
                sys.stdout.write ('    scons doc     # build documentation')
+               sys.stdout.write ('\n')
                ## TODO
                ## sys.stdout.write ('    scons prefix=/usr DESTDIR=/tmp/pkg all install')
+               ## sys.stdout.write ('\n')
                Exit (0)
        elif not env['checksums']:
                # When using timestams, config.hh is NEW.  The next
@@ -643,6 +658,8 @@ env.Append (
        sharedir_package = sharedir_package,
        sharedir_doc_package = sharedir_doc_package,
        sharedir_package_version = sharedir_package_version,
+       libdir_package = libdir_package,
+       libdir_package_version = libdir_package_version,
 
        # global build verbosity switch
        __verbose = ' --verbose',
@@ -652,7 +669,6 @@ env.Append (
        LILYPOND_BOOK = BUILD_LILYPOND_BOOK,
        LILYPOND_BOOK_FORMAT = 'texi-html',
        MAKEINFO_FLAGS = '--css-include=$srcdir/Documentation/texinfo.css',
-       # should not be necessary
        # PYTHONPATH = ['$absbuild/python/$out'],
        TEXI2DVI_PAPERSIZE = '@afourpaper',
        TEXI2DVI_FLAGS = [ '-t$TEXI2DVI_PAPERSIZE'],
@@ -663,8 +679,9 @@ env.Append (
        PSPDF_FLAGS = ['-sPAPERSIZE=$DVIPS_PAPERSIZE'],
        )
 
+env.Append (CCFLAGS = ['-pipe', '-Wno-pmf-conversions'])
 if env['debugging']:
-       env.Append (CCFLAGS = ['-g', '-pipe'])
+       env.Append (CCFLAGS = ['-g'])
 if env['optimising']:
        env.Append (CCFLAGS = '-O2')
        env.Append (CXXFLAGS = ['-DSTRING_UTILS_INLINED'])
@@ -674,6 +691,8 @@ if env['warnings']:
 
 # ugr,huh?
 env.Append (LINKFLAGS = ['-Wl,--export-dynamic'])
+# FIXME: ParseConfig ignores -L flag?
+env.Append (LINKFLAGS = ['-L/usr/X11R6/lib'])
 
 if env['verbose']:
        env['__verbose'] = ' --verbose'
@@ -742,10 +761,10 @@ env.Append (
 
        # FIXME: move to lily/SConscript?
        LIBPATH = [os.path.join (absbuild, 'flower', env['out']),
-                  os.path.join (absbuild, 'kpath-guile', env['out']),
-                  os.path.join (absbuild, 'ttftool', env['out']),],
+                  os.path.join (absbuild, 'kpath-guile', env['out']),],
        CPPPATH = [outdir, ],
-       LILYPOND_PATH = ['.', '$srcdir/input',
+       LILYPOND_PATH = ['.',
+                        '$srcdir/input',
                         '$srcdir/input/regression',
                         '$srcdir/input/test',
                         '$srcdir/input/tutorial',
@@ -808,7 +827,8 @@ def symlink_tree (target, source, env):
              ('scripts/',   'bin/ps2png'),
              ('mf',         'share/lilypond/%(ver)s/dvips/mf-out'),
              ('#ps',        'share/lilypond/%(ver)s/dvips/ps'),
-             ('#ps',        'share/lilypond/%(ver)s/tex/music-drawing-routines.ps'),
+             ('#ps/music-drawing-routines.ps',
+              'share/lilypond/%(ver)s/tex/music-drawing-routines.ps'),
              ('mf',         'share/lilypond/%(ver)s/otf'),
              ('mf',         'share/lilypond/%(ver)s/tfm'),
              ('tex',        'share/lilypond/%(ver)s/tex/enc'),
@@ -842,7 +862,7 @@ def symlink_tree (target, source, env):
                           % vars ())
        os.chdir (srcdir)
 
-if env['debugging']:
+if 1: #env['debugging']:
        stamp = os.path.join (run_prefix, 'stamp')
        env.Command (stamp, ['#/SConstruct', '#/VERSION'],
                     [symlink_tree, 'touch $TARGET'])
@@ -859,18 +879,20 @@ def cvs_entry_is_file (line):
        return line[0] == '/' and line[-2] == '/'
 
 def cvs_dirs (dir):
-       ENTRIES = os.path.join (dir, 'CVS/Entries')
-       if not os.path.exists (ENTRIES):
+       entries = os.path.join (dir, 'CVS/Entries')
+       if not os.path.exists (entries):
                return []
-       entries = open (ENTRIES).readlines ()
+       entries = open (entries).readlines ()
        dir_entries = filter (cvs_entry_is_dir, entries)
        dirs = map (lambda x: os.path.join (dir, x[2:x[2:].index ('/')+3]),
                    dir_entries)
        return dirs + map (cvs_dirs, dirs)
 
 def cvs_files (dir):
-       ENTRIES = os.path.join (dir, 'CVS/Entries')
-       entries = open (ENTRIES).readlines ()
+       entries = os.path.join (dir, 'CVS/Entries')
+       if not os.path.exists (entries):
+               return []
+       entries = open (entries).readlines ()
        file_entries = filter (cvs_entry_is_file, entries)
        files = map (lambda x: x[1:x[1:].index ('/')+1], file_entries)
        return map (lambda x: os.path.join (dir, x), files)
@@ -884,7 +906,7 @@ def flatten (tree, lst):
                                lst.append (i)
        return lst
 
-if os.path.isdir ('$srcdir/CVS'):
+if os.path.isdir ('%(srcdir)s/CVS' % vars ()):
        subdirs = flatten (cvs_dirs ('.'), [])
 else:
        # ugh
@@ -898,14 +920,14 @@ if env['fast']\
    and 'web' not in COMMAND_LINE_TARGETS\
    and 'install' not in COMMAND_LINE_TARGETS\
    and 'clean' not in COMMAND_LINE_TARGETS:
-       subdirs = ['lily', 'lily/include',
-                  'flower', 'flower/include',
+       subdirs = ['lily',
+                  'flower',
                   'kpath-guile',
-                  'ttftool',
                   'mf',
+                  'python',
                   ]
 
-if os.path.isdir ('$srcdir/CVS'):
+if os.path.isdir ('%(srcdir)s/CVS' % vars ()):
        src_files = reduce (lambda x, y: x + y, map (cvs_files, subdirs))
 else:
        src_files = ['foobar']