| 1 |
--- /dev/null |
| 2 |
+++ b/SConstruct |
| 3 |
@@ -0,0 +1,132 @@ |
| 4 |
+#!/usr/bin/scons |
| 5 |
+# |
| 6 |
+# Replacement Atom-4 build script. |
| 7 |
+# |
| 8 |
+# Configurable parameters: (run with 'cons $VARNAME=$VALUE ...') |
| 9 |
+# |
| 10 |
+# BINDIR=$dir Where to install Atom-4 binaries |
| 11 |
+# COMPILER=$binary Compiler to use (default: g++) |
| 12 |
+# DATADIR=$dir Where data files should be installed |
| 13 |
+# MANDIR=$dir Directory to store manpages |
| 14 |
+# REALDATADIR=$dir Where Atom-4 should look for data files (default |
| 15 |
+# is $DATADIR; this option is mainly for packaging |
| 16 |
+# builds where the build-time dir is different from |
| 17 |
+# the run-time dir) |
| 18 |
+# PROGLIBPATH=$dir Path to prog/lib libraries (default: #../lib) |
| 19 |
+# X11LIBPATH=$dir Where to find X11 libraries (default: /usr/X11R6/lib) |
| 20 |
+# DEBUG=1 Build with debugging symbols |
| 21 |
+# OPTIMIZE=$n Optimize to level $n. Set to 0 to disable. |
| 22 |
+# (Default: 2) |
| 23 |
+# PROFILE=1 Build with profiling code (for development use only) |
| 24 |
+# |
| 25 |
+ |
| 26 |
+# External configuration (can be overridden by running SCons with the |
| 27 |
+# appropriate X=Y W=Z ... options) |
| 28 |
+datadir = ARGUMENTS.get('DATADIR', '#data') |
| 29 |
+optimize = ARGUMENTS.get('OPTIMIZE', 2) |
| 30 |
+profile = ARGUMENTS.get('PROFILE', 0) |
| 31 |
+ |
| 32 |
+# Shared files |
| 33 |
+bindir = ARGUMENTS.get('BINDIR', '#bin') |
| 34 |
+incdir = ARGUMENTS.get('INCDIR', '#include') |
| 35 |
+mandir = ARGUMENTS.get('MANDIR', '#man') |
| 36 |
+libdir = '#lib' |
| 37 |
+objdir = '#obj' |
| 38 |
+ |
| 39 |
+# Locations of required libs |
| 40 |
+proglib = '-lt++' |
| 41 |
+proglibpath = ARGUMENTS.get('PROGLIBPATH', '../lib') |
| 42 |
+ncurseslib = ['-lpanel', '-lncurses'] |
| 43 |
+x11lib = ['-lX11', '-lXpm'] |
| 44 |
+x11libpath = ARGUMENTS.get('X11LIBPATH', '/usr/X11R6/lib') |
| 45 |
+ |
| 46 |
+# Global configuration |
| 47 |
+compiler = ARGUMENTS.get('COMPILER', 'g++') |
| 48 |
+realdatadir = ARGUMENTS.get('REALDATADIR', datadir) |
| 49 |
+ |
| 50 |
+# Presets from environment |
| 51 |
+cflags = Split(ARGUMENTS.get('CFLAGS', '')) |
| 52 |
+cxxflags = Split(ARGUMENTS.get('CXXFLAGS', '')) |
| 53 |
+cppflags = Split(ARGUMENTS.get('CPPFLAGS', '')) |
| 54 |
+ldflags = Split(ARGUMENTS.get('LDFLAGS', '')) |
| 55 |
+ |
| 56 |
+cflags += [ |
| 57 |
+ '-pedantic', |
| 58 |
+ '-DDATADIR=\\"' + Dir(realdatadir).path + '\\"' |
| 59 |
+] |
| 60 |
+if ARGUMENTS.get('DEBUG', 0): |
| 61 |
+ cflags += ['-g3'] |
| 62 |
+if optimize: |
| 63 |
+ cflags += ['-O%d' % optimize] |
| 64 |
+if profile: |
| 65 |
+ cflags = cflags + [ '-pg', '-DPROFILE' ] |
| 66 |
+ |
| 67 |
+# Local configuration |
| 68 |
+incpath = [ incdir, proglibpath + '/include' ] |
| 69 |
+libpath = [ proglibpath + '/lib', libdir, x11libpath ] |
| 70 |
+libs = [ proglib, ncurseslib, x11lib, '-latom4', '-lxatom4' ]; |
| 71 |
+if profile: |
| 72 |
+ libs += '-pg' |
| 73 |
+ |
| 74 |
+env = Environment( |
| 75 |
+ CC = compiler, |
| 76 |
+ CFLAGS = cflags, |
| 77 |
+ CPPFLAGS = cppflags, |
| 78 |
+ CXXFLAGS = cxxflags, |
| 79 |
+ CPPPATH = incpath, |
| 80 |
+ LDFLAGS = ldflags, |
| 81 |
+ LIBS = libs, |
| 82 |
+ LIBPATH = libpath |
| 83 |
+) |
| 84 |
+env.Decider('content') |
| 85 |
+ |
| 86 |
+if ARGUMENTS.get('CCFLAGS', ''): |
| 87 |
+ common_flags = Split(ARGUMENTS.get('CCFLAGS')) |
| 88 |
+ env.Append(CFLAGS = common_flags) |
| 89 |
+ env.Append(CPPFLAGS = common_flags) |
| 90 |
+ env.Append(CXXFLAGS = common_flags) |
| 91 |
+ common_ldflags = Split(ARGUMENTS.get('LDFLAGS')) |
| 92 |
+ env.Append(LDFLAGS = common_ldflags) |
| 93 |
+ |
| 94 |
+Export('env', 'compiler', 'cflags', 'cppflags', 'cxxflags', 'bindir', 'datadir', 'incdir', 'ldflags', 'libdir', |
| 95 |
+ 'objdir', 'proglibpath', 'ncurseslib') |
| 96 |
+ |
| 97 |
+# Build tree |
| 98 |
+SConscript(Split(""" |
| 99 |
+ engine/SConscript |
| 100 |
+ general/SConscript |
| 101 |
+ ncurses/SConscript |
| 102 |
+ net/SConscript |
| 103 |
+ x/SConscript |
| 104 |
+""")) |
| 105 |
+ |
| 106 |
+ |
| 107 |
+# |
| 108 |
+# Headers |
| 109 |
+# |
| 110 |
+ |
| 111 |
+env.Install(incdir, 'interface.h') |
| 112 |
+ |
| 113 |
+ |
| 114 |
+# |
| 115 |
+# Main program |
| 116 |
+# |
| 117 |
+ |
| 118 |
+env.Install(bindir, 'atom4') |
| 119 |
+env.Program('atom4', [ |
| 120 |
+ 'atom4.cc', |
| 121 |
+ 'interface.cc', |
| 122 |
+ objdir + '/event.o', |
| 123 |
+ objdir + '/textui.o' |
| 124 |
+]) |
| 125 |
+env.Depends('atom4', Split(""" |
| 126 |
+ lib/libatom4.a |
| 127 |
+ lib/libxatom4.a |
| 128 |
+""")) |
| 129 |
+ |
| 130 |
+# |
| 131 |
+# Auxilliary stuff |
| 132 |
+# |
| 133 |
+ |
| 134 |
+env.Install(mandir + '/man6', 'atom4.6'); |
| 135 |
+ |
| 136 |
--- /dev/null |
| 137 |
+++ b/engine/SConscript |
| 138 |
@@ -0,0 +1,23 @@ |
| 139 |
+#!/usr/bin/scons -u |
| 140 |
+# |
| 141 |
+# Atom-4 game engine build script. |
| 142 |
+# |
| 143 |
+ |
| 144 |
+Import('env', 'bindir', 'incdir', 'libdir') |
| 145 |
+ |
| 146 |
+env.Install(libdir, 'libatom4.a') |
| 147 |
+env.Install(incdir, [ |
| 148 |
+ 'ai.h', |
| 149 |
+ 'board4.h', |
| 150 |
+ 'color4.h', |
| 151 |
+ 'game.h', |
| 152 |
+ 'triboard.h' |
| 153 |
+]) |
| 154 |
+ |
| 155 |
+env.Library('libatom4.a', [ |
| 156 |
+ 'ai.cc', |
| 157 |
+ 'board4.cc', |
| 158 |
+ 'color4.cc', |
| 159 |
+ 'game.cc', |
| 160 |
+ 'triboard.cc' |
| 161 |
+]) |
| 162 |
--- /dev/null |
| 163 |
+++ b/general/SConscript |
| 164 |
@@ -0,0 +1,13 @@ |
| 165 |
+#!/usr/bin/scons -u |
| 166 |
+# |
| 167 |
+# Atom-4 general routines build script. |
| 168 |
+# |
| 169 |
+ |
| 170 |
+Import('env', 'incdir', 'objdir') |
| 171 |
+ |
| 172 |
+# Products |
| 173 |
+env.Install(incdir, 'event.h') |
| 174 |
+env.Install(objdir, 'event.o') |
| 175 |
+ |
| 176 |
+env.Object('event.cc') |
| 177 |
+ |
| 178 |
--- /dev/null |
| 179 |
+++ b/ncurses/SConscript |
| 180 |
@@ -0,0 +1,19 @@ |
| 181 |
+#!/usr/bin/scons -u |
| 182 |
+# |
| 183 |
+# Atom-4 ncurses module build script. |
| 184 |
+# |
| 185 |
+ |
| 186 |
+Import('compiler', 'cflags', 'bindir', 'incdir', 'objdir', 'proglibpath', |
| 187 |
+ 'ncurseslib'); |
| 188 |
+ |
| 189 |
+env = Environment( |
| 190 |
+ CC = compiler, |
| 191 |
+ CFLAGS = cflags, |
| 192 |
+ CPPPATH = [ incdir, proglibpath + '/include' ] |
| 193 |
+); |
| 194 |
+ |
| 195 |
+env.Install(incdir, 'textui.h') |
| 196 |
+env.Install(objdir, 'textui.o') |
| 197 |
+ |
| 198 |
+env.Object('textui.cc') |
| 199 |
+ |
| 200 |
--- /dev/null |
| 201 |
+++ b/net/SConscript |
| 202 |
@@ -0,0 +1,18 @@ |
| 203 |
+#!/usr/bin/scons -u |
| 204 |
+# |
| 205 |
+# Atom-4 networking routines build script. |
| 206 |
+# |
| 207 |
+ |
| 208 |
+Import('env', 'incdir', 'libdir') |
| 209 |
+ |
| 210 |
+## Products |
| 211 |
+#env.Install(libdir, 'libatomnet.a') |
| 212 |
+#env.Install(incdir, [ |
| 213 |
+# 'net.h', |
| 214 |
+# 'server.h' |
| 215 |
+#]) |
| 216 |
+# |
| 217 |
+#env.Library('libatomnet.a', [ |
| 218 |
+# 'net.cc', |
| 219 |
+# 'server.cc' |
| 220 |
+#]) |
| 221 |
--- /dev/null |
| 222 |
+++ b/x/SConscript |
| 223 |
@@ -0,0 +1,46 @@ |
| 224 |
+#!/usr/bin/scons -u |
| 225 |
+# |
| 226 |
+# Atom-4 X11 client sub- build script. |
| 227 |
+# |
| 228 |
+ |
| 229 |
+Import('env', 'bindir', 'datadir', 'incdir', 'libdir') |
| 230 |
+ |
| 231 |
+# Products |
| 232 |
+env.Install(libdir, 'libxatom4.a') |
| 233 |
+env.Install(datadir, [ |
| 234 |
+ 'tritile12.xpm', |
| 235 |
+ 'blackball12.xpm', |
| 236 |
+ 'redball12.xpm', |
| 237 |
+ 'greenball12.xpm', |
| 238 |
+ 'blueball12.xpm', |
| 239 |
+ 'turqball12.xpm', |
| 240 |
+ 'purpleball12.xpm', |
| 241 |
+ 'yellowball12.xpm', |
| 242 |
+ 'whiteball12.xpm', |
| 243 |
+ 'wheel12-1.xpm', |
| 244 |
+ 'wheel12-2.xpm', |
| 245 |
+ 'wheel12-3.xpm', |
| 246 |
+ 'wheel12-4.xpm', |
| 247 |
+ 'wheel12-5.xpm', |
| 248 |
+ 'wheel12-6.xpm' |
| 249 |
+]) |
| 250 |
+ |
| 251 |
+# Headers |
| 252 |
+env.Install(incdir, [ |
| 253 |
+ 'xatom4.h', |
| 254 |
+ 'xcursor.h', |
| 255 |
+ 'xscoreboard.h', |
| 256 |
+ 'xsprite.h', |
| 257 |
+ 'xtext.h', |
| 258 |
+ 'xtriboard.h', |
| 259 |
+ 'xutil.h' |
| 260 |
+]) |
| 261 |
+ |
| 262 |
+env.Library('libxatom4.a', [ |
| 263 |
+ 'xatom4.cc', |
| 264 |
+ 'xcursor.cc', |
| 265 |
+ 'xscoreboard.cc', |
| 266 |
+ 'xsprite.cc', |
| 267 |
+ 'xtriboard.cc', |
| 268 |
+ 'xutil.cc' |
| 269 |
+]) |
| 270 |
--- /dev/null |
| 271 |
+++ b/proglib/SConstruct |
| 272 |
@@ -0,0 +1,51 @@ |
| 273 |
+#!/usr/bin/scons |
| 274 |
+# |
| 275 |
+# Library build script. |
| 276 |
+# |
| 277 |
+# Configurable parameters: (run with 'cons $VARNAME=$VALUE ...') |
| 278 |
+# |
| 279 |
+# CC=$binary C compiler to use (default: gcc) |
| 280 |
+# CXX=$binary C++ compiler to use (default: g++) |
| 281 |
+# ADIR=$dir Where to install .a files |
| 282 |
+# INCDIR=$dir Where to install header files |
| 283 |
+# SODIR=$dir Where to install .so files (currently not implemented) |
| 284 |
+# DEBUG=1 Build with debugging symbols |
| 285 |
+# |
| 286 |
+ |
| 287 |
+ |
| 288 |
+# |
| 289 |
+# Externally configurable settings |
| 290 |
+# |
| 291 |
+ |
| 292 |
+cc = ARGUMENTS.get('CC', 'gcc') |
| 293 |
+cxx = ARGUMENTS.get('CXX', 'g++') |
| 294 |
+adir = ARGUMENTS.get('ADIR', '#lib') |
| 295 |
+incdir = ARGUMENTS.get('INCDIR', '#include') |
| 296 |
+sodir = ARGUMENTS.get('SODIR', '#lib') |
| 297 |
+ |
| 298 |
+# |
| 299 |
+# Internal setup |
| 300 |
+# |
| 301 |
+ |
| 302 |
+debugflag = '-g3' if ARGUMENTS.get('DEBUG') else '' |
| 303 |
+cflags = [ |
| 304 |
+ '-pedantic', '-Wall', debugflag |
| 305 |
+] |
| 306 |
+cxxflags = cflags |
| 307 |
+incpaths = incdir |
| 308 |
+ |
| 309 |
+env = Environment( |
| 310 |
+ CC = cc, |
| 311 |
+ CFLAGS = cflags, |
| 312 |
+ CXX = cxx, |
| 313 |
+ CXXFLAGS = cxxflags, |
| 314 |
+ CPPPATH = incpaths |
| 315 |
+) |
| 316 |
+ |
| 317 |
+Export('adir', 'incdir', 'sodir', 'env') |
| 318 |
+ |
| 319 |
+SConscript(Split(""" |
| 320 |
+ c++/SConscript |
| 321 |
+ c/SConscript |
| 322 |
+""")) |
| 323 |
+ |
| 324 |
--- /dev/null |
| 325 |
+++ b/proglib/c++/SConscript |
| 326 |
@@ -0,0 +1,27 @@ |
| 327 |
+# |
| 328 |
+# C++ library build script |
| 329 |
+# |
| 330 |
+ |
| 331 |
+Import('env', 'adir', 'incdir', 'sodir') |
| 332 |
+ |
| 333 |
+# |
| 334 |
+# Products |
| 335 |
+# |
| 336 |
+ |
| 337 |
+env.Install(incdir, Split(""" |
| 338 |
+ dlist.h |
| 339 |
+ exception.h |
| 340 |
+ list.h |
| 341 |
+ stack.h |
| 342 |
+ txtutil.h |
| 343 |
+""")) |
| 344 |
+ |
| 345 |
+env.Install(adir, 'libt++.a') |
| 346 |
+ |
| 347 |
+env.Library('libt++.a', Split(""" |
| 348 |
+ dlist.cc |
| 349 |
+ exception.cc |
| 350 |
+ list.cc |
| 351 |
+ stack.cc |
| 352 |
+ txtutil.cc |
| 353 |
+""")) |
| 354 |
--- /dev/null |
| 355 |
+++ b/proglib/c/SConscript |
| 356 |
@@ -0,0 +1,13 @@ |
| 357 |
+# |
| 358 |
+# C library build script |
| 359 |
+# |
| 360 |
+ |
| 361 |
+Import('env', 'adir', 'incdir', 'sodir') |
| 362 |
+ |
| 363 |
+# |
| 364 |
+# Products |
| 365 |
+# |
| 366 |
+ |
| 367 |
+env.Install(incdir, 'error.h') |
| 368 |
+ |
| 369 |
+# Currently, we don't actually have any linkables in the C library. |