fix for bug of long group long name, bug found and fixed for bmx007
[blender-staging.git] / SConstruct
index 17b08b548178d0e2dd6f0d7a8de6b72c0a4ed6e5..695fd29795b403230783a55289ef97a2ba8e653f 100644 (file)
@@ -4,10 +4,14 @@ import os
 import time
 import sys
 from distutils import sysconfig
-import SCons.Script
 from tools.scons.bs import *
 
 bs_globals.arguments = ARGUMENTS
+bs_globals.targets = COMMAND_LINE_TARGETS
+
+print 'targets = ',bs_globals.targets
+print 'arguments = ', bs_globals.arguments
+print os.getcwd()
 
 appname = ''
 playername = ''
@@ -22,7 +26,10 @@ if sys.platform != 'win32':
        config_guess = os.popen("SRCHOME=source/ source/tools/guess/guessconfig").read()[:-1]
 else:
        config_guess = "windows"
-       
+
+#the above check is not enough for darwin. we way want to build for darwin/X11
+#more, now even for Os X, we need to check and take in account arch 
+#(PPC, x86, universal binaries)        
 if sys.platform == 'darwin':
        appname = 'blender'
        playername = 'blenderplayer'
@@ -39,30 +46,36 @@ bs_config.parseOpts()
 # don't want to put scons-generated .sconsign files in the source tree, but in
 # the root_build_dir, we have to create that dir ourselves before SCons tries
 # to access/create the file containing .sconsign data.
+# we need to create the top level hierarchy too (at least on Os X) 
 if os.path.isdir (bs_globals.root_build_dir) == 0:
        os.makedirs (bs_globals.root_build_dir)
-
+       os.makedirs (bs_globals.root_build_dir+os.sep+'extern')
+       os.makedirs (bs_globals.root_build_dir+os.sep+'intern')
+       os.makedirs (bs_globals.root_build_dir+os.sep+'source')
 
 # Blender version.
-version='2.35'
-shortversion = '235' # for wininst target -> nsis installer creation
+version='2.40-alpha1'
+shortversion = '240alpha1' # for wininst target -> nsis installer creation
 
-sdl_env = Environment ()
-freetype_env = Environment ()
-env = Environment ()
+sdl_env = Environment (ENV = os.environ)
+freetype_env = Environment (ENV = os.environ)
+env = Environment (ENV = os.environ)
 
 if sys.platform == 'linux2' or sys.platform == 'linux-i386':
-       use_international = 'false'
+       use_international = 'true'
        use_gameengine = 'true'
        use_openal = 'false'
        use_fmod = 'false'
        use_quicktime = 'false'
+       use_openexr = 'true'
        use_sumo = 'true'
        use_ode = 'false'
+       use_bullet = 'true'
        use_buildinfo = 'true'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
-       build_blender_player = 'true'
+       build_blender_player = 'false'
        build_blender_plugin = 'false'
        release_flags = ['-O2']
        debug_flags = ['-O2', '-g']
@@ -83,15 +96,25 @@ if sys.platform == 'linux2' or sys.platform == 'linux-i386':
        png_lib = ['png']
        png_libpath = ['/usr/lib']
        png_include = ['/usr/include']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['jpeg']
        jpeg_libpath = ['/usr/lib']
        jpeg_include = ['/usr/include']
+       #tiff library information
+       tiff_lib = ['tiff']
+       tiff_libpath = ['/usr/lib']
+       tiff_include = ['/usr/include']
        # OpenGL library information
        opengl_lib = ['GL', 'GLU']
        opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
        opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
-       opengl_include = ['/usr/include']
+       opengl_include = ['/usr/include', '/usr/X11R6/include']
        # SDL library information
        sdl_env.ParseConfig ('sdl-config --cflags --libs')
        sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
@@ -99,12 +122,16 @@ if sys.platform == 'linux2' or sys.platform == 'linux-i386':
        sdl_libpath = sdl_env.Dictionary()['LIBPATH']
        sdl_lib = sdl_env.Dictionary()['LIBS']
        # SOLID library information
