--- /dev/null
+diff -up ./SCons/Config/gnu.debug ./SCons/Config/gnu
+--- ./SCons/Config/gnu.debug 2009-02-13 12:41:42.000000000 +0100
++++ ./SCons/Config/gnu 2009-02-13 12:42:37.000000000 +0100
+@@ -68,13 +68,16 @@ cross_env(stub_env)
+
+ stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
+
+-if not defenv['DEBUG']:
+- stub_env.Append(CCFLAGS = ['-Os']) # optimize for size
++if defenv['DEBUG_SYMBOLS']:
++ stub_env.Append(LINKFLAGS = '-g') # debugging
++ stub_env.Append(CCFLAGS = '-g') # debugging
++if not defenv['DEBUG'] and defenv['OPT']:
++ stub_env.Append(CCFLAGS = ['-O2']) # optimize
+ stub_env.Append(CCFLAGS = ['-Wall']) # all warnings
+ stub_env.Append(CCFLAGS = ['-xc']) # force compile as c
+ stub_env.Append(CCFLAGS = ['-fno-strict-aliasing']) # not safe for strict aliasing
+
+-if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS'] and defenv['STRIP'] and defenv['STRIP_W32']:
+ stub_env.Append(LINKFLAGS = ['-s']) # strip
+ stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
+ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
+@@ -88,15 +91,18 @@ makensis_env = defenv.Clone()
+
+ makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
+
+-if not defenv['DEBUG']:
+- makensis_env.Append(CCFLAGS = ['-O2']) # optimize
++if defenv['DEBUG_SYMBOLS']:
++ makensis_env.Append(LINKFLAGS = '-g') # debugging
++ makensis_env.Append(CCFLAGS = '-g') # debugging
++if not defenv['DEBUG'] and defenv['OPT']:
++ makensis_env.Append(CCFLAGS = ['-O2']) # optimize
+ makensis_env.Append(CFLAGS = ['-Wall']) # all warnings
+ makensis_env.Append(CXXFLAGS = ['-Wno-non-virtual-dtor']) # ignore virtual dtor warnings
+ makensis_env.Append(CXXFLAGS = ['-Wall']) # all warnings
+
+ conf = FlagsConfigure(makensis_env)
+ conf.CheckLinkFlag('$MAP_FLAG') # generate map file
+-if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_CP']:
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS'] and defenv['STRIP'] and defenv['STRIP_CP']:
+ TestStrip(conf) # strip
+ conf.Finish()
+
+@@ -105,12 +111,15 @@ conf.Finish()
+ plugin_env = defenv.Clone()
+ cross_env(plugin_env)
+
+-if not defenv['DEBUG']:
+- plugin_env.Append(CCFLAGS = ['-Os']) # optimize for size
++if defenv['DEBUG_SYMBOLS']:
++ plugin_env.Append(LINKFLAGS = '-g') # debugging
++ plugin_env.Append(CCFLAGS = '-g') # debugging
++if not defenv['DEBUG'] and defenv['OPT']:
++ plugin_env.Append(CCFLAGS = ['-O2']) # optimize
+ plugin_env.Append(CCFLAGS = ['-Wall']) # level 3 warnings
+ plugin_env.Append(CCFLAGS = ['-fno-strict-aliasing']) # not safe for strict aliasing
+
+-if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS'] and defenv['STRIP'] and defenv['STRIP_W32']:
+ plugin_env.Append(LINKFLAGS = ['-s']) # strip
+ plugin_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
+ plugin_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
+@@ -122,7 +131,10 @@ cp_util_env = defenv.Clone()
+
+ cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
+
+-if not defenv['DEBUG']:
++if defenv['DEBUG_SYMBOLS']:
++ cp_util_env.Append(LINKFLAGS = '-g') # debugging
++ cp_util_env.Append(CCFLAGS = '-g') # debugging
++if not defenv['DEBUG'] and defenv['OPT']:
+ cp_util_env.Append(CCFLAGS = ['-O2']) # optimize
+ cp_util_env.Append(CCFLAGS = ['-Wall']) # all warnings
+ cp_util_env.Append(CCFLAGS = ['-fno-strict-aliasing']) # not safe for strict aliasing
+@@ -140,7 +152,7 @@ util_env.Append(LINKFLAGS = ['-mwindows'
+ util_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
+
+ conf = FlagsConfigure(util_env)
+-if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS'] and defenv['STRIP'] and defenv['STRIP_W32']:
+ util_env.Append(LINKFLAGS = ['-s']) # strip
+ conf.Finish()
+
+@@ -149,7 +161,7 @@ conf.Finish()
+ conf = FlagsConfigure(cp_util_env)
+ conf.CheckCompileFlag('-m32')
+ conf.CheckLinkFlag('-m32')
+-if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_CP']:
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS'] and defenv['STRIP'] and defenv['STRIP_CP']:
+ TestStrip(conf) # strip
+ conf.Finish()
+
+@@ -157,6 +169,9 @@ conf.Finish()
+
+ test_env = defenv.Clone()
+ test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
++if defenv['DEBUG_SYMBOLS']:
++ test_env.Append(LINKFLAGS = '-g') # debugging
++ test_env.Append(CCFLAGS = '-g') # debugging
+ conf = FlagsConfigure(test_env)
+ conf.CheckCompileFlag('-m32')
+ conf.CheckLinkFlag('-m32')
+diff -up ./SConstruct.debug ./SConstruct
+--- ./SConstruct.debug 2009-02-04 15:05:48.000000000 +0100
++++ ./SConstruct 2009-02-13 12:41:42.000000000 +0100
+@@ -157,6 +157,8 @@ opts.Add(('APPEND_CCFLAGS', 'Additional
+ opts.Add(('APPEND_LINKFLAGS', 'Additional linker flags'))
+ # build options
+ opts.Add(BoolVariable('DEBUG', 'Build executables with debugging information', 'no'))
++opts.Add(BoolOption('DEBUG_SYMBOLS', 'Build with debugging information, but none of the side effects of DEBUG', 'no'))
++opts.Add(BoolOption('OPT', 'Build with optimization', 'yes'))
+ opts.Add(PathVariable('CODESIGNER', 'A program used to sign executables', None))
+ opts.Add(BoolVariable('STRIP', 'Strips executables of any unrequired data such as symbols', 'yes'))
+ opts.Add(BoolVariable('STRIP_CP', 'Strips cross-platform executables of any unrequired data such as symbols', 'yes'))