--- SConstruct.orig	2011-11-11 23:38:26.000000000 +0100
+++ SConstruct	2011-11-11 23:38:53.000000000 +0100
@@ -49,8 +49,10 @@
 
 
 opts = DefineOptions("build_options.py", ARGUMENTS)
-env = Environment(ENV = {'PATH':os.environ['PATH']}) # for an unknown reason Environment(options=opts) doesnt work well
-opts.Update(env) # Needed as Environment(options=opts) doesnt seem to work
+env = Environment(ENV = os.environ, options = opts)
+env['CCFLAGS'] = Split(ccflags) + Split(env['CCFLAGS'])
+env['CPPPATH'] = Split(env['CPPPATH'])
+env['LIBPATH'] = Split(env['LIBPATH'])
 Help(opts.GenerateHelpText(env))
 mingw = env.Clone()
 optionsChanged = True
@@ -144,6 +146,10 @@
       'LIBS': ['GL'], 
       'LIBPATH': ['/usr/lib', '/usr/X11R6/lib'],
       'CPPPATH': ['/usr/include']}
+  opengl['freebsd'] = { 
+      'LIBS': ['GL'], 
+      'LIBPATH': ['/usr/local/lib'],
+      'CPPPATH': ['/usr/local/include']}
   opengl['cygwin'] = {
       'LIBS': ['opengl3']}
   opengl['darwin'] = {
@@ -155,6 +161,8 @@
   else:
      if sys.platform[:5] == 'linux':
         platform = 'linux'
+     if sys.platform[:7] == 'freebsd':
+        platform = 'freebsd'
      glconfig = opengl.get(platform, {})
   for key in glconfig:
       if key != 'LIBS':
@@ -265,7 +273,6 @@
 
 # define the different build environments (variants)
 release = env.Clone()
-release.Append(CCFLAGS = Split('-O2 -pipe -fomit-frame-pointer -fexpensive-optimizations -ffast-math'))
 
 if mingw['extrapath']:
   mingw.Tool('crossmingw', toolpath = ['tools/scons/'])