-       solid_lib = []                                              # TODO
-       solid_libpath = []                                          # TODO
+       solid_lib = []
+       solid_libpath = []
        solid_include = ['#extern/solid']
-       qhull_lib = []                                              # TODO
-       qhull_libpath = []                                          # TODO
+       qhull_lib = []
+       qhull_libpath = []
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = ['ode']
        ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
@@ -115,9 +142,9 @@ if sys.platform == 'linux2' or sys.platform == 'linux-i386':
        python_include = [sysconfig.get_python_inc ()]
        python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
        # International support information
-       ftgl_lib = ['ftgl']
-       ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
-       ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
+       ftgl_lib = []
+       ftgl_libpath = []
+       ftgl_include = ['#extern/bFTGL/include']
        freetype_env.ParseConfig ('pkg-config --cflags --libs freetype2 2>/dev/null || freetype-config --cflags --libs 2>/dev/null')
        freetype_lib = freetype_env.Dictionary()['LIBS']
        freetype_libpath = freetype_env.Dictionary()['LIBPATH']
@@ -135,11 +162,15 @@ elif sys.platform == 'darwin':
        use_gameengine = 'true'
        use_openal = 'true'
        use_fmod = 'false'
+       use_openal = 'true'
        use_quicktime = 'true'
+       use_openexr = 'true'
        use_precomp = 'true'
        use_sumo = 'true'
        use_ode = 'false'
+       use_bullet = 'true'
        use_buildinfo = 'true'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'true'
@@ -153,7 +184,7 @@ elif sys.platform == 'darwin':
        fink_path = '/sw/'
        # TODO : try -mpowerpc -mpowerpc-gopt -mpowerpc-gfxopt optims
        #           doing actual profiling
-       extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-ffast-math', '-mpowerpc', '-mtune=G4'] 
+       extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-ffast-math', '-mpowerpc', '-mtune=G4']
        
        # , '-malign-natural'] malign is causing problems with jpeg lib but worth a 1-2% speedup
        #'-force_cpusubtype_ALL', '-mpowerpc-gpopt', 
@@ -175,23 +206,36 @@ elif sys.platform == 'darwin':
        png_lib = ['libpng']
        png_libpath = [darwin_precomp + 'png/lib']
        png_include = [darwin_precomp + 'png/include']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/local/lib']
+       openexr_include = ['/usr/local/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['libjpeg']
        jpeg_libpath = [darwin_precomp + 'jpeg/lib']
        jpeg_include = [darwin_precomp + 'jpeg/include']
+       # TIFF library information
+       tiff_lib = ['libtiff']
+       tiff_libpath = [darwin_precomp + 'tiff/lib']
+       tiff_include = [darwin_precomp + 'tiff/include']
        # OpenGL library information
        opengl_lib = ['GL', 'GLU']
        opengl_static = []
        opengl_libpath = []
        opengl_include = []
        # SDL specific stuff.
-       sdl_env.ParseConfig ('sdl-config --cflags --libs')
-       sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
+       #sdl_env.ParseConfig ('sdl-config --cflags --libs')
        # Want to use precompiled libraries?
        if use_precomp == 'true':
                sdl_include = [darwin_precomp + 'sdl/include']
                sdl_libpath = [darwin_precomp + 'sdl/lib']
                sdl_lib = ['libSDL.a']
+               sdl_cflags = [ '-I' + darwin_precomp + 'sdl/include' ]
+               sdl_env.Append (CCFLAGS = sdl_cflags )
+               sdl_env.Append (CPPPATH = [darwin_precomp + 'sdl/include'] )
+
        platform_libs = ['stdc++'] 
        extra_includes = ['/sw/include']
        platform_libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries']
@@ -203,6 +247,10 @@ elif sys.platform == 'darwin':
        qhull_lib = []                                          
        qhull_libpath = []                                          
        qhull_include = ['#/extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = ['libode']                                             
        ode_libpath = [darwin_precomp + 'ode/lib']                                          
@@ -221,11 +269,13 @@ elif sys.platform == 'darwin':
                                                '-framework', 'Python',
                                                '-framework', 'CoreServices',
                                                '-framework', 'Foundation',
-                                               '-framework', 'OpenGL']
+                                               '-framework', 'OpenGL',
+                                               '-framework', 'IOKit' , 
+                                               '-framework', 'AppKit']
        # International stuff
