All pastes #177662 Raw Edit

Anonymous

public python v1 · immutable
#177662 ·published 2006-09-20 16:00 UTC
rendered paste body
import osimport commandsimport stringEnsureSConsVersion(0, 96)def CheckPKGConfig(context):     context.Message('Checking for pkg-config... ')     ret = context.TryAction('pkg-config --version')[0]     context.Result(ret)     return retdef CheckPKG(context, name):     context.Message('Checking for %s... ' % name)     ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]     context.Result(ret)     return retdef CheckCXXVersion(context, name, major, minor):    context.Message('Checking for %s >= %d.%d...' % (name, major, minor))    ret = commands.getoutput('%s -dumpversion' % name)    retval = 0    if(ret.find('not found') == -1):        if(string.atoi(ret[0]) == major and string.atoi(ret[2]) >= minor):            retval = 1        elif(string.atoi(ret[0]) > major):            retval = 1    context.Result(retval)    return retvaldef CheckAddr2line(context):    context.Message('Checking for addr2line... ')    if WhereIs('addr2line') != None:        retval = 1    else:        retval = 0    context.Result(retval)    return retvalenv = Environment(ENV = os.environ)conf = Configure(env,    custom_tests = {        'CheckPKGConfig' : CheckPKGConfig,        'CheckPKG' : CheckPKG,        'CheckCXXVersion' : CheckCXXVersion,        'CheckAddr2line' : CheckAddr2line    })if os.environ.has_key('CXX'):     env['CXX'] = os.environ['CXX']if os.environ.has_key('CXXFLAGS'):     env['CXXFLAGS'] = os.environ['CXXFLAGS'].split()# Dependenciesif not conf.CheckCXXVersion(env['CXX'], 4, 0):     print 'Compiler version check failed. g++ 4.0 or later is needed'     Exit(1)# Add support for compiler caches to speed-up compilation.#if conf.TryAction(Action('distcc'))[0]:#    env.Prepend(CXX = 'distcc ')#    print 'Enabling distcc...'if conf.TryAction(Action('ccache'))[0]:    env.Prepend(CXX = 'ccache ')    print 'Enabling ccache...'if not conf.CheckPKGConfig():     print 'pkg-config not found.'     Exit(1)if not conf.CheckCXXHeader('tr1/functional'):    print 'Did not find the header tr1/functional (need CGG 4.0 or later)'    Exit(1)if not conf.CheckLibWithHeader('ncursesw', 'ncursesw/ncurses.h', 'c'):    print 'Did not find the ncursesw library'    print 'Can\'t live without it, exiting'    print 'Note: You might have the lib but not the headers (install dev-package)'    Exit(1)if not conf.CheckLibWithHeader('pthread', 'pthread.h', 'c'):    print 'Did not find the pthread library, exiting!'    print 'Note: You might have the lib but not the headers'    Exit(1)if not conf.CheckLibWithHeader('z', 'zlib.h', 'c'):    print 'Did not find the z library (gzip/z compression)'    print 'Can\'t live without it, exiting'    print 'Note: You might have the lib but not the headers'    Exit(1)if not conf.CheckLibWithHeader('bz2', 'bzlib.h', 'c'):    print 'Did not find the bz2 library (bz2 compression)'    print 'Can\'t live without it, exiting'    print 'Note: You might have the lib but not the headers'    Exit(1)if not conf.CheckPKG('glib-2.0'):    print 'Did not find the glib-2.0 library'    print 'Can\'t live without it, exiting'    print 'Note: You might have the lib but not the development package (libglib2.0-dev)'    Exit(1)if not conf.CheckPKG('sigc++-2.0'):    print 'Did not find the sigc++-2.0 library'    print 'Can\'t live without it, exiting'    Exit(1)if not conf.CheckFunc('backtrace'):    conf.env.Prepend(CXXFLAGS = '-DUSE_STACKTRACE=0')env = conf.Finish()env.Append(CXXFLAGS = ['-I.', '-ansi', '-Wall'])env.Append(CXXFLAGS = commands.getoutput('pkg-config sigc++-2.0 --cflags').split())env.Append(CXXFLAGS = commands.getoutput('pkg-config glib-2.0 --cflags').split())env.Append(_LIBFLAGS = ' ' + commands.getoutput('pkg-config sigc++-2.0 --libs'))env.Append(_LIBFLAGS = ' ' + commands.getoutput('pkg-config glib-2.0 --libs'))release = ARGUMENTS.get('release', 0)debug = ARGUMENTS.get('debug', 0)if int(release):    env.Append(CXXFLAGS = '-O2')elif int(debug):    env.Append(CXXFLAGS = ['-g', '-rdynamic'])else:    env.Append(CXXFLAGS = '-rdynamic')build = env.Program('nanodc', [    SConscript('client/SConscript', exports='env', build_dir='build/client', duplicate=0),    SConscript('core/SConscript', exports='env', build_dir='build/core', duplicate=0),    SConscript('input/SConscript', exports='env', build_dir='build/input', duplicate=0),    SConscript('utils/SConscript', exports='env', build_dir='build/utils', duplicate=0),    SConscript('ui/SConscript', exports='env', build_dir='build/ui', duplicate=0),    SConscript('display/SConscript', exports='env', build_dir='build/display', duplicate=0),    SConscript('commands/SConscript', exports='env', build_dir='build/commands', duplicate=0)])Default(build)