--- /dev/null +++ b/SConstruct @@ -0,0 +1,132 @@ +#!/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) + +# Presets from environment +cflags = Split(ARGUMENTS.get('CFLAGS', '')) +cxxflags = Split(ARGUMENTS.get('CXXFLAGS', '')) +cppflags = Split(ARGUMENTS.get('CPPFLAGS', '')) +ldflags = Split(ARGUMENTS.get('LDFLAGS', '')) + +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, ncurseslib, x11lib, '-latom4', '-lxatom4' ]; +if profile: + libs += '-pg' + +env = Environment( + CC = compiler, + CFLAGS = cflags, + CPPFLAGS = cppflags, + CXXFLAGS = cxxflags, + CPPPATH = incpath, + LDFLAGS = ldflags, + LIBS = libs, + LIBPATH = libpath +) +env.Decider('content') + +if ARGUMENTS.get('CCFLAGS', ''): + common_flags = Split(ARGUMENTS.get('CCFLAGS')) + env.Append(CFLAGS = common_flags) + env.Append(CPPFLAGS = common_flags) + env.Append(CXXFLAGS = common_flags) + common_ldflags = Split(ARGUMENTS.get('LDFLAGS')) + env.Append(LDFLAGS = common_ldflags) + +Export('env', 'compiler', 'cflags', 'cppflags', 'cxxflags', 'bindir', 'datadir', 'incdir', 'ldflags', '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'); + --- /dev/null +++ b/engine/SConscript @@ -0,0 +1,23 @@ +#!/usr/bin/scons -u +# +# Atom-4 game engine build script. +# + +Import('env', 'bindir', 'incdir', 'libdir') + +env.Install(libdir, 'libatom4.a') +env.Install(incdir, [ + 'ai.h', + 'board4.h', + 'color4.h', + 'game.h', + 'triboard.h' +]) + +env.Library('libatom4.a', [ + 'ai.cc', + 'board4.cc', + 'color4.cc', + 'game.cc', + 'triboard.cc' +]) --- /dev/null +++ b/general/SConscript @@ -0,0 +1,13 @@ +#!/usr/bin/scons -u +# +# Atom-4 general routines build script. +# + +Import('env', 'incdir', 'objdir') + +# Products +env.Install(incdir, 'event.h') +env.Install(objdir, 'event.o') + +env.Object('event.cc') + --- /dev/null +++ b/ncurses/SConscript @@ -0,0 +1,19 @@ +#!/usr/bin/scons -u +# +# Atom-4 ncurses module build script. +# + +Import('compiler', 'cflags', 'bindir', 'incdir', 'objdir', 'proglibpath', + 'ncurseslib'); + +env = Environment( + CC = compiler, + CFLAGS = cflags, + CPPPATH = [ incdir, proglibpath + '/include' ] +); + +env.Install(incdir, 'textui.h') +env.Install(objdir, 'textui.o') + +env.Object('textui.cc') + --- /dev/null +++ b/net/SConscript @@ -0,0 +1,18 @@ +#!/usr/bin/scons -u +# +# Atom-4 networking routines build script. +# + +Import('env', 'incdir', 'libdir') + +## Products +#env.Install(libdir, 'libatomnet.a') +#env.Install(incdir, [ +# 'net.h', +# 'server.h' +#]) +# +#env.Library('libatomnet.a', [ +# 'net.cc', +# 'server.cc' +#]) --- /dev/null +++ b/x/SConscript @@ -0,0 +1,46 @@ +#!/usr/bin/scons -u +# +# Atom-4 X11 client sub- build script. +# + +Import('env', 'bindir', 'datadir', 'incdir', 'libdir') + +# Products +env.Install(libdir, 'libxatom4.a') +env.Install(datadir, [ + 'tritile12.xpm', + 'blackball12.xpm', + 'redball12.xpm', + 'greenball12.xpm', + 'blueball12.xpm', + 'turqball12.xpm', + 'purpleball12.xpm', + 'yellowball12.xpm', + 'whiteball12.xpm', + 'wheel12-1.xpm', + 'wheel12-2.xpm', + 'wheel12-3.xpm', + 'wheel12-4.xpm', + 'wheel12-5.xpm', + 'wheel12-6.xpm' +]) + +# Headers +env.Install(incdir, [ + 'xatom4.h', + 'xcursor.h', + 'xscoreboard.h', + 'xsprite.h', + 'xtext.h', + 'xtriboard.h', + 'xutil.h' +]) + +env.Library('libxatom4.a', [ + 'xatom4.cc', + 'xcursor.cc', + 'xscoreboard.cc', + 'xsprite.cc', + 'xtriboard.cc', + 'xutil.cc' +]) --- /dev/null +++ b/proglib/SConstruct @@ -0,0 +1,51 @@ +#!/usr/bin/scons +# +# Library build script. +# +# Configurable parameters: (run with 'cons $VARNAME=$VALUE ...') +# +# CC=$binary C compiler to use (default: gcc) +# CXX=$binary C++ compiler to use (default: g++) +# ADIR=$dir Where to install .a files +# INCDIR=$dir Where to install header files +# SODIR=$dir Where to install .so files (currently not implemented) +# DEBUG=1 Build with debugging symbols +# + + +# +# Externally configurable settings +# + +cc = ARGUMENTS.get('CC', 'gcc') +cxx = ARGUMENTS.get('CXX', 'g++') +adir = ARGUMENTS.get('ADIR', '#lib') +incdir = ARGUMENTS.get('INCDIR', '#include') +sodir = ARGUMENTS.get('SODIR', '#lib') + +# +# Internal setup +# + +debugflag = '-g3' if ARGUMENTS.get('DEBUG') else '' +cflags = [ + '-pedantic', '-Wall', debugflag +] +cxxflags = cflags +incpaths = incdir + +env = Environment( + CC = cc, + CFLAGS = cflags, + CXX = cxx, + CXXFLAGS = cxxflags, + CPPPATH = incpaths +) + +Export('adir', 'incdir', 'sodir', 'env') + +SConscript(Split(""" + c++/SConscript + c/SConscript +""")) + --- /dev/null +++ b/proglib/c++/SConscript @@ -0,0 +1,27 @@ +# +# C++ library build script +# + +Import('env', 'adir', 'incdir', 'sodir') + +# +# Products +# + +env.Install(incdir, Split(""" + dlist.h + exception.h + list.h + stack.h + txtutil.h +""")) + +env.Install(adir, 'libt++.a') + +env.Library('libt++.a', Split(""" + dlist.cc + exception.cc + list.cc + stack.cc + txtutil.cc +""")) --- /dev/null +++ b/proglib/c/SConscript @@ -0,0 +1,13 @@ +# +# C library build script +# + +Import('env', 'adir', 'incdir', 'sodir') + +# +# Products +# + +env.Install(incdir, 'error.h') + +# Currently, we don't actually have any linkables in the C library.