-       ftgl_lib = ['ftgl']
+       ftgl_lib = ['libftgl']
        ftgl_libpath = [darwin_precomp + 'ftgl/lib']
-       ftgl_include = [darwin_precomp + 'ftgl/include']
+       ftgl_include = ['#extern/bFTGL/include']
        freetype_lib = ['libfreetype']
        freetype_libpath = [darwin_precomp + 'freetype/lib']
        freetype_include = [darwin_precomp + 'freetype/include']
@@ -243,9 +293,12 @@ elif sys.platform == 'cygwin':
        use_openal = 'false'
        use_fmod = 'false'
        use_quicktime = 'false'
+       use_openexr = 'true'
        use_sumo = 'false'
        use_ode = 'false'
+       use_bullet = 'false'
        use_buildinfo = 'false'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'false'
@@ -271,10 +324,20 @@ elif sys.platform == 'cygwin':
        png_lib = ['png']
        png_libpath = ['#../lib/windows/png/lib']
        png_include = ['#../lib/windows/png/include']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['jpeg']
        jpeg_libpath = ['#../lib/windows/jpeg/lib']
        jpeg_include = ['#../lib/windows/jpeg/include']
+       # Tiff Library information
+       tiff_lib = ['libtiff']
+       tiff_libpath = ['#../lib/windows/tiff/lib']
+       tiff_include = ['#../lib/windows/tiff/include']
        # OpenGL library information
        opengl_lib = ['opengl32', 'glu32']
        opengl_static = []
@@ -287,12 +350,16 @@ elif sys.platform == 'cygwin':
        sdl_cflags = []
        #sdl_cflags = '-DWIN32'
        # SOLID library information
-       solid_lib = []                                                                                    # TODO
-       solid_libpath = []                                                                                # TODO
+       solid_lib = []
+       solid_libpath = []
        solid_include = ['#extern/solid']
-       qhull_lib = []                                                                                    # TODO
-       qhull_libpath = []                                                                                # TODO
+       qhull_lib = []
+       qhull_libpath = []
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = ['ode']
        ode_libpath = ['#../lib/windows/gcc/ode/lib']
@@ -303,9 +370,9 @@ elif sys.platform == 'cygwin':
        python_lib = ['python22']
        python_linkflags = []
        # International stuff
-       ftgl_lib = ['ftgl']
-       ftgl_libpath = ['#../lib/windows/gcc/ftgl/lib']
-       ftgl_include = ['#../lib/windows/gcc/ftgl/include']
+       ftgl_lib = []
+       ftgl_libpath = []
+       ftgl_include = ['#extern/bFTGL/include']
        freetype_lib = ['freetype']
        freetype_libpath = ['#../lib/windows/gcc/freetype/lib']
        freetype_include = ['#../lib/windows/gcc/freetype/include']
@@ -323,9 +390,12 @@ elif sys.platform == 'win32':
        use_openal = 'true'
        use_fmod = 'false'
        use_quicktime = 'true'
+       use_openexr = 'true'
+       use_bullet = 'true'
        use_sumo = 'true'
        use_ode = 'false'
        use_buildinfo = 'true'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'true'
@@ -335,15 +405,16 @@ elif sys.platform == 'win32':
        extra_flags = ['/EHsc', '/J', '/W3', '/Gd', '/MT']
        cxxflags = []
        defines = ['WIN32', '_CONSOLE']
