#!/usr/bin/scons # # Replacement Atom-4 build script. # # Configurable parameters: (run with 'cons $VARNAME=$VALUE ...') # # BINDIR=$dir Where to install Atom-4 binaries # COMPILER=$binary Compiler to use (default: g++) # DATADIR=$dir Where data files should be installed # MANDIR=$dir Directory to store manpages # REALDATADIR=$dir Where Atom-4 should look for data files (default # is $DATADIR; this option is mainly for packaging # builds where the build-time dir is different from # the run-time dir) # PROGLIBPATH=$dir Path to prog/lib libraries (default: #../lib) # X11LIBPATH=$dir Where to find X11 libraries (default: /usr/X11R6/lib) # DEBUG=1 Build with debugging symbols # OPTIMIZE=$n Optimize to level $n. Set to 0 to disable. # (Default: 2) # PROFILE=1 Build with profiling code (for development use only) # # External configuration (can be overridden by running SCons with the # appropriate X=Y W=Z ... options) datadir = ARGUMENTS.get('DATADIR', '#data') optimize = ARGUMENTS.get('OPTIMIZE', 2) profile = ARGUMENTS.get('PROFILE', 0) # Shared files bindir = ARGUMENTS.get('BINDIR', '#bin') incdir = ARGUMENTS.get('INCDIR', '#include') mandir = ARGUMENTS.get('MANDIR', '#man') libdir = '#lib' objdir = '#obj' # Locations of required libs proglib = '-lt++' proglibpath = ARGUMENTS.get('PROGLIBPATH', '../lib') ncurseslib = ['-lpanel', '-lncurses'] x11lib = ['-lX11', '-lXpm'] x11libpath = ARGUMENTS.get('X11LIBPATH', '/usr/X11R6/lib') # Global configuration compiler = ARGUMENTS.get('COMPILER', 'g++') realdatadir = ARGUMENTS.get('REALDATADIR', datadir) cflags = [ '-pedantic', '-DDATADIR=\\"' + Dir(realdatadir).path + '\\"' ] if ARGUMENTS.get('DEBUG', 0): cflags += ['-g3'] if optimize: cflags += ['-O%d' % optimize] if profile: cflags = cflags + [ '-pg', '-DPROFILE' ] # Local configuration incpath = [ incdir, proglibpath + '/include' ] libpath = [ proglibpath + '/lib', libdir, x11libpath ] libs = [ proglib, '-lxatom4', '-latom4', ncurseslib, x11lib ]; if profile: libs += '-pg' env = Environment( CC = compiler, CFLAGS = cflags, CXXFLAGS = cflags, CPPPATH = incpath, LIBS = libs, LIBPATH = libpath ) env.Decider('content') Export('env', 'compiler', 'cflags', 'bindir', 'datadir', 'incdir', 'libdir', 'objdir', 'proglibpath', 'ncurseslib') # Build tree SConscript(Split(""" engine/SConscript general/SConscript ncurses/SConscript net/SConscript x/SConscript """)) # # Headers # env.Install(incdir, 'interface.h') # # Main program # env.Install(bindir, 'atom4') env.Program('atom4', [ 'atom4.cc', 'interface.cc', objdir + '/event.o', objdir + '/textui.o' ]) env.Depends('atom4', Split(""" lib/libatom4.a lib/libxatom4.a """)) # # Auxilliary stuff # env.Install(mandir + '/man6', 'atom4.6');