--- /dev/null
+02_debug_symbols.patch
+Paul Wise <pabs@debian.org>
+Add an option to generate debugging symbols
+without side-effects on optimisation flags
+and an option to enable/disable optimisation
+Index: SCons/Config/gnu
+===================================================================
+--- SCons/Config/gnu.orig 2007-02-02 20:34:33.000000000 +1100
++++ SCons/Config/gnu 2007-02-08 15:33:51.000000000 +1100
+@@ -81,13 +81,16 @@
+ \r
+ makensis_env = defenv.Copy()\r
+ \r
+-if not defenv['DEBUG']:\r
+- makensis_env.Append(CCFLAGS = '-O2') # optimize\r
++if defenv['DEBUG_SYMBOLS']:\r
++ makensis_env.Append(CCFLAGS = '-g') # debugging\r
++ makensis_env.Append(LINKFLAGS = '-g') # debugging\r
++if not defenv['DEBUG'] and defenv['OPT']:\r
++ makensis_env.Append(CCFLAGS = '-O2') # optimize\r
+ makensis_env.Append(CCFLAGS = '-Wall') # all warnings\r
+ \r
+ conf = FlagsConfigure(makensis_env)\r
+ conf.CheckLinkFlag('$MAP_FLAG') # generate map file\r
+-if not defenv['DEBUG']:\r
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS']:\r
+ TestStrip(conf) # strip\r
+ conf.Finish()\r
+ \r
+@@ -110,13 +113,16 @@
+ \r
+ cp_util_env = defenv.Copy()\r
+ \r
+-if not defenv['DEBUG']:\r
++if defenv['DEBUG_SYMBOLS']:\r
++ cp_util_env.Append(CCFLAGS = '-g') # debugging\r
++ cp_util_env.Append(LINKFLAGS = '-g') # debugging\r
++if not defenv['DEBUG'] and defenv['OPT']:\r
+ cp_util_env.Append(CCFLAGS = '-O2') # optimize\r
+ cp_util_env.Append(CCFLAGS = '-Wall') # all warnings\r
+ \r
+ conf = FlagsConfigure(cp_util_env)\r
+ conf.CheckLinkFlag('$MAP_FLAG') # generate map file\r
+-if not defenv['DEBUG']:\r
++if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS']:\r
+ TestStrip(conf) # strip\r
+ conf.Finish()\r
+ \r
+@@ -131,6 +137,9 @@
+ ### test environment\r
+ \r
+ test_env = defenv.Copy()\r
++if defenv['DEBUG_SYMBOLS']:\r
++ test_env.Append(LINKFLAGS = '-g') # debugging\r
++ test_env.Append(CCFLAGS = '-g') # debugging\r
+ \r
+ ### weird GCC requirements\r
+ \r
+Index: SConstruct
+===================================================================
+--- SConstruct.orig 2007-02-02 20:34:33.000000000 +1100
++++ SConstruct 2007-02-08 15:48:40.000000000 +1100
+@@ -127,6 +127,8 @@
+ opts.Add(PathOption('LIBPATH', 'Path to search for libraries', None))\r
+ # build options\r
+ opts.Add(BoolOption('DEBUG', 'Build executables with debugging information', 'no'))\r
++opts.Add(BoolOption('DEBUG_SYMBOLS', 'Build with debugging information, but none of the side effects of DEBUG', 'no'))\r
++opts.Add(BoolOption('OPT', 'Build with optimization', 'yes'))\r
+ opts.Add(PathOption('CODESIGNER', 'A program used to sign executables', None))\r
+ # path related build options\r
+ opts.Add(('PREFIX_DEST', 'Intermediate installation prefix (extra install time prefix)', dirs['dest']))\r