-       defines += ['WITH_QUICKTIME']
+       if use_quicktime == 'true':
+               defines += ['WITH_QUICKTIME']
        defines += ['_LIB', 'USE_OPENAL']
        defines += ['FTGL_LIBRARY_STATIC']
        warn_flags = []
        platform_libs = [ 'qtmlClient', 'soundsystem',
                                         'ws2_32', 'dxguid', 'vfw32', 'winmm',
                                         'iconv', 'kernel32', 'user32', 'gdi32',
-                                        'winspool', 'comdlg32', 'advapi32', 'shell32',
-                                        'ole32', 'oleaut32', 'uuid', 'odbc32', 'odbccp32',
+                                        'comdlg32', 'advapi32', 'shell32',
+                                        'ole32', 'oleaut32', 'uuid', 
                                         'libcmt', 'libc']
        platform_libpath = ['#../lib/windows/iconv/lib',
                                                '#../lib/windows/QTDevWin/Libraries']
@@ -365,17 +436,27 @@ elif sys.platform == 'win32':
        if use_quicktime == 'true':
                extra_includes += ['#../lib/windows/QTDevWin/CIncludes']
        # z library information
-       z_lib = ['libz_st']
+       z_lib = ['zlib']
        z_libpath = ['#../lib/windows/zlib/lib']
        z_include = ['#../lib/windows/zlib/include']
        # png library information
        png_lib = ['libpng_st']
        png_libpath = ['#../lib/windows/png/lib']
        png_include = ['#../lib/windows/png/include']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['libjpeg']
        jpeg_libpath = ['#../lib/windows/jpeg/lib']
        jpeg_include = ['#../lib/windows/jpeg/include']
+       # Tiff Library information
+       tiff_lib = ['libtiff']
+       tiff_libpath = ['#../lib/windows/tiff/lib']
+       tiff_include = ['#../lib/windows/tiff/include']
        # OpenGL library information
        opengl_lib = ['opengl32', 'glu32']
        opengl_static = []
@@ -394,19 +475,23 @@ elif sys.platform == 'win32':
        qhull_lib = ['qhull']
        qhull_libpath = ['#../lib/windows/qhull/lib']
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = []                                                                                            # TODO
        ode_libpath = ['#../lib/windows/ode/lib']
        ode_include = ['#../lib/windows/ode/include']
        # Python lib name
-       python_include = ['#../lib/windows/python/include/python2.3']
+       python_include = ['#../lib/windows/python/include/python2.4']
        python_libpath = ['#../lib/windows/python/lib']
-       python_lib = ['python23']
+       python_lib = ['python24']
        python_linkflags = []
        # International stuff
-       ftgl_lib = ['ftgl_static_ST']
-       ftgl_libpath = ['#../lib/windows/ftgl/lib']
-       ftgl_include = ['#../lib/windows/ftgl/include']
+       ftgl_lib = []
+       ftgl_libpath = []
+       ftgl_include = ['#extern/bFTGL/include']
        freetype_lib = ['freetype2ST']
        freetype_libpath = ['#../lib/windows/freetype/lib']
        freetype_include = ['#../lib/windows/freetype/include']
@@ -424,9 +509,12 @@ elif string.find (sys.platform, 'sunos') != -1:
        use_openal = 'false'
        use_fmod = 'false'
        use_quicktime = 'false'
+       use_openexr = 'false'
        use_sumo = 'false'
        use_ode = 'false'
+       use_bullet = 'false'
        use_buildinfo = 'false'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'false'
@@ -450,6 +538,12 @@ elif string.find (sys.platform, 'sunos') != -1:
        png_lib = ['png']
        png_libpath = []
        png_include = []
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['jpeg']
        jpeg_libpath = []
@@ -466,25 +560,29 @@ elif string.find (sys.platform, 'sunos') != -1:
        sdl_libpath = sdl_env.Dictionary()['LIBPATH']
        sdl_lib = sdl_env.Dictionary()['LIBS']
        # SOLID library information
-       solid_lib = []                                                                                    # TODO
-       solid_libpath = []                                                                                # TODO
+       solid_lib = []
+       solid_libpath = []
        solid_include = ['#extern/solid']
-       qhull_lib = []                                                                                    # TODO
-       qhull_libpath = []                                                                                # TODO
+       qhull_lib = []
+       qhull_libpath = []
        qhull_include = ['#extern/qhull/include']
        # ODE library information
-       ode_lib = []                                                                                            # TODO
-       ode_libpath = []                                                                                        # TODO
+       ode_lib = []
+       ode_libpath = []
        ode_include = ['#extern/ode/dist/include/ode']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # Python variables.
        python_lib = ['python%d.%d' % sys.version_info[0:2]]
        python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
        python_include = [sysconfig.get_python_inc ()]
        python_linkflags = []
        # International support information
-       ftgl_lib = ['ftgl']
-       ftgl_libpath = ['#../lib/solaris-2.8-sparc/ftgl/lib']
-       ftgl_include = ['#../lib/solaris-2.8-sparc/ftgl/include']
+       ftgl_lib = []
+       ftgl_libpath = []
+       ftgl_include = ['#extern/bFTGL/include']
        freetype_lib = ['freetype']
        freetype_libpath = ['#../lib/solaris-2.8-sparc/freetype/lib']
        freetype_include = ['#../lib/solaris-2.8-sparc/freetype/include']
@@ -502,9 +600,12 @@ elif string.find (sys.platform, 'irix') != -1:
        use_openal = 'false'
        use_fmod = 'false'
        use_quicktime = 'false'
+       use_openexr = 'false'
        use_sumo = 'false'
        use_ode = 'false'
+       use_bullet = 'false'
        use_buildinfo = 'false'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'false'
@@ -536,6 +637,12 @@ elif string.find (sys.platform, 'irix') != -1:
        png_lib = ['png']
        png_libpath = [irix_precomp + '/png/lib']
        png_include = [irix_precomp + '/png/include']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['jpeg']
        jpeg_libpath = [irix_precomp + '/jpeg/lib']
@@ -551,15 +658,19 @@ elif string.find (sys.platform, 'irix') != -1:
        sdl_libpath = [irix_precomp + '/sdl/lib']
        sdl_lib = ['SDL', 'libSDL.a']
        # SOLID library information
-       solid_lib = []                                                                                    # TODO
-       solid_libpath = []                                                                                # TODO
+       solid_lib = []
+       solid_libpath = []
        solid_include = [irix_precomp + '/solid/include']
-       qhull_lib = []                                                                                    # TODO
-       qhull_libpath = []                                                                                # TODO
+       qhull_lib = []
+       qhull_libpath = []
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
-       ode_lib = []                                                                                            # TODO
-       ode_libpath = []                                                                                        # TODO
+       ode_lib = []
+       ode_libpath = []
        ode_include = [irix_precomp + '/ode/include']
        # Python library information
        python_libpath = [irix_precomp + '/python/lib/python2.2/config']
@@ -567,9 +678,9 @@ elif string.find (sys.platform, 'irix') != -1:
        python_lib = ['python2.2']
        python_linkflags = []
        # International support information
-       ftgl_lib = ['ftgl']
-       ftgl_libpath = [irix_precomp + '/ftgl/lib']
-       ftgl_include = [irix_precomp + '/ftgl/include']
+        ftgl_lib = []
+        ftgl_libpath = []
+        ftgl_include = ['#extern/bFTGL/include']
        freetype_lib = ['freetype']
        freetype_libpath = [irix_precomp + '/freetype/lib']
        freetype_include = [irix_precomp + '/freetype/include']
@@ -592,9 +703,12 @@ elif sys.platform=='openbsd3':
        use_openal = 'false'
        use_fmod = 'false'
        use_quicktime = 'false'
+       use_openexr = 'false'
        use_sumo = 'false'
        use_ode = 'false'
+       use_bullet = 'false'
        use_buildinfo = 'true'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'false'
@@ -616,7 +730,13 @@ elif sys.platform=='openbsd3':
        # png library information
        png_lib = ['png']
        png_libpath = ['/usr/local/lib']
-       png_include = ['/usr/local/include']
+       png_include = ['/usr/local/include/libpng']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['jpeg']
        jpeg_libpath = ['/usr/local/lib']
@@ -633,12 +753,16 @@ elif sys.platform=='openbsd3':
        sdl_libpath = sdl_env.Dictionary()['LIBPATH']
        sdl_lib = sdl_env.Dictionary()['LIBS']
        # SOLID library information
-       solid_lib = []                                   # TODO
-       solid_libpath = []              # TODO
+       solid_lib = []
+       solid_libpath = []
        solid_include = ['#extern/solid']
-       qhull_lib = []     # TODO
-       qhull_libpath = []  # TODO
+       qhull_lib = []
+       qhull_libpath = []
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = ['ode']
        ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
@@ -649,9 +773,9 @@ elif sys.platform=='openbsd3':
        python_include = [sysconfig.get_python_inc ()]
        python_linkflags = []
        # International support information
-       ftgl_lib = ['ftgl']
-       ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
-       ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
+        ftgl_lib = []
+        ftgl_libpath = []
+        ftgl_include = ['#extern/bFTGL/include']
        freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
        freetype_lib = freetype_env.Dictionary()['LIBS']
        freetype_libpath = freetype_env.Dictionary()['LIBPATH']
@@ -671,9 +795,12 @@ elif sys.platform=='freebsd4' or sys.platform=='freebsd5':
        use_openal = 'false'
        use_fmod = 'false'
        use_quicktime = 'false'
+       use_openexr = 'false'
        use_sumo = 'false'
        use_ode = 'false'
+       use_bullet = 'false'
        use_buildinfo = 'true'
+       use_fluidsim = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
        build_blender_player = 'false'
@@ -696,6 +823,12 @@ elif sys.platform=='freebsd4' or sys.platform=='freebsd5':
        png_lib = ['png']
        png_libpath = ['/usr/local/lib']
        png_include = ['/usr/local/include']
+       # OpenEXR library information
+       if use_openexr == 'true':
+               defines += ['WITH_OPENEXR']
+       openexr_lib = ['Iex', 'Half', 'IlmImf', 'Imath']
+       openexr_libpath = ['/usr/lib']
+       openexr_include = ['/usr/include/OpenEXR']
        # jpeg library information
        jpeg_lib = ['jpeg']
        jpeg_libpath = ['/usr/local/lib']
@@ -712,12 +845,16 @@ elif sys.platform=='freebsd4' or sys.platform=='freebsd5':
        sdl_libpath = ['/usr/local/include/SDL11']
        sdl_lib = sdl_env.Dictionary()['LIBS']
        # SOLID library information
-       solid_lib = []                                   # TODO
-       solid_libpath = []              # TODO
+       solid_lib = []
+       solid_libpath = []
        solid_include = ['#extern/solid']
-       qhull_lib = []     # TODO
-       qhull_libpath = []  # TODO
+       qhull_lib = []
+       qhull_libpath = []
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = ['ode']
        ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
@@ -728,9 +865,9 @@ elif sys.platform=='freebsd4' or sys.platform=='freebsd5':
        python_include = [sysconfig.get_python_inc ()]
        python_linkflags = []
        # International support information
-       ftgl_lib = ['ftgl']
-       ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
-       ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
+       ftgl_lib = []
+       ftgl_libpath = []
+       ftgl_include = ['#extern/bFTGL/include']
        freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
        freetype_lib = freetype_env.Dictionary()['LIBS']
        freetype_libpath = freetype_env.Dictionary()['LIBPATH']
@@ -786,11 +923,15 @@ else:
        config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
        if use_ode == 'true':
                config.write ("USE_PHYSICS = 'ode'\n")
+       elif (use_bullet == 'true') and (use_sumo == 'false'):
+               config.write("USE_PHYSICS = 'bullet'\n")
        else:
                config.write ("USE_PHYSICS = 'solid'\n")
        config.write ("USE_OPENAL = %r\n"%(use_openal))
        config.write ("USE_FMOD = %r\n"%(use_fmod))
        config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
+       config.write ("USE_OPENEXR = %r\n"%(use_openexr))
+       config.write ("USE_FLUIDSIM = %r\n"%(use_fluidsim))
        config.write ("\n# Compiler information.\n")
        config.write ("HOST_CC = %r\n"%(env_dict['CC']))
        config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
@@ -816,9 +957,15 @@ else:
        config.write ("PNG_INCLUDE = %r\n"%(png_include))
        config.write ("PNG_LIBPATH = %r\n"%(png_libpath))
        config.write ("PNG_LIBRARY = %r\n"%(png_lib))
+        config.write ("OPENEXR_INCLUDE = %r\n"%(openexr_include))
+        config.write ("OPENEXR_LIBPATH = %r\n"%(openexr_libpath))
+        config.write ("OPENEXR_LIBRARY = %r\n"%(openexr_lib))
        config.write ("JPEG_INCLUDE = %r\n"%(jpeg_include))
        config.write ("JPEG_LIBPATH = %r\n"%(jpeg_libpath))
        config.write ("JPEG_LIBRARY = %r\n"%(jpeg_lib))
+       config.write ("TIFF_INCLUDE = %r\n"%(tiff_include))
+       config.write ("TIFF_LIBPATH = %r\n"%(tiff_libpath))
+       config.write ("TIFF_LIBRARY = %r\n"%(tiff_lib))
        config.write ("OPENGL_INCLUDE = %r\n"%(opengl_include))
        config.write ("OPENGL_LIBPATH = %r\n"%(opengl_libpath))
        config.write ("OPENGL_LIBRARY = %r\n"%(opengl_lib))
@@ -834,6 +981,9 @@ else:
        config.write ("ODE_INCLUDE = %r\n"%(ode_include))
        config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
        config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
+       config.write ("BULLET_INCLUDE = %r\n"%(bullet_include))
+       config.write ("BULLET_LIBPATH = %r\n"%(bullet_libpath))
+       config.write ("BULLET_LIBRARY = %r\n"%(bullet_lib))
        config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
        config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
        config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
@@ -855,7 +1005,7 @@ else:
 #-----------------------------------------------------------------------------
 list_opts = []
 user_options = Options (bs_globals.config_file)
-user_options_env = Environment (options = user_options)
+user_options_env = Environment (ENV = os.environ, options = user_options)
 user_options.AddOptions (
                ('VERSION', 'Blender version', version),
                (EnumOption ('BUILD_BINARY', 'release',
@@ -883,7 +1033,7 @@ user_options.AddOptions (
                                        'false')),
                (EnumOption ('USE_PHYSICS', 'solid',
                                        'Select which physics engine to use.',
-                                       allowed_values = ('ode', 'solid'))),
+                                       allowed_values = ('ode', 'solid', 'bullet'))),
                (BoolOption ('BUILD_GAMEENGINE',
                                        'Set to 1 to build blender with game engine support.',
                                        'false')),
@@ -896,6 +1046,12 @@ user_options.AddOptions (
                (BoolOption ('USE_QUICKTIME',
                                        'Set to 1 to add support for QuickTime.',
                                        'false')),
+               (BoolOption ('USE_OPENEXR',
+                                        'Set to 1 to add support for OpenEXR.',
+                                        'false')),
+               (BoolOption ('USE_FLUIDSIM', # NT test new
+                                       'Set to 0 to disable compilation of fluid simulation library El\'Beem.',
+                                       'true')),
                ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
                ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
                ('TARGET_CC', 'C compiler for the target platform.'),
@@ -919,9 +1075,15 @@ user_options.AddOptions (
                ('PNG_INCLUDE', 'Include directory for png header files.'),
                ('PNG_LIBPATH', 'Library path where the png library is located.'),
                ('PNG_LIBRARY', 'png library name.'),
+                ('OPENEXR_INCLUDE', 'Include directory for OpenEXR header files.'),
+                ('OPENEXR_LIBPATH', 'Library path where the OpenEXR libraries are located.'),
+                ('OPENEXR_LIBRARY', 'OpenEXR library names.'),
                ('JPEG_INCLUDE', 'Include directory for jpeg header files.'),
                ('JPEG_LIBPATH', 'Library path where the jpeg library is located.'),
                ('JPEG_LIBRARY', 'jpeg library name.'),
+               ('TIFF_INCLUDE', 'Include directory for TIFF header files.'),
+               ('TIFF_LIBPATH', 'Library path where the TIFF library is located.'),
+               ('TIFF_LIBRARY', 'TIFF library name.'),
                ('OPENGL_INCLUDE', 'Include directory for OpenGL header files.'),
                ('OPENGL_LIBPATH', 'Library path where the OpenGL libraries are located.'),
                ('OPENGL_LIBRARY', 'OpenGL library names.'),
@@ -935,6 +1097,9 @@ user_options.AddOptions (
                ('ODE_INCLUDE', 'Include directory for ODE header files.'),
                ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
                ('ODE_LIBRARY', 'ODE library name.'),
+               ('BULLET_INCLUDE', 'Include directory for BULLET header files.'),
+               ('BULLET_LIBPATH', 'Library path where the BULLET library is located.'),
+               ('BULLET_LIBRARY', 'BULLET library name'),
                ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
                ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
                ('OPENAL_LIBRARY', 'OpenAL library name.'),
@@ -957,7 +1122,7 @@ user_options_dict = user_options_env.Dictionary()
 Help(user_options.GenerateHelpText(user_options_env))
 bs_globals.root_build_dir = user_options_dict['BUILD_DIR']
 # SET MODULE VARS #
-init_env = Environment()
+init_env = Environment(ENV = os.environ)
 
 bs_globals.user_options_dict = user_options_dict
 bs_globals.init_env = init_env
@@ -970,6 +1135,7 @@ bs_globals.config_guess = config_guess
 
 if user_options_dict['BUILD_GAMEENGINE'] == 1:
        defines += ['GAMEBLENDER=1']
+       defines += ['USE_BULLET']
        if user_options_dict['USE_PHYSICS'] == 'ode':
                defines += ['USE_ODE']
        else:
@@ -992,6 +1158,9 @@ platform_linkflags += user_options_dict['LDFLAGS']
 
 user_options_dict['PLATFORM_LINKFLAGS'] = platform_linkflags
 
+if user_options_dict['USE_FLUIDSIM'] == 0: # NT test new
+       use_fluidsim='false';
+
 #-----------------------------------------------------------------------------
 # Generic library generation environment. This one is the basis for each
 # library.
@@ -1017,6 +1186,8 @@ if bs_globals.enable_clean==0: # only read SConscripts when not cleaning, this t
        Export ('extra_includes')
        Export ('user_options_dict')
        Export ('library_env')
+       Export ('sdl_env')
+       Export ('use_fluidsim') # NT test
        
        BuildDir (bs_globals.root_build_dir+'/extern', 'extern', duplicate=0)
        SConscript (bs_globals.root_build_dir+'extern/SConscript')
@@ -1043,7 +1214,7 @@ def buildinfo(env, build_type):
                        build_info_file.write("char *build_date=\"%s\";\n"%build_date)
                        build_info_file.write("char *build_time=\"%s\";\n"%build_time)
                        build_info_file.write("char *build_platform=\"win32\";\n")
-                       build_info_file.write("char *build_type=\"%s\";\n"%build_type)
+                       build_info_file.write("char *build_type=\"dynamic\";\n")
                        build_info_file.close()
                        env.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
                else:
@@ -1099,7 +1270,7 @@ if bs_globals.enable_clean == 0:
        
        if sys.platform=='win32':
                if user_options_dict['BUILD_BINARY']=='debug':
-                       browser = Environment()
+                       browser = Environment(ENV = os.environ)
                        browser_tmp = bs_globals.root_build_dir+'bscmake.tmp'
                        browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
                                ['dir /b/s '+bs_globals.root_build_dir+'*.sbr >'+browser_tmp,
@@ -1127,7 +1298,7 @@ if bs_globals.enable_clean == 0:
                        player_blender.Program (target='blenderplayer', source=d_obj)
                if sys.platform=='win32':
                        if user_options_dict['BUILD_BINARY']=='debug':
-                               browser = Environment()
+                               browser = Environment(ENV = os.environ)
                                browser_tmp = bs_globals.root_build_dir+'bscmake.tmp'
                                browser.Command ('blenderplayer.bsc', 'blenderplayer$PROGSUFFIX',
                                ['dir /b/s '+bs_globals.root_build_dir+'*.sbr >'+browser_tmp,