scons: Revamp how to specify targets to build.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 1 Nov 2010 13:30:22 +0000 (13:30 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 1 Nov 2010 13:30:22 +0000 (13:30 +0000)
Use scons target and dependency system instead of ad-hoc options.

Now is simply a matter of naming what to build. For example:

  scons libgl-xlib

  scons libgl-gdi

  scons graw-progs

  scons llvmpipe

and so on. And there is also the possibility of scepcified subdirs, e.g.

  scons src/gallium/drivers

If nothing is specified then everything will be build.

There might be some rough corners over the next days. Please bare with me.

48 files changed:
SConstruct
common.py
scons/gallium.py
scons/llvm.py
scons/udis86.py
scons/x11.py
src/SConscript
src/egl/main/SConscript
src/egl/main/eglconfig.h
src/gallium/SConscript
src/gallium/auxiliary/SConscript
src/gallium/drivers/i915/SConscript
src/gallium/drivers/i965/SConscript
src/gallium/drivers/llvmpipe/README
src/gallium/drivers/llvmpipe/SConscript
src/gallium/drivers/rbug/README
src/gallium/drivers/softpipe/SConscript
src/gallium/drivers/sw/SConscript
src/gallium/drivers/trace/README
src/gallium/state_trackers/egl/SConscript
src/gallium/state_trackers/glx/xlib/SConscript
src/gallium/state_trackers/python/SConscript
src/gallium/state_trackers/vega/SConscript
src/gallium/state_trackers/xorg/SConscript
src/gallium/targets/SConscript [deleted file]
src/gallium/targets/SConscript.dri
src/gallium/targets/dri-i915/SConscript
src/gallium/targets/dri-i965/SConscript
src/gallium/targets/dri-r300/SConscript
src/gallium/targets/dri-r600/SConscript
src/gallium/targets/dri-swrast/SConscript
src/gallium/targets/dri-vmwgfx/SConscript
src/gallium/targets/egl-gdi/SConscript
src/gallium/targets/graw-null/SConscript
src/gallium/targets/graw-null/graw_null.c
src/gallium/targets/graw-null/graw_util.c [new file with mode: 0644]
src/gallium/targets/graw-xlib/SConscript
src/gallium/targets/graw-xlib/graw_util.c [deleted file]
src/gallium/targets/libgl-gdi/SConscript
src/gallium/targets/libgl-xlib/SConscript
src/gallium/targets/xorg-vmwgfx/SConscript
src/gallium/tests/graw/SConscript
src/gallium/tests/unit/SConscript
src/gallium/winsys/SConscript
src/glut/glx/SConscript
src/mapi/glapi/SConscript
src/mapi/vgapi/.gitignore [new file with mode: 0644]
src/mesa/SConscript

index 558ebf90aaa03673f92825bd6384fc8e6655ed5b..c6198041fb0cff49b695423ac5eaece4fe2217ab 100644 (file)
@@ -3,14 +3,14 @@
 #
 # For example, invoke scons as 
 #
-#   scons debug=1 dri=0 machine=x86
+#   scons build=debug llvm=yes machine=x86
 #
 # to set configuration variables. Or you can write those options to a file
 # named config.py:
 #
 #   # config.py
-#   debug=1
-#   dri=0
+#   build='debug'
+#   llvm=True
 #   machine='x86'
 # 
 # Invoke
@@ -30,54 +30,8 @@ import common
 #######################################################################
 # Configuration options
 
-default_statetrackers = 'mesa'
-default_targets = 'graw-null'
-
-if common.default_platform in ('linux', 'freebsd', 'darwin'):
-       default_drivers = 'softpipe,galahad,failover,svga,i915,i965,trace,identity,llvmpipe'
-       default_winsys = 'xlib'
-elif common.default_platform in ('winddk',):
-       default_drivers = 'softpipe,svga,i915,i965,trace,identity'
-       default_winsys = 'all'
-elif common.default_platform in ('embedded',):
-       default_drivers = 'softpipe,llvmpipe'
-       default_winsys = 'xlib'
-else:
-       default_drivers = 'all'
-       default_winsys = 'all'
-
 opts = Variables('config.py')
 common.AddOptions(opts)
-opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
-                     ['mesa', 'python', 'xorg', 'egl']))
-opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
-                     ['softpipe', 'galahad', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
-opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
-                     ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'r600', 'graw-xlib']))
-
-opts.Add(ListVariable('targets', 'driver targets to build', default_targets,
-                     ['dri-i915',
-                      'dri-i965',
-                      'dri-nouveau',
-                      'dri-radeong',
-                      'dri-swrast',
-                      'dri-vmwgfx',
-                      'egl-i915',
-                      'egl-i965',
-                      'egl-nouveau',
-                      'egl-radeon',
-                      'egl-swrast',
-                      'egl-vmwgfx',
-                      'graw-xlib',
-                      'graw-null',
-                      'libgl-gdi',
-                      'libgl-xlib',
-                      'xorg-i915',
-                      'xorg-i965',
-                      'xorg-nouveau',
-                      'xorg-radeon',
-                      'xorg-vmwgfx']))
-
 opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
 
 env = Environment(
@@ -87,61 +41,26 @@ env = Environment(
        ENV = os.environ,
 )
 
-if os.environ.has_key('CC'):
-       env['CC'] = os.environ['CC']
-if os.environ.has_key('CFLAGS'):
-       env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
-if os.environ.has_key('CXX'):
-       env['CXX'] = os.environ['CXX']
-if os.environ.has_key('CXXFLAGS'):
-       env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
-if os.environ.has_key('LDFLAGS'):
-       env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
+# Backwards compatability with old target configuration variable
+try:
+    targets = ARGUMENTS['targets']
+except KeyError:
+    pass
+else:
+    targets = targets.split(',')
+    print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
+    print
+    print '  scons %s' % ' '.join(targets)
+    print 
+    COMMAND_LINE_TARGETS.append(targets)
 
-Help(opts.GenerateHelpText(env))
 
-# replicate options values in local variables
-debug = env['debug']
-dri = env['dri']
-machine = env['machine']
-platform = env['platform']
-
-# derived options
-x86 = machine == 'x86'
-ppc = machine == 'ppc'
-gcc = platform in ('linux', 'freebsd', 'darwin', 'embedded')
-msvc = platform in ('windows', 'winddk')
-
-Export([
-       'debug', 
-       'x86', 
-       'ppc', 
-       'dri', 
-       'platform',
-       'gcc',
-       'msvc',
-])
+Help(opts.GenerateHelpText(env))
 
 
 #######################################################################
 # Environment setup
 
-# Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
-if 'trace' not in env['drivers']:
-    env['drivers'].append('trace')
-if 'rbug' not in env['drivers']:
-    env['drivers'].append('rbug')
-if 'galahad' not in env['drivers']:
-    env['drivers'].append('galahad')
-if 'identity' not in env['drivers']:
-    env['drivers'].append('identity')
-if 'softpipe' not in env['drivers']:
-    env['drivers'].append('softpipe')
-if env['llvm'] and 'llvmpipe' not in env['drivers']:
-    env['drivers'].append('llvmpipe')
-if 'sw' not in env['drivers']:
-    env['drivers'].append('sw')
-
 # Includes
 env.Prepend(CPPPATH = [
        '#/include',
@@ -157,7 +76,7 @@ if env['msvc']:
     env.Append(CPPPATH = ['#include/c99'])
 
 # Embedded
-if platform == 'embedded':
+if env['platform'] == 'embedded':
        env.Append(CPPDEFINES = [
                '_POSIX_SOURCE',
                ('_POSIX_C_SOURCE', '199309L'), 
@@ -174,7 +93,7 @@ if platform == 'embedded':
        ])
 
 # Posix
-if platform in ('posix', 'linux', 'freebsd', 'darwin'):
+if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
        env.Append(CPPDEFINES = [
                '_POSIX_SOURCE',
                ('_POSIX_C_SOURCE', '199309L'), 
@@ -184,9 +103,9 @@ if platform in ('posix', 'linux', 'freebsd', 'darwin'):
                'PTHREADS',
                'HAVE_POSIX_MEMALIGN',
        ])
-       if gcc:
+       if env['gcc']:
                env.Append(CFLAGS = ['-fvisibility=hidden'])
-       if platform == 'darwin':
+       if env['platform'] == 'darwin':
                env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
        env.Append(LIBS = [
                'm',
@@ -212,5 +131,3 @@ SConscript(
        duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
 )
 
-env.Default('src')
-
index 13e8dc83e978bbcd2df2b3b92d38d977be7ecd51..b7749c925dfc3db0d7734cdd0462edc5016e15bd 100644 (file)
--- a/common.py
+++ b/common.py
@@ -8,6 +8,8 @@ import subprocess
 import sys
 import platform as _platform
 
+import SCons.Script.SConscript
+
 
 #######################################################################
 # Defaults
@@ -20,6 +22,15 @@ _platform_map = {
 default_platform = sys.platform
 default_platform = _platform_map.get(default_platform, default_platform)
 
+# Search sys.argv[] for a "platform=foo" argument since we don't have
+# an 'env' variable at this point.
+if 'platform' in SCons.Script.ARGUMENTS:
+    selected_platform = SCons.Script.ARGUMENTS['platform']
+else:
+    selected_platform = default_platform
+
+cross_compiling = selected_platform != default_platform
+
 _machine_map = {
        'x86': 'x86',
        'i386': 'x86',
@@ -37,38 +48,26 @@ if 'PROCESSOR_ARCHITECTURE' in os.environ:
 else:
        default_machine = _platform.machine()
 default_machine = _machine_map.get(default_machine, 'generic')
+default_toolchain = 'default'
+
+if selected_platform == 'windows' and cross_compiling:
+    default_machine = 'x86'
+    default_toolchain = 'crossmingw'
 
 
 # find default_llvm value
 if 'LLVM' in os.environ:
     default_llvm = 'yes'
 else:
-    # Search sys.argv[] for a "platform=foo" argument since we don't have
-    # an 'env' variable at this point.
-    platform = default_platform
-    pattern = re.compile("(platform=)(.*)")
-    for arg in sys.argv:
-        m = pattern.match(arg)
-        if m:
-            platform = m.group(2)
-
     default_llvm = 'no'
     try:
-        if platform != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
+        if selected_platform != 'windows' and \
+           subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
             default_llvm = 'yes'
     except:
         pass
 
 
-# find default_dri value
-if default_platform in ('linux', 'freebsd'):
-       default_dri = 'yes'
-elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
-       default_dri = 'no'
-else:
-       default_dri = 'no'
-
-
 #######################################################################
 # Common options
 
@@ -88,8 +87,7 @@ def AddOptions(opts):
                                                                                         allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
        opts.Add(EnumOption('platform', 'target platform', default_platform,
                                                                                         allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
-       opts.Add('toolchain', 'compiler toolchain', 'default')
+       opts.Add('toolchain', 'compiler toolchain', default_toolchain)
        opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
-       opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
        opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
        opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
index b065b7bc49fca8b8600bd04a6e482fec0c10d238..194b1524e6c702fc4b15d01bb5e5eda86374a6de 100644 (file)
@@ -98,6 +98,38 @@ def num_jobs():
     return 1
 
 
+def pkg_config_modules(env, name, modules):
+    '''Simple wrapper for pkg-config.'''
+
+    env[name] = False
+
+    if env['platform'] == 'windows':
+        return
+
+    if not env.Detect('pkg-config'):
+        return
+
+    # Put -I and -L flags directly into the environment, as these don't affect
+    # the compilation of targets that do not use them
+    try:
+        env.ParseConfig('pkg-config --cflags-only-I --libs-only-L ' + ' '.join(modules))
+    except OSError:
+        return
+
+    # Other flags may affect the compilation of unrelated targets, so store
+    # them with a prefix, (e.g., XXX_CFLAGS, XXX_LIBS, etc)
+    try:
+        flags = env.ParseFlags('!pkg-config --cflags-only-other --libs-only-l --libs-only-other ' + ' '.join(modules))
+    except OSError:
+        return
+    prefix = name.upper() + '_'
+    for flag_name, flag_value in flags.iteritems():
+        env[prefix + flag_name] = flag_value
+
+    env[name] = True
+
+
+
 def generate(env):
     """Common environment generation code"""
 
@@ -110,21 +142,27 @@ def generate(env):
             env['toolchain'] = 'wcesdk'
     env.Tool(env['toolchain'])
 
-    if env['platform'] == 'embedded':
-        # Allow overriding compiler from environment
-        if os.environ.has_key('CC'):
-            env['CC'] = os.environ['CC']
-            # Update CCVERSION to match
-            pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
-                                         stdin = 'devnull',
-                                         stderr = 'devnull',
-                                         stdout = subprocess.PIPE)
-            if pipe.wait() == 0:
-                line = pipe.stdout.readline()
-                match = re.search(r'[0-9]+(\.[0-9]+)+', line)
-                if match:
-                    env['CCVERSION'] = match.group(0)
-            
+    # Allow override compiler and specify additional flags from environment
+    if os.environ.has_key('CC'):
+        env['CC'] = os.environ['CC']
+        # Update CCVERSION to match
+        pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
+                                     stdin = 'devnull',
+                                     stderr = 'devnull',
+                                     stdout = subprocess.PIPE)
+        if pipe.wait() == 0:
+            line = pipe.stdout.readline()
+            match = re.search(r'[0-9]+(\.[0-9]+)+', line)
+            if match:
+                env['CCVERSION'] = match.group(0)
+    if os.environ.has_key('CFLAGS'):
+        env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
+    if os.environ.has_key('CXX'):
+        env['CXX'] = os.environ['CXX']
+    if os.environ.has_key('CXXFLAGS'):
+        env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
+    if os.environ.has_key('LDFLAGS'):
+        env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
 
     env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
     env['msvc'] = env['CC'] == 'cl'
@@ -140,10 +178,16 @@ def generate(env):
     # Backwards compatability with the debug= profile= options
     if env['build'] == 'debug':
         if not env['debug']:
-            print 'scons: debug option is deprecated: use instead build=release'
+            print 'scons: warning: debug option is deprecated and will be removed eventually; use instead'
+            print
+            print ' scons build=release'
+            print
             env['build'] = 'release'
         if env['profile']:
-            print 'scons: profile option is deprecated: use instead build=profile'
+            print 'scons: warning: profile option is deprecated and will be removed eventually; use instead'
+            print
+            print ' scons build=profile'
+            print
             env['build'] = 'profile'
     if False:
         # Enforce SConscripts to use the new build variable
@@ -184,6 +228,9 @@ def generate(env):
     if env.GetOption('num_jobs') <= 1:
         env.SetOption('num_jobs', num_jobs())
 
+    env.Decider('MD5-timestamp')
+    env.SetOption('max_drift', 60)
+
     # C preprocessor options
     cppdefines = []
     if env['build'] in ('debug', 'checked'):
@@ -499,9 +546,14 @@ def generate(env):
     # Default libs
     env.Append(LIBS = [])
 
-    # Load LLVM
+    # Load tools
     if env['llvm']:
         env.Tool('llvm')
+        env.Tool('udis86')
+    
+    pkg_config_modules(env, 'x11', ['x11', 'xext'])
+    pkg_config_modules(env, 'dri', ['libdrm'])
+    pkg_config_modules(env, 'xorg', ['xorg-server'])
 
     # Custom builders and methods
     env.Tool('custom')
index 39fbb910b6d55685271cc39e392a11d7de05fac5..1b033acb1b3f50d848de1fc694da9e2cdb903719 100644 (file)
@@ -38,6 +38,8 @@ import SCons.Util
 
 
 def generate(env):
+    env['llvm'] = False
+
     try:
         llvm_dir = os.environ['LLVM']
     except KeyError:
@@ -64,13 +66,13 @@ def generate(env):
         # XXX: There is no llvm-config on Windows, so assume a standard layout
         if llvm_dir is None:
             print 'scons: LLVM environment variable must be specified when building for windows'
-            env.Exit(1)
+            return
 
         # Try to determine the LLVM version from llvm/Config/config.h
         llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
         if not os.path.exists(llvm_config):
             print 'scons: could not find %s' % llvm_config
-            env.Exit(1)
+            return
         llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
         llvm_version = None
         for line in open(llvm_config, 'rt'):
@@ -81,7 +83,7 @@ def generate(env):
                 break
         if llvm_version is None:
             print 'scons: could not determine the LLVM version from %s' % llvm_config
-            env.Exit(1)
+            return
 
         env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
         env.AppendUnique(CPPDEFINES = [
@@ -133,7 +135,7 @@ def generate(env):
     else:
         if not env.Detect('llvm-config'):
             print 'scons: llvm-config script not found' % llvm_version
-            env.Exit(1)
+            return
 
         llvm_version = env.backtick('llvm-config --version').rstrip()
         llvm_version = distutils.version.LooseVersion(llvm_version)
@@ -144,11 +146,12 @@ def generate(env):
             env.ParseConfig('llvm-config --ldflags')
         except OSError:
             print 'scons: llvm-config version %s failed' % llvm_version
-            env.Exit(1)
+            return
         else:
             env['LINK'] = env['CXX']
 
     assert llvm_version is not None
+    env['llvm'] = True
 
     print 'scons: Found LLVM version %s' % llvm_version
     env['LLVM_VERSION'] = llvm_version
index ba71d4eb0b801da7d0211c9d38a1e2915ccd065e..bb91d3c35cf6e7febf646b2430fd29930f30128d 100644 (file)
@@ -31,8 +31,10 @@ def generate(env):
     conf = env.Configure()
 
     if conf.CheckHeader('udis86.h'): # and conf.CheckLib('udis86'):
-        env.Append(CPPDEFINES = [('HAVE_UDIS86', '1')])
+        env['UDIS86'] = True
         env.Prepend(LIBS = ['udis86'])
+    else:
+        env['UDIS86'] = False
 
     conf.Finish()
 
index 99bf079626e68e516ef12965fe2c25d9bd5ec85b..7368618f3bb5b437316bdd5bbdc84e3153f41a7a 100644 (file)
@@ -29,24 +29,12 @@ Tool-specific initialization for X11
 
 
 def generate(env):
-    env.Append(CPPPATH = ['/usr/X11R6/include'])
-    env.Append(LIBPATH = ['/usr/X11R6/lib'])
-
-    env.Append(LIBS = [
-        'X11',
-        'Xext',
-        'Xxf86vm',
-        'Xdamage',
-        'Xfixes',
-    ])
+    # XXX: backwards compatability only
+    pass
 
 
 def exists(env):
-    # TODO: actually detect the presence of the headers
-    if env['platform'] in ('linux', 'freebsd', 'darwin'):
-        return True
-    else:
-        return False
+    return True
 
 
 # vim:set ts=4 sw=4 et:
index c3e34be6f760f020ad2b797d6d937fcd98da21e4..c42d9bff2d7fcd36f90be02985f7f5987c7a6ca2 100644 (file)
@@ -1,19 +1,17 @@
 Import('*')
 
-if 'egl' in env['statetrackers']:
-    SConscript('mapi/vgapi/SConscript')
-    SConscript('egl/main/SConscript')
+SConscript('mapi/vgapi/SConscript')
 
-if 'mesa' in env['statetrackers']:
-    if platform == 'windows':
-        SConscript('talloc/SConscript')
+if env['platform'] == 'windows':
+    SConscript('egl/main/SConscript')
+    SConscript('talloc/SConscript')
 
-    SConscript('glsl/SConscript')
-    SConscript('mapi/glapi/SConscript')
-    SConscript('mesa/SConscript')
+SConscript('glsl/SConscript')
+SConscript('mapi/glapi/SConscript')
+SConscript('mesa/SConscript')
 
-    if platform != 'embedded':
-        SConscript('glut/glx/SConscript')
+if env['platform'] != 'embedded':
+    SConscript('glut/glx/SConscript')
 
 SConscript('gallium/SConscript')
 
index 8ade85b35722dfc2e8f906d1a53b5937d9acd8f9..f001b81600fdcdcde9db8dabf1b58f0642a06a64 100644 (file)
@@ -4,49 +4,49 @@
 
 Import('*')
 
-if env['platform'] != 'winddk':
-
-       env = env.Clone()
-
-       env.Append(CPPDEFINES = [
-               '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
-               '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
-               '_EGL_OS_WINDOWS',
-               '_EGL_GET_CORE_ADDRESSES',
-               'KHRONOS_DLL_EXPORTS',
-       ])
-
-       env.Append(CPPPATH = [
-               '#/include',
-       ])
-
-       egl_sources = [
-               'eglapi.c',
-               'eglarray.c',
-               'eglconfig.c',
-               'eglcontext.c',
-               'eglcurrent.c',
-               'egldisplay.c',
-               'egldriver.c',
-               'eglfallbacks.c',
-               'eglglobals.c',
-               'eglimage.c',
-               'egllog.c',
-               'eglmisc.c',
-               'eglmode.c',
-               'eglscreen.c',
-               'eglstring.c',
-               'eglsurface.c',
-               'eglsync.c',
-       ]
-
-       egl = env.SharedLibrary(
-               target = 'libEGL',
-               source = egl_sources + ['egl.def'],
-       )
-
-       env.InstallSharedLibrary(egl, version=(1, 4, 0))
-
-       egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
-
-       Export('egl')
+env = env.Clone()
+
+env.Append(CPPDEFINES = [
+    '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+    '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
+    '_EGL_OS_WINDOWS',
+    '_EGL_GET_CORE_ADDRESSES',
+    'KHRONOS_DLL_EXPORTS',
+])
+
+env.Append(CPPPATH = [
+    '#/include',
+])
+
+egl_sources = [
+    'eglapi.c',
+    'eglarray.c',
+    'eglconfig.c',
+    'eglcontext.c',
+    'eglcurrent.c',
+    'egldisplay.c',
+    'egldriver.c',
+    'eglfallbacks.c',
+    'eglglobals.c',
+    'eglimage.c',
+    'egllog.c',
+    'eglmisc.c',
+    'eglmode.c',
+    'eglscreen.c',
+    'eglstring.c',
+    'eglsurface.c',
+    'eglsync.c',
+]
+
+egl = env.SharedLibrary(
+    target = 'libEGL',
+    source = egl_sources + ['egl.def'],
+)
+
+installed_egl = env.InstallSharedLibrary(egl, version=(1, 4, 0))
+
+env.Alias('egl', installed_egl)
+
+egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
+
+Export('egl')
index 3457670bfa5622cd39c1a97cd0ac79ff665590e9..2169960fd1df478849ed92ed6e64066189fc64d2 100644 (file)
@@ -3,6 +3,7 @@
 
 
 #include <assert.h>
+#include <stddef.h>
 #include "egltypedefs.h"
 
 
index 3c171552bed1b613e1466707de7fce999a7be26b..76f9ffb58ab32f8726e1aa248a4399fb66fc944c 100644 (file)
-import os
+Import('env')
 
-Import('*')
+# 
+# Auxiliary modules
+#
 
 SConscript('auxiliary/SConscript')
 
-for driver in env['drivers']:
-       SConscript(os.path.join('drivers', driver, 'SConscript'))
+#
+# Drivers
+#
+
+SConscript([
+    'drivers/failover/SConscript', 
+    'drivers/galahad/SConscript',
+    'drivers/i915/SConscript', 
+    'drivers/i965/SConscript', 
+    'drivers/identity/SConscript', 
+    'drivers/llvmpipe/SConscript', 
+    'drivers/rbug/SConscript',
+    'drivers/r300/SConscript', 
+    'drivers/softpipe/SConscript',
+    'drivers/svga/SConscript', 
+    'drivers/trace/SConscript', 
+])
+
+if env['dri']:
+    # These drivers depend on drm headers
+    SConscript([
+        # XXX: nouveau drivers have a tight dependency on libdrm, so to enable
+        # we need some version logic before we enable them. Also, ATM there is
+        # no nouveau target in scons
+        #'drivers/nouveau/SConscript', 
+        #'drivers/nv50/SConscript', 
+        #'drivers/nvfx/SConscript',
+        'drivers/r600/SConscript', 
+    ])
+
+#
+# State trackers
+#
 
 # Needed by some state trackers
 SConscript('winsys/sw/null/SConscript')
 
 SConscript('state_trackers/python/SConscript')
-if platform != 'embedded':
+if env['platform'] != 'embedded':
        SConscript('state_trackers/glx/xlib/SConscript')
        SConscript('state_trackers/dri/SConscript')
        SConscript('state_trackers/xorg/SConscript')
        SConscript('state_trackers/egl/SConscript')
        SConscript('state_trackers/vega/SConscript')
 
-if platform == 'windows':
+if env['platform'] == 'windows':
        SConscript('state_trackers/wgl/SConscript')
 
+#
+# Winsys
+# 
+
 SConscript('winsys/SConscript')
 
-SConscript('targets/SConscript')
+#
+# Targets
+#
+
+SConscript([
+    'targets/graw-null/SConscript',
+])
+
+if env['x11']:
+    SConscript([
+        'targets/graw-xlib/SConscript',
+        'targets/libgl-xlib/SConscript',
+    ])
 
-if platform != 'embedded':
+if env['platform'] == 'windows':
+    SConscript([
+        'targets/libgl-gdi/SConscript',
+        #'egl-gdi/SConscript',
+    ])
+
+if env['dri']:
+    SConscript([
+        'targets/SConscript.dri',
+           'targets/dri-i915/SConscript',
+           'targets/dri-i965/SConscript',
+           #'targets/dri-nouveau/SConscript',
+           'targets/dri-r300/SConscript',
+        'targets/dri-r600/SConscript',
+           'targets/dri-swrast/SConscript',
+           'targets/dri-vmwgfx/SConscript',
+    ])
+
+if env['xorg']:
+    SConscript([
+        #'targets/xorg-i915/SConscript',
+        #'targets/xorg-i965/SConscript',
+        #'targets/xorg-nouveau/SConscript',
+        #'targets/xorg-radeon/SConscript',
+        'targets/xorg-vmwgfx/SConscript',
+    ])
+
+
+#
+# Unit tests & tools
+#
+
+if env['platform'] != 'embedded':
        SConscript('tests/unit/SConscript')
        SConscript('tests/graw/SConscript')
+
index 94cd74424a07133115e380f99feb12df365b7084..0e5da1374ff18576d508cf303d3de7d7d2ed7413 100644 (file)
@@ -7,8 +7,6 @@ env.Append(CPPPATH = [
     'util',
 ])
 
-env.Tool('udis86')
-
 env.CodeGenerate(
     target = 'indices/u_indices_gen.c', 
     script = 'indices/u_indices_gen.py', 
@@ -202,39 +200,42 @@ source = [
 ]
 
 if env['llvm']:
+    if env['UDIS86']:
+        env.Append(CPPDEFINES = [('HAVE_UDIS86', '1')])
+
     source += [
-    'gallivm/lp_bld_arit.c',
-    'gallivm/lp_bld_assert.c',
-    'gallivm/lp_bld_bitarit.c',
-    'gallivm/lp_bld_const.c',
-    'gallivm/lp_bld_conv.c',
-    'gallivm/lp_bld_debug.c',
-    'gallivm/lp_bld_flow.c',
-    'gallivm/lp_bld_format_aos.c',
-    'gallivm/lp_bld_format_soa.c',
-    'gallivm/lp_bld_format_yuv.c',
-    'gallivm/lp_bld_gather.c',
-    'gallivm/lp_bld_init.c',
-    'gallivm/lp_bld_intr.c',
-    'gallivm/lp_bld_logic.c',
-    'gallivm/lp_bld_misc.cpp',
-    'gallivm/lp_bld_pack.c',
-    'gallivm/lp_bld_printf.c',
-    'gallivm/lp_bld_quad.c',
-    'gallivm/lp_bld_sample.c',
-    'gallivm/lp_bld_sample_aos.c',
-    'gallivm/lp_bld_sample_soa.c',
-    'gallivm/lp_bld_struct.c',
-    'gallivm/lp_bld_swizzle.c',
-    'gallivm/lp_bld_tgsi_aos.c',
-    'gallivm/lp_bld_tgsi_info.c',
-    'gallivm/lp_bld_tgsi_soa.c',
-    'gallivm/lp_bld_type.c',
-    'draw/draw_llvm.c',
-    'draw/draw_llvm_sample.c',
-    'draw/draw_llvm_translate.c',
-    'draw/draw_pt_fetch_shade_pipeline_llvm.c',
-    'draw/draw_vs_llvm.c'
+        'gallivm/lp_bld_arit.c',
+        'gallivm/lp_bld_assert.c',
+        'gallivm/lp_bld_bitarit.c',
+        'gallivm/lp_bld_const.c',
+        'gallivm/lp_bld_conv.c',
+        'gallivm/lp_bld_debug.c',
+        'gallivm/lp_bld_flow.c',
+        'gallivm/lp_bld_format_aos.c',
+        'gallivm/lp_bld_format_soa.c',
+        'gallivm/lp_bld_format_yuv.c',
+        'gallivm/lp_bld_gather.c',
+        'gallivm/lp_bld_init.c',
+        'gallivm/lp_bld_intr.c',
+        'gallivm/lp_bld_logic.c',
+        'gallivm/lp_bld_misc.cpp',
+        'gallivm/lp_bld_pack.c',
+        'gallivm/lp_bld_printf.c',
+        'gallivm/lp_bld_quad.c',
+        'gallivm/lp_bld_sample.c',
+        'gallivm/lp_bld_sample_aos.c',
+        'gallivm/lp_bld_sample_soa.c',
+        'gallivm/lp_bld_struct.c',
+        'gallivm/lp_bld_swizzle.c',
+        'gallivm/lp_bld_tgsi_aos.c',
+        'gallivm/lp_bld_tgsi_info.c',
+        'gallivm/lp_bld_tgsi_soa.c',
+        'gallivm/lp_bld_type.c',
+        'draw/draw_llvm.c',
+        'draw/draw_llvm_sample.c',
+        'draw/draw_llvm_translate.c',
+        'draw/draw_pt_fetch_shade_pipeline_llvm.c',
+        'draw/draw_vs_llvm.c'
     ]
 
 gallium = env.ConvenienceLibrary(
@@ -242,4 +243,6 @@ gallium = env.ConvenienceLibrary(
     source = source,
 )
 
+env.Alias('gallium', gallium)
+
 Export('gallium')
index d4bf6fef13425c9eab8e0a23dda0d557904f8822..1197bbf9620f925575fdfefa7dfecdf1d796ec6f 100644 (file)
@@ -2,7 +2,7 @@ Import('*')
 
 env = env.Clone()
 
-if msvc:
+if env['msvc']:
        print 'warning: not building i915g'
        Return()
 
index 119f914a16dcbc687c27fa17a9f401b95c5f1341..198275b655c84e8a4cb73a0201b4daf22fa0f6f5 100644 (file)
@@ -2,7 +2,7 @@ Import('*')
 
 env = env.Clone()
 
-if msvc:
+if env['msvc']:
        print 'warning: not building i965g'
        Return();
 
index ec30d4d70840eaa26be10adc5f38c27f6a0e8b3a..e9374cc6efac41ff2ba0ff505d3b91682507bacd 100644 (file)
@@ -1,53 +1,6 @@
 LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
 
 
-Status
-======
-
-Done so far is:
-
- - the whole fragment pipeline is code generated in a single function
-   - input interpolation
-   
-   - depth testing
-   - texture sampling
-     - 1D/2D/3D/cube maps supported
-     - all texture wrap modes supported
-     - all texture filtering modes supported
-     - perhaps not all texture formats yet supported
-   
-   - fragment shader TGSI translation
-     - same level of support as the TGSI SSE2 exec machine, with the exception
-       we don't fallback to TGSI interpretation when an unsupported opcode is
-       found, but just ignore it
-     - done in SoA layout
-     - input interpolation also code generated
-   - alpha testing
-   - blend (including logic ops)
-     - both in SoA and AoS layouts, but only the former used for now
- - code is generic
-   - intermediates can be vectors of floats, ubytes, fixed point, etc, and of
-     any width and length
-   - not all operations are implemented for these types yet though
-
-Most mesa/progs/demos/* work. 
-
-To do (probably by this order):
-
- - code generate stipple and stencil testing
-
- - translate TGSI control flow instructions, and all other remaining opcodes
- - integrate with the draw module for VS code generation
-
- - code generate the triangle setup and rasterization
-
-
 Requirements
 ============
 
@@ -98,7 +51,7 @@ Building
 
 To build everything on Linux invoke scons as:
 
-  scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false
+  scons build=debug libgl-xlib
 
 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
 
@@ -108,19 +61,16 @@ but the rest of these instructions assume that scons is used.
 
 For windows is everything the except except the winsys:
 
-  scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false
+  scons build=debug libgl-gdi
 
 Using
 =====
 
-On Linux, building will create a drop-in alternative for libGL.so. To use it
-set the environment variables:
-
-  export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
+On Linux, building will create a drop-in alternative for libGL.so into
 
-or
+  build/foo/gallium/targets/libgl-xlib/libGL.so
 
-  export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
+To use it set the LD_LIBRARY_PATH environment variable accordingly.
 
 For performance evaluation pass debug=no to scons, and use the corresponding
 lib directory without the "-debug" suffix.
@@ -136,7 +86,7 @@ Profiling
 
 To profile llvmpipe you should pass the options
 
-  scons debug=no profile=yes <same-as-before>
+  scons build=profile <same-as-before>
 
 This will ensure that frame pointers are used both in C and JIT functions, and
 that no tail call optimizations are done by gcc.
@@ -200,5 +150,4 @@ Development Notes
   interfaces very closely, and appear to be complete enough for code
   generation. See 
   http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
-  for a stand-alone example.
-  See the llvm-c/Core.h file for reference.
+  for a stand-alone example.  See the llvm-c/Core.h file for reference.
index 49950153a4fcc98abc20ae130bc4c874a6810cb4..26b258b956957cac81a0f71788980928461f4850 100644 (file)
@@ -9,8 +9,6 @@ if not env['llvm']:
 
 env = env.Clone()
 
-env.Tool('udis86')
-
 env.Append(CPPPATH = ['.'])
 
 env.CodeGenerate(
@@ -78,6 +76,8 @@ llvmpipe = env.ConvenienceLibrary(
         lp_tile_soa_os,
        ])
 
+env.Alias('llvmpipe', llvmpipe)
+
 
 if env['platform'] != 'embedded':
     env = env.Clone()
@@ -92,7 +92,7 @@ if env['platform'] != 'embedded':
        'sincos',
     ]
 
-    if not msvc:
+    if not env['msvc']:
         tests.append('round')
 
     for test in tests:
index b6d3a5cf351fe9cd9aec30a1bc5165e0f583a684..9d7bd4e7695ed3c844b495856fa6611af3040c47 100644 (file)
@@ -7,24 +7,10 @@ This directory contains a Gallium3D remote debugger pipe driver.
 It provides remote debugging functionality.
 
 
-= Build Instructions =
-
-To build, invoke scons on the top dir as
- scons dri=no statetrackers=mesa winsys=xlib
-
-
 = Usage =
 
-To use do
-
-   export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib
-
-ensure the right libGL.so is being picked by doing
-
-   ldd progs/trivial/tri 
+Do
 
-   export XMESA_TRACE=y
    GALLIUM_RBUG=true progs/trivial/tri
 
 which should open gallium remote debugging session. While the program is running
index d5f4d28aeffe499928981c4d19d5b28413ca17b7..ea10e8a9f986f5cbb7bd0933aaf1990abf4e3cfa 100644 (file)
@@ -37,4 +37,6 @@ softpipe = env.ConvenienceLibrary(
                'sp_tile_cache.c',
        ])
 
+env.Alias('softpipe', softpipe)
+
 Export('softpipe')
index e9ebf751ddd892f5194c46aec0e888d25d041f9a..40d01db2f6ddeed12178c1b93c2d201d015898dd 100644 (file)
@@ -20,7 +20,6 @@ if True:
 
 if env['llvm']:
     env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Tool('udis86')
     env.Prepend(LIBS = [llvmpipe])
     extra.append(llvmpipe)
 
index cdcd8d2b4be9b8ee5eb6508433ee74e34aa75de0..c210cba032a2acd4e9b8048075f4c37a87456eb8 100644 (file)
@@ -7,23 +7,8 @@ This directory contains a Gallium3D trace debugger pipe driver.
 It can traces all incoming calls.
 
 
-= Build Instructions =
-
-To build, invoke scons on the top dir as
- scons dri=no statetrackers=mesa winsys=xlib
-
-
 = Usage =
 
-To use do
-
- export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib
-
-ensure the right libGL.so is being picked by doing
-
- ldd progs/trivial/tri 
-
 == Tracing ==
 
 For tracing then do
@@ -40,6 +25,7 @@ For remote debugging see:
 
   src/gallium/drivers/rbug/README
 
+
 = Integrating =
 
 You can integrate the trace pipe driver either inside the state tracker or the 
@@ -60,5 +46,5 @@ are automatically wrapped by trace_screen.
 
 
 --
-Jose Fonseca <jrfonseca@tungstengraphics.com>
+Jose Fonseca <jfonseca@vmware.com>
 Jakob Bornecrantz <jakob@vmware.com>
index efcce25e3171b85367815f757aa04be24e50c249..8d34e47df0ee35a8389d01d083e9e6aada076bfa 100644 (file)
@@ -3,34 +3,35 @@
 
 Import('*')
 
-if 'egl' in env['statetrackers']:
+if env['platform'] != 'windows':
+    Return()
 
-    env = env.Clone()
+env = env.Clone()
 
-    env.Append(CPPPATH = [
-       '#/src/egl/main',
-       '#/src/gallium/winsys/sw',
-       '.',
-    ])
-    env.Append(CPPDEFINES = [
-       'HAVE_GDI_BACKEND',
-    ])
+env.Append(CPPPATH = [
+    '#/src/egl/main',
+    '#/src/gallium/winsys/sw',
+    '.',
+])
+env.Append(CPPDEFINES = [
+    'HAVE_GDI_BACKEND',
+])
 
-    common_sources = [
-        'common/egl_g3d.c',
-        'common/egl_g3d_api.c',
-        'common/egl_g3d_image.c',
-        'common/egl_g3d_st.c',
-        'common/egl_g3d_sync.c',
-        'common/native_helper.c',
-    ]
+common_sources = [
+    'common/egl_g3d.c',
+    'common/egl_g3d_api.c',
+    'common/egl_g3d_image.c',
+    'common/egl_g3d_st.c',
+    'common/egl_g3d_sync.c',
+    'common/native_helper.c',
+]
 
-    gdi_sources = common_sources + [
-        'gdi/native_gdi.c',
-    ]
+gdi_sources = common_sources + [
+    'gdi/native_gdi.c',
+]
 
-    st_egl_gdi = env.ConvenienceLibrary(
-       target = 'st_egl_gdi',
-       source = gdi_sources,
-    )
-    Export('st_egl_gdi')
+st_egl_gdi = env.ConvenienceLibrary(
+    target = 'st_egl_gdi',
+    source = gdi_sources,
+)
+Export('st_egl_gdi')
index 9df351a276940a53117f381b8adfd5c5705568bb..775000eacce81ac5905377c8efe23b9b3e1330ec 100644 (file)
@@ -3,25 +3,25 @@
 
 Import('*')
 
-if env['platform'] == 'linux' \
-        and 'mesa' in env['statetrackers']:
+if not env['x11']:
+    Return()
 
-    env = env.Clone()
+env = env.Clone()
 
-    env.Append(CPPPATH = [
-        '#/src/mapi',
-        '#/src/mesa',
-        '#/src/mesa/main',
-    ])
+env.Append(CPPPATH = [
+    '#/src/mapi',
+    '#/src/mesa',
+    '#/src/mesa/main',
+])
 
-    st_xlib = env.ConvenienceLibrary(
-       target = 'st_xlib',
-       source = [
-               'glx_api.c',
-               'glx_getproc.c',
-               'glx_usefont.c',
-               'xm_api.c',
-               'xm_st.c',
-               ]
-    )
-    Export('st_xlib')
+st_xlib = env.ConvenienceLibrary(
+target = 'st_xlib',
+source = [
+    'glx_api.c',
+    'glx_getproc.c',
+    'glx_usefont.c',
+    'xm_api.c',
+    'xm_st.c',
+    ]
+)
+Export('st_xlib')
index aadeaa0a35918dd9fb7fb6cfabbd58d98252581f..5cb7960f9b59e5fec1708cfbb428995b14845016 100644 (file)
@@ -3,57 +3,61 @@ import os.path
 
 Import('*')
 
-if 'python' in env['statetrackers']:
-
-    env = env.Clone()
-    
-    env.Tool('python')
-    
-    env.Tool('swig')
-    env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe'])
-    env.Append(SWIGFLAGS = ['-python', '-keyword'])
-    
-    env.Append(CPPPATH = '.')
-
-    if env['platform'] == 'windows':
-        env.Append(LIBS = [
-            'opengl32',
-            'gdi32',
-            'user32',
-            'kernel32',
-            'ws2_32',
-        ])
-    else:
-        env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY'])
-        env.Append(LIBS = [
-               'GL',
-            'X11',
-        ])
-
-    sources = [
-        'gallium.i',
-        'st_device.c',
-        'st_sample.c',
-        'st_hardpipe_winsys.c',
-        'st_softpipe_winsys.c',
-    ]
-
-    env.Prepend(LIBS = [
-        ws_null,
-        trace,
-        gallium,
-    ])
+if env['toolchain'] == 'crossmingw':
+    # Cross-compilation not supported
+    Return()
+
+env = env.Clone()
+
+env.Tool('python')
 
-    if env['llvm']:
-        env.Append(CPPDEFINES = ['HAVE_LLVMPIPE'])
-        env.Prepend(LIBS = [llvmpipe])
-    if True:
-        env.Append(CPPDEFINES = ['HAVE_SOFTPIPE'])
-        env.Prepend(LIBS = [softpipe])
+env.Tool('swig')
+env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe'])
+env.Append(SWIGFLAGS = ['-python', '-keyword'])
 
-    env['no_import_lib'] = 1
+env.Append(CPPPATH = '.')
+
+if env['platform'] == 'windows':
+    env.Append(LIBS = [
+        'opengl32',
+        'gdi32',
+        'user32',
+        'kernel32',
+        'ws2_32',
+    ])
+else:
+    env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY'])
+    env.Append(LIBS = [
+        'GL',
+        'X11',
+    ])
 
-    env.SharedLibrary(
-        target = '_gallium',
-        source = sources,
-    )
+sources = [
+    'gallium.i',
+    'st_device.c',
+    'st_sample.c',
+    'st_hardpipe_winsys.c',
+    'st_softpipe_winsys.c',
+]
+
+env.Prepend(LIBS = [
+    ws_null,
+    trace,
+    gallium,
+])
+
+if env['llvm']:
+    env.Append(CPPDEFINES = ['HAVE_LLVMPIPE'])
+    env.Prepend(LIBS = [llvmpipe])
+if True:
+    env.Append(CPPDEFINES = ['HAVE_SOFTPIPE'])
+    env.Prepend(LIBS = [softpipe])
+
+env['no_import_lib'] = 1
+
+pyst = env.SharedLibrary(
+    target = '_gallium',
+    source = sources,
+)
+
+env.Alias('python', pyst)
index 548053eb6460cd7fae13aeb1181920a2c102e6a8..4c6e18f42b2c069c8ec7f89bc36682c1c4a2ad06 100644 (file)
@@ -3,49 +3,48 @@
 
 Import('*')
 
-if 'egl' in env['statetrackers']:
+env = env.Clone()
 
-    env = env.Clone()
+env.Append(CPPPATH = [
+    '#/src/mapi',
+])
 
-    env.Append(CPPPATH = [
-       '#/src/mapi',
-    ])
+vega_sources = [
+   'api.c',
+   'api_context.c',
+   'api_filters.c',
+   'api_images.c',
+   'api_masks.c',
+   'api_misc.c',
+   'api_paint.c',
+   'api_params.c',
+   'api_path.c',
+   'api_text.c',
+   'api_transform.c',
+   'vgu.c',
+   'vg_context.c',
+   'vg_manager.c',
+   'vg_state.c',
+   'vg_translate.c',
+   'polygon.c',
+   'bezier.c',
+   'path.c',
+   'paint.c',
+   'arc.c',
+   'image.c',
+   'renderer.c',
+   'stroker.c',
+   'mask.c',
+   'shader.c',
+   'shaders_cache.c',
+]
 
-    vega_sources = [
-       'api.c',
-       'api_context.c',
-       'api_filters.c',
-       'api_images.c',
-       'api_masks.c',
-       'api_misc.c',
-       'api_paint.c',
-       'api_params.c',
-       'api_path.c',
-       'api_text.c',
-       'api_transform.c',
-       'vgu.c',
-       'vg_context.c',
-       'vg_manager.c',
-       'vg_state.c',
-       'vg_translate.c',
-       'polygon.c',
-       'bezier.c',
-       'path.c',
-       'paint.c',
-       'arc.c',
-       'image.c',
-       'renderer.c',
-       'stroker.c',
-       'mask.c',
-       'shader.c',
-       'shaders_cache.c',
-    ]
+# vgapi_header must be generated first
+env.Depends(vega_sources, vgapi_header)
 
-    # vgapi_header must be generated first
-    env.Depends(vega_sources, vgapi_header)
+st_vega = env.ConvenienceLibrary(
+    target = 'st_vega',
+    source = vega_sources,
+)
 
-    st_vega = env.ConvenienceLibrary(
-       target = 'st_vega',
-       source = vega_sources,
-    )
-    Export('st_vega')
+Export('st_vega')
index 0b598dab6e3f1634fc4c170fc9deb9e20923536f..ffaa1c2684636f9e0af7f25dc097bbb1bfa7a86d 100644 (file)
@@ -3,34 +3,35 @@
 
 Import('*')
 
-if 'xorg' in env['statetrackers']:
-
-    env = env.Clone()
-
-    env.Append(CPPPATH = [
-       '#/src/mesa',
-    ])
-
-    env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
-
-    conf = env.Configure()
-
-    if conf.CheckHeader('X11/extensions/dpmsconst.h'):
-        env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')])
-
-    conf.Finish()
-
-    st_xorg = env.ConvenienceLibrary(
-       target = 'st_xorg',
-       source = [ 'xorg_composite.c',
-               'xorg_crtc.c',
-               'xorg_dri2.c',
-               'xorg_driver.c',
-               'xorg_exa.c',
-               'xorg_exa_tgsi.c',
-               'xorg_output.c',
-               'xorg_renderer.c',
-               'xorg_xv.c',
-               ]
-    )
-    Export('st_xorg')
+if not env['x11'] or not env['dri'] or not env['xorg']:
+    Return()
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+    '#/src/mesa',
+])
+
+env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
+
+conf = env.Configure()
+
+if conf.CheckHeader('X11/extensions/dpmsconst.h'):
+    env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')])
+
+conf.Finish()
+
+st_xorg = env.ConvenienceLibrary(
+target = 'st_xorg',
+source = [ 'xorg_composite.c',
+    'xorg_crtc.c',
+    'xorg_dri2.c',
+    'xorg_driver.c',
+    'xorg_exa.c',
+    'xorg_exa_tgsi.c',
+    'xorg_output.c',
+    'xorg_renderer.c',
+    'xorg_xv.c',
+    ]
+)
+Export('st_xorg')
diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript
deleted file mode 100644 (file)
index e447d09..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-import os
-Import('*')
-
-# Compatibility with old build scripts:
-#
-if 'mesa' in env['statetrackers']:
-    if 'xlib' in env['winsys'] and 'libgl-xlib' not in env['targets']:
-        env['targets'].append('libgl-xlib')
-    if 'gdi' in env['winsys'] and 'libgl-gdi' not in env['targets']:
-        env['targets'].append('libgl-gdi')
-
-if not 'graw-xlib' in env['targets'] and not 'graw-null' in env['targets'] and not env['msvc']:
-        # XXX: disable until MSVC can link correctly
-        SConscript('graw-null/SConscript')
-
-
-if env['dri']:
-       SConscript([
-               'SConscript.dri'
-       ])
-
-if 'xorg' in env['statetrackers']:
-       if 'vmware' in env['winsys']:
-               SConscript([
-                       'xorg-vmwgfx/SConscript',
-               ])
-
-if 'egl' in env['statetrackers']:
-       SConscript([
-               'egl-gdi/SConscript',
-       ])
-
-# Ideally all non-target directories would produce convenience
-# libraries, and the actual shared libraries and other installables
-# would be finally assembled in the targets subtree:
-#
-for target in env['targets']:
-    SConscript(os.path.join(target, 'SConscript'))
-
-
-
index bc8d179e3d9db03b4fb176a0b4c4ede1bf14afac..092223b3690c9b63b1aff51a6fed8a6e5f623580 100644 (file)
@@ -3,6 +3,9 @@
 
 Import('*')
 
+if not env['dri']:
+    Return()
+
 drienv = env.Clone()
 
 drienv.Replace(CPPPATH = [
@@ -77,32 +80,3 @@ Export([
        'COMMON_DRI_SW_OBJECTS',
        'COMMON_DRI_DRM_OBJECTS',
 ])
-
-SConscript([
-       'dri-swrast/SConscript',
-])
-
-if 'vmware' in env['winsys']:
-       SConscript([
-               'dri-vmwgfx/SConscript',
-       ])
-
-if 'i915' in env['winsys']:
-       SConscript([
-               'dri-i915/SConscript',
-       ])
-
-if 'i965' in env['winsys']:
-       SConscript([
-               'dri-i965/SConscript',
-       ])
-
-if 'radeon' in env['winsys']:
-       SConscript([
-               'dri-radeong/SConscript',
-       ])
-
-if 'r600' in env['winsys']:
-       SConscript([
-               'dri-r600/SConscript',
-       ])
index 172f92d6b822e2fcc3dacfe0b3ef9ab4ae6e54e1..ab60013830e2de5e3a16aac5fddaf7ce306390e3 100644 (file)
@@ -1,9 +1,5 @@
 Import('*')
 
-if not 'i915' in env['drivers']:
-    print 'warning: i915 pipe driver not built skipping i915_dri.so'
-    Return()
-
 env = drienv.Clone()
 
 env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
@@ -24,8 +20,10 @@ env.Prepend(LIBS = [
     COMMON_DRI_DRM_OBJECTS
 ])
 
-env.LoadableModule(
+module = env.LoadableModule(
     target = 'i915_dri.so',
     source = 'target.c',
     SHLIBPREFIX = '',
 )
+
+env.Alias('dri-i915', module)
\ No newline at end of file
index 684e3488f71c7bd07c547e42824eaafdfaadfed6..669f70d6b8dee219adcc3dab2fae93dcdcf1ef8d 100644 (file)
@@ -1,9 +1,5 @@
 Import('*')
 
-if not 'i965' in env['drivers']:
-    print 'warning: i965 pipe driver not built skipping i965_dri.so'
-    Return()
-
 env = drienv.Clone()
 
 env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
@@ -27,8 +23,10 @@ env.Prepend(LIBS = [
     COMMON_DRI_DRM_OBJECTS
 ])
 
-env.LoadableModule(
+module = env.LoadableModule(
     target = 'i965_dri.so',
     source = 'target.c',
     SHLIBPREFIX = '',
 )
+
+env.Alias('dri-i965', module)
\ No newline at end of file
index 33a458f2e682515c3deb68f50af0f54288a04f9e..005b4bbf7f1d65d1f71b6e561340ecada09147c1 100644 (file)
@@ -1,9 +1,5 @@
 Import('*')
 
-if not 'r300' in env['drivers']:
-    print 'warning: r300 pipe driver not built skipping r300_dri.so'
-    Return()
-
 env = drienv.Clone()
 
 env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
@@ -23,8 +19,10 @@ env.Prepend(LIBS = [
     COMMON_DRI_DRM_OBJECTS
 ])
 
-env.SharedLibrary(
+module = env.SharedLibrary(
     target ='r300_dri.so',
     source = 'target.c',
     SHLIBPREFIX = '',
 )
+
+env.Alias('dri-r300', module)
\ No newline at end of file
index 64d6d2a7f6f9a0eb653236e022dc155788fb10bf..aa771db2d1af1c38a6d19bef8b4d24268e0e7d26 100644 (file)
@@ -1,9 +1,5 @@
 Import('*')
 
-if not 'r600' in env['drivers']:
-    print 'warning: r600 pipe driver not built skipping r600_dri.so'
-    Return()
-
 env = drienv.Clone()
 
 env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
@@ -22,8 +18,10 @@ env.Prepend(LIBS = [
     COMMON_DRI_DRM_OBJECTS
 ])
 
-env.SharedLibrary(
+module = env.SharedLibrary(
     target ='r600_dri.so',
     source = 'target.c',
     SHLIBPREFIX = '',
 )
+
+env.Alias('dri-r600', module)
index d8143471194db6344464721194b16f0d041033e9..b67483800e4f082fe88fab69533a47ff7f183601 100644 (file)
@@ -27,15 +27,16 @@ if True:
 
 if env['llvm']:
     env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Tool('udis86')
     env.Prepend(LIBS = [llvmpipe])
 
 swrastg_sources = [
     'swrast_drm_api.c'
 ]
 
-env.LoadableModule(
+module = env.LoadableModule(
     target ='swrastg_dri.so',
     source = swrastg_sources,
     SHLIBPREFIX = '',
 )
+
+env.Alias('dri-swrast', module)
index 7afabc7429f71d696734b7df3435629b1486bb33..7888e4f2c8bc9c0e7aa2f7aa3ffa4b7c2f883562 100644 (file)
@@ -1,9 +1,5 @@
 Import('*')
 
-if not 'svga' in env['drivers']:
-    print 'warning: svga pipe driver not built skipping vmwgfx_dri.so'
-    Return()
-
 env = drienv.Clone()
 
 env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE'])
@@ -20,8 +16,10 @@ env.Prepend(LIBS = [
     COMMON_DRI_DRM_OBJECTS
 ])
 
-env.LoadableModule(
+module = env.LoadableModule(
     target = 'vmwgfx_dri.so',
     source = 'target.c',
     SHLIBPREFIX = '',
 )
+
+env.Alias('dri-vmwgfx', module)
\ No newline at end of file
index 8f8b28ef67bf9bc199ad2d7dcbe6230a7a2677ca..d52eeb70fd5c81d2d2b2510ead93cec2e6f55441 100644 (file)
@@ -3,45 +3,53 @@
 
 Import('*')
 
-if env['platform'] == 'windows':
-
-    env = env.Clone()
-
-    env.Append(CPPPATH = [
-            '#/src/gallium/state_trackers/egl',
-            '#/src/gallium/state_trackers/vega',
-            '#/src/egl/main',
-            '#/src/mesa',
-    ])
-
-    env.Append(CPPDEFINES = [
-            'FEATURE_VG=1',
-            'GALLIUM_SOFTPIPE',
-            'GALLIUM_RBUG',
-            'GALLIUM_TRACE',
-    ])
-
-    env.Append(LIBS = [
-        'gdi32',
-        'user32',
-        'kernel32',
-        'ws2_32',
-    ])
-
-    env['no_import_lib'] = 1
-
-    drivers = [softpipe]
-    if env['llvm']:
-        env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-        drivers += [llvmpipe]
-    drivers += [identity, trace, rbug]
-
-    apis = [vgapi, st_vega]
-
-    egl_gallium = env.SharedLibrary(
-        target ='egl_gallium',
-        source = 'egl-static.c',
-        LIBS = st_egl_gdi + ws_gdi + drivers + apis + gallium + egl + env['LIBS'],
-    )
-
-    env.InstallSharedLibrary(egl_gallium)
+env = env.Clone()
+
+env.Append(CPPPATH = [
+        '#/src/gallium/state_trackers/egl',
+        '#/src/gallium/state_trackers/vega',
+        '#/src/egl/main',
+        '#/src/mesa',
+])
+
+env.Append(CPPDEFINES = [
+        'FEATURE_VG=1',
+        'GALLIUM_SOFTPIPE',
+        'GALLIUM_RBUG',
+        'GALLIUM_TRACE',
+])
+
+env.Append(LIBS = [
+    'gdi32',
+    'user32',
+    'kernel32',
+    'ws2_32',
+])
+
+env.Prepend(LIBS = [
+    st_egl_gdi,
+    ws_gdi,
+    identity,
+    trace,
+    rbug,
+    softpipe,
+    vgapi,
+    st_vega,
+    gallium,
+    egl,
+])
+
+if env['llvm']:
+    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+    env.Prepend(LIBS = [llvmpipe])
+
+egl_gallium = env.SharedLibrary(
+    target ='egl_gallium',
+    source = 'egl-static.c',
+)
+
+env['no_import_lib'] = 1
+
+egl_gdi = env.InstallSharedLibrary(egl_gallium)
+
+env.Alias('egl-gdi', egl_gdi)
index 3416989d8eb02341c6275d41d8a6c828461d77e9..ebac1728f04f6b76bcc2bf8cb8705a2b0d304d83 100644 (file)
@@ -5,54 +5,28 @@ Import('*')
 
 env = env.Clone()
 
-env.Prepend(LIBS = [
-    ws_null,
-    trace,
-    rbug,
-    identity,
-#    gallium,
-])
-
-env.Append(CPPPATH = [
-    '#src/gallium/drivers',
-])
+graw_util = env.SharedObject(
+    source = ['graw_util.c'],
+)
 
-if env['platform'] == 'windows':
-    # For trace
-    env.Append(LIBS = [
-        'ws2_32',
-    ])
+env = env.Clone()
 
 sources = [
     'graw_null.c',
-    '../graw-xlib/graw_util.c',
+    graw_util,
 ]
 
-if True:
-    env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
-    env.Prepend(LIBS = [softpipe])
-
-if env['llvm']:
-    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Tool('udis86')
-    env.Prepend(LIBS = [llvmpipe])
-
-# Need this for trace, identity drivers referenced by
-# gallium_wrap_screen().
-#
 env.Prepend(LIBS = [gallium])
 
 # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
 graw = env.SharedLibrary(
-    target ='graw',
+    target = 'graw',
     source = sources,
 )
 
-env.InstallSharedLibrary(graw, version=(1, 0))
-
 if env['platform'] == 'windows':
     graw = env.FindIxes(graw, 'LIBPREFIX', 'LIBSUFFIX')
 else:
     graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX')
 
-Export('graw')
+Export('graw_util', 'graw')
index 5939a5acd3ca8ede3e67a44d807810be953eacaf..f1fe3872c94a3905f5638fe681bd006f3bc61687 100644 (file)
@@ -1,31 +1,5 @@
-#include "pipe/p_compiler.h"
-#include "util/u_debug.h"
-#include "util/u_memory.h"
-#include "target-helpers/wrap_screen.h"
-#include "sw/null/null_sw_winsys.h"
-#include "os/os_time.h"
 #include "state_tracker/graw.h"
 
-#ifdef GALLIUM_SOFTPIPE
-#include "softpipe/sp_public.h"
-#endif
-
-#ifdef GALLIUM_LLVMPIPE
-#include "llvmpipe/lp_public.h"
-#endif
-
-/* Haven't figured out a decent way to build the helper code yet -
- * #include it here temporarily.
- */
-#include "sw/sw_public.h"
-#include "sw/sw.c"
-
-#include <stdio.h>
-
-
-static struct {
-   void (*draw)(void);
-} graw;
 
 
 
@@ -37,45 +11,7 @@ graw_create_window_and_screen( int x,
                                enum pipe_format format,
                                void **handle)
 {
-   const char *default_driver;
-   const char *driver;
-   struct pipe_screen *screen = NULL;
-   struct sw_winsys *winsys = NULL;
-   static int dummy;
-
-
-   /* Create the underlying winsys, which performs presents to Xlib
-    * drawables:
-    */
-   winsys = null_sw_create();
-   if (winsys == NULL)
-      return NULL;
-
-#if defined(GALLIUM_LLVMPIPE)
-   default_driver = "llvmpipe";
-#elif defined(GALLIUM_SOFTPIPE)
-   default_driver = "softpipe";
-#else
-   default_driver = "";
-#endif
-
-   driver = debug_get_option("GALLIUM_DRIVER", default_driver);
-
-#if defined(GALLIUM_LLVMPIPE)
-   if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
-      screen = llvmpipe_create_screen( winsys );
-#endif
-
-#if defined(GALLIUM_SOFTPIPE)
-   if (screen == NULL)
-      screen = softpipe_create_screen( winsys );
-#endif
-
-   *handle = &dummy;
-
-   /* Inject any wrapping layers we want to here:
-    */
-   return gallium_wrap_screen( screen );
+   return NULL;
 }
 
 
@@ -83,13 +19,10 @@ graw_create_window_and_screen( int x,
 void 
 graw_set_display_func( void (*draw)( void ) )
 {
-   graw.draw = draw;
 }
 
 
 void
 graw_main_loop( void )
 {
-   graw.draw();
-   os_time_sleep(100000);
 }
diff --git a/src/gallium/targets/graw-null/graw_util.c b/src/gallium/targets/graw-null/graw_util.c
new file mode 100644 (file)
index 0000000..531757f
--- /dev/null
@@ -0,0 +1,53 @@
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_text.h"
+#include "util/u_memory.h"
+#include "state_tracker/graw.h"
+
+
+/* Helper functions.  These are the same for all graw implementations.
+ */
+PUBLIC void *
+graw_parse_geometry_shader(struct pipe_context *pipe,
+                           const char *text)
+{
+   struct tgsi_token tokens[1024];
+   struct pipe_shader_state state;
+
+   if (!tgsi_text_translate(text, tokens, Elements(tokens)))
+      return NULL;
+
+   state.tokens = tokens;
+   return pipe->create_gs_state(pipe, &state);
+}
+
+PUBLIC void *
+graw_parse_vertex_shader(struct pipe_context *pipe,
+                         const char *text)
+{
+   struct tgsi_token tokens[1024];
+   struct pipe_shader_state state;
+
+   if (!tgsi_text_translate(text, tokens, Elements(tokens)))
+      return NULL;
+
+   state.tokens = tokens;
+   return pipe->create_vs_state(pipe, &state);
+}
+
+PUBLIC void *
+graw_parse_fragment_shader(struct pipe_context *pipe,
+                           const char *text)
+{
+   struct tgsi_token tokens[1024];
+   struct pipe_shader_state state;
+
+   if (!tgsi_text_translate(text, tokens, Elements(tokens)))
+      return NULL;
+
+   state.tokens = tokens;
+   return pipe->create_fs_state(pipe, &state);
+}
+
index 21fce948f43c7c24a08fbe27c890b0b5762f8a5f..f7953097872f793127bbc52786935b95c5e48ade 100644 (file)
@@ -3,13 +3,8 @@
 
 Import('*')
 
-if env['platform'] != 'linux':
-    Return()
-
 env = env.Clone()
 
-env.Tool('x11')
-
 env.Prepend(LIBS = [
     ws_xlib,
     trace,
@@ -18,26 +13,24 @@ env.Prepend(LIBS = [
 #    gallium,
 ])
 
+env.Prepend(LIBS = env['X11_LIBS'])
+
 env.Append(CPPPATH = [
     '#src/gallium/drivers',
     '#src/gallium/include/state_tracker',
 ])
 
-
 sources = [
     'graw_xlib.c',
-    'graw_util.c',
+    graw_util
 ]
 
-env.Tool('x11')
-
 if True:
     env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
     env.Prepend(LIBS = [softpipe])
 
 if env['llvm']:
     env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Tool('udis86')
     env.Prepend(LIBS = [llvmpipe])
 
 # Need this for trace, identity drivers referenced by
@@ -51,8 +44,6 @@ graw = env.SharedLibrary(
     source = sources,
 )
 
-env.InstallSharedLibrary(graw, version=(1, 0))
-
-graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX')
+graw = env.InstallSharedLibrary(graw, version=(1, 0))
 
-Export('graw')
+env.Alias('graw-xlib', graw)
diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c
deleted file mode 100644 (file)
index fc7c9ae..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "tgsi/tgsi_text.h"
-#include "util/u_memory.h"
-#include "state_tracker/graw.h"
-
-
-/* Helper functions.  These are the same for all graw implementations.
- */
-void *graw_parse_geometry_shader(struct pipe_context *pipe,
-                                 const char *text)
-{
-   struct tgsi_token tokens[1024];
-   struct pipe_shader_state state;
-
-   if (!tgsi_text_translate(text, tokens, Elements(tokens)))
-      return NULL;
-
-   state.tokens = tokens;
-   return pipe->create_gs_state(pipe, &state);
-}
-
-void *graw_parse_vertex_shader(struct pipe_context *pipe,
-                               const char *text)
-{
-   struct tgsi_token tokens[1024];
-   struct pipe_shader_state state;
-
-   if (!tgsi_text_translate(text, tokens, Elements(tokens)))
-      return NULL;
-
-   state.tokens = tokens;
-   return pipe->create_vs_state(pipe, &state);
-}
-
-void *graw_parse_fragment_shader(struct pipe_context *pipe,
-                                 const char *text)
-{
-   struct tgsi_token tokens[1024];
-   struct pipe_shader_state state;
-
-   if (!tgsi_text_translate(text, tokens, Elements(tokens)))
-      return NULL;
-
-   state.tokens = tokens;
-   return pipe->create_fs_state(pipe, &state);
-}
-
index 12fe403f62f7339094d5c1ce9d11ef832eac1ffd..339238756ab10f632fc3bf62a3b3631ffa465fcd 100644 (file)
@@ -3,45 +3,46 @@
 
 Import('*')
 
-if env['platform'] == 'windows':
-
-    env = env.Clone()
-
-    env.Append(CPPPATH = [
-        '#src/gallium/state_trackers/wgl',
-        '#src/gallium/winsys/sw',
-    ])
-
-    env.Append(LIBS = [
-        'gdi32',
-        'user32',
-        'kernel32',
-        'ws2_32',
-        talloc,
-    ])
-
-    sources = []
-    drivers = []
-
-    if True:
-        sources = ['gdi_softpipe_winsys.c']
-        drivers = [softpipe]
-
-    if env['llvm']:
-        sources = ['gdi_llvmpipe_winsys.c']
-        drivers = [llvmpipe]
-
-    if env['gcc']:
-        sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def']
-    else:
-        sources += ['#src/gallium/state_trackers/wgl/opengl32.def']
-        
-    drivers += [trace, rbug]
-
-    env['no_import_lib'] = 1
-
-    env.SharedLibrary(
-        target ='opengl32',
-        source = sources,
-        LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'],
-    )
+env = env.Clone()
+
+env.Append(CPPPATH = [
+    '#src/gallium/state_trackers/wgl',
+    '#src/gallium/winsys/sw',
+])
+
+env.Append(LIBS = [
+    'gdi32',
+    'user32',
+    'kernel32',
+    'ws2_32',
+    talloc,
+])
+
+sources = []
+drivers = []
+
+if True:
+    sources = ['gdi_softpipe_winsys.c']
+    drivers = [softpipe]
+
+if env['llvm']:
+    sources = ['gdi_llvmpipe_winsys.c']
+    drivers = [llvmpipe]
+
+if env['gcc']:
+    sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def']
+else:
+    sources += ['#src/gallium/state_trackers/wgl/opengl32.def']
+    
+drivers += [trace, rbug]
+
+env['no_import_lib'] = 1
+
+opengl32 = env.SharedLibrary(
+    target ='opengl32',
+    source = sources,
+    LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'],
+)
+
+env.Alias('opengl32', opengl32)
+env.Alias('libgl-gdi', opengl32)
index 27b562e1d5d6ffae7d8362675066a83e28d02382..582760eac93c3d28b218ec736531888d3387a7e7 100644 (file)
@@ -3,17 +3,6 @@
 
 Import('*')
 
-if env['platform'] != 'linux':
-    Return()
-
-if 'mesa' not in env['statetrackers']:
-    print 'warning: Mesa state tracker disabled: skipping build of xlib libGL.so'
-    Return()
-
-if env['dri']:
-    print 'warning: DRI enabled: skipping build of xlib libGL.so'
-    Return()
-
 env = env.Clone()
 
 env.Append(CPPPATH = [
@@ -25,6 +14,8 @@ env.Append(CPPPATH = [
 
 env.Append(CPPDEFINES = ['USE_XSHM'])
 
+env.Prepend(LIBS = env['X11_LIBS'])
+
 env.Prepend(LIBS = [
     st_xlib,
     ws_xlib,
@@ -42,8 +33,6 @@ sources = [
     'xlib.c',
 ]
 
-env.Tool('x11')
-
 if True:
     env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
     env.Prepend(LIBS = [softpipe])
@@ -54,10 +43,10 @@ if True:
 
 if env['llvm']:
     env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Tool('udis86')
     env.Prepend(LIBS = [llvmpipe])
     
-if 'cell' in env['drivers']:
+if False:
+    # TODO: Detect Cell SDK
     env.Append(CPPDEFINES = 'GALLIUM_CELL')
     env.Prepend(LIBS = [cell])
 
@@ -67,6 +56,8 @@ libgl = env.SharedLibrary(
     source = sources,
 )
 
-if not env['dri']:
-    # Only install this libGL.so if DRI not enabled
-    env.InstallSharedLibrary(libgl, version=(1, 5))
+if True:
+    # XXX: Only install this libGL.so if DRI not enabled
+    libgl = env.InstallSharedLibrary(libgl, version=(1, 5))
+
+env.Alias('libgl-xlib', libgl)
index 43b2c74f9cedabdd7e10d983194d4f903c2ae4f6..0a81b33651fdf51b16a02ce0755e44e5db64a184 100644 (file)
@@ -2,62 +2,58 @@ import os.path
 
 Import('*')
 
-if not 'svga' in env['drivers']:
-    print 'warning: svga pipe driver not built skipping vmwgfx_drv.so'
-    Return()
-
-if env['platform'] == 'linux':
-
-       env = env.Clone()
-
-       env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
-
-       env.Prepend(CPPPATH = [
-               '#/include',
-               '#/src/gallium',
-               '#/src/mesa',
-               '#/src/gallium/drivers/svga',
-               '#/src/gallium/drivers/svga/include',
-       ])
-
-       env.Append(CPPDEFINES = [
-       ])
-
-       if env['gcc']:
-               env.Append(CPPDEFINES = [
-                       'HAVE_STDINT_H',
-                       'HAVE_SYS_TYPES_H',
-               ])
-
-       env.Append(CFLAGS = [
-               '-std=gnu99',
-               '-D_FILE_OFFSET_BITS=64',
-       ])
-
-       env.Prepend(LIBPATH = [
-       ])
-
-       env.Prepend(LIBS = [
-               trace,
-               rbug,
-               st_xorg,
-               svgadrm,
-               svga,
-                gallium,
-       ])
-
-       sources = [
-               'vmw_ioctl.c',
-               'vmw_ctrl.c',
-               'vmw_screen.c',
-               'vmw_video.c',
-               'vmw_xorg.c',
-       ]
-
-       # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
-       env.LoadableModule(
-               target ='vmwgfx_drv.so',
-               source = sources,
-               LIBS = env['LIBS'],
-               SHLIBPREFIX = '',
-       )
+env = env.Clone()
+
+env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
+
+env.Prepend(CPPPATH = [
+    '#/include',
+    '#/src/gallium',
+    '#/src/mesa',
+    '#/src/gallium/drivers/svga',
+    '#/src/gallium/drivers/svga/include',
+])
+
+env.Append(CPPDEFINES = [
+])
+
+if env['gcc']:
+    env.Append(CPPDEFINES = [
+        'HAVE_STDINT_H',
+        'HAVE_SYS_TYPES_H',
+    ])
+
+env.Append(CFLAGS = [
+    '-std=gnu99',
+    '-D_FILE_OFFSET_BITS=64',
+])
+
+env.Prepend(LIBPATH = [
+])
+
+env.Prepend(LIBS = [
+    trace,
+    rbug,
+    st_xorg,
+    svgadrm,
+    svga,
+            gallium,
+])
+
+sources = [
+    'vmw_ioctl.c',
+    'vmw_ctrl.c',
+    'vmw_screen.c',
+    'vmw_video.c',
+    'vmw_xorg.c',
+]
+
+# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
+module = env.LoadableModule(
+    target ='vmwgfx_drv.so',
+    source = sources,
+    LIBS = env['LIBS'],
+    SHLIBPREFIX = '',
+)
+
+env.Alias('xorg-vmwgfx', module)
index ffde61965b4edb28e008a35477badf6bdd918c4f..3341b884985e50aec843a52691cfd3b4212365fd 100644 (file)
@@ -1,20 +1,17 @@
 Import('*')
 
-try:
-    graw
-except NameError:
-    print 'warning: graw library not avaiable: skipping build of graw test'
-    Return()
-
 env = env.Clone()
 
+env.Prepend(LIBS = [gallium])
+
 env.Prepend(LIBPATH = [graw.dir])
-env.Prepend(LIBS = ['graw'] + gallium)
+env.Prepend(LIBS = ['graw'])
+    
 
-if platform in ('freebsd8', 'sunos5'):
+if env['platform'] in ('freebsd8', 'sunos5'):
     env.Append(LIBS = ['m'])
 
-if platform == 'freebsd8':
+if env['platform'] == 'freebsd8':
     env.Append(LIBS = ['pthread'])
 
 progs = [
@@ -29,9 +26,10 @@ progs = [
     'tri-gs',
 ]
 
-for prog in progs:
-    env.Program(
-        target = prog,
-        source = prog + '.c',
+for name in progs:
+    program = env.Program(
+        target = name,
+        source = name + '.c',
     )
-
+    #env.Depends(program, graw)
+    env.Alias('graw-progs', program)
index 359759e22b264cb3fb9ad58432c8f066ce6e5b1b..655e8a9b41cbfefaf7d43cc093e792493042beae 100644 (file)
@@ -4,10 +4,10 @@ env = env.Clone()
 
 env.Prepend(LIBS = [gallium])
 
-if platform in ('freebsd8', 'sunos5'):
+if env['platform'] in ('freebsd8', 'sunos5'):
     env.Append(LIBS = ['m'])
 
-if platform == 'freebsd8':
+if env['platform'] == 'freebsd8':
     env.Append(LIBS = ['pthread'])
 
 progs = [
index 65b12287df7a82b08a3def547d6a276fdbea4804..d74f8a2e989a465293a1d44f1a5eb01fa06d1d9d 100644 (file)
@@ -2,45 +2,38 @@ Import('*')
 
 
 SConscript([
-       'sw/wrapper/SConscript',
+    'sw/wrapper/SConscript',
 ])
 
-if 'xlib' in env['winsys']:
-       SConscript([
-               'sw/xlib/SConscript',
-       ])
+SConscript([
+    'sw/xlib/SConscript',
+])
 
-if 'gdi' in env['winsys']:
-       SConscript([
-               'sw/gdi/SConscript',
-       ])
+SConscript([
+    'sw/gdi/SConscript',
+])
 
 if env['dri']:
-       SConscript([
-               'sw/dri/SConscript',
-       ])
-
-       if 'vmware' in env['winsys']:
-               SConscript([
-                       'svga/drm/SConscript',
-               ])
-
-       if 'i915' in env['winsys']:
-               SConscript([
-                       'i915/drm/SConscript',
-               ])
-
-       if 'i965' in env['winsys']:
-               SConscript([
-                       'i965/drm/SConscript',
-               ])
-
-       if 'radeon' in env['winsys']:
-               SConscript([
-                       'radeon/drm/SConscript',
-               ])
-
-       if 'r600' in env['winsys']:
-               SConscript([
-                       'r600/drm/SConscript',
-               ])
+    SConscript([
+        'sw/dri/SConscript',
+    ])
+
+    SConscript([
+        'svga/drm/SConscript',
+    ])
+
+    SConscript([
+        'i915/drm/SConscript',
+    ])
+
+    SConscript([
+        'i965/drm/SConscript',
+    ])
+
+    SConscript([
+        'radeon/drm/SConscript',
+    ])
+
+    SConscript([
+        'r600/drm/SConscript',
+    ])
index 29d2cc01494841b0dd68909febe3aa626be01134..9363b5ca5ccbc5c6e84791e00f6903121c954d1e 100644 (file)
@@ -78,7 +78,6 @@ if env['platform'] == 'windows':
         'glut.def',
     ]
 else:
-    env.Tool('x11')
     env.PrependUnique(LIBS = [
         'GLU',
         'GL',
index 40db237fcbcd5d054857664b2a98ca5d800972a7..77a5f9bd2e32f774e81bbf92e4d46d364b14314d 100644 (file)
@@ -6,77 +6,78 @@ Import('*')
 
 if env['platform'] != 'winddk':
 
-       env = env.Clone()
-       
-       env.Append(CPPDEFINES = [
-               'MAPI_GLAPI_CURRENT',
-       ])
+    env = env.Clone()
+    
+    env.Append(CPPDEFINES = [
+        'MAPI_GLAPI_CURRENT',
+    ])
 
-       if env['platform'] == 'windows':
-               env.Append(CPPDEFINES = [
-                       '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
-                       'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
-                       'WIN32_THREADS', # use Win32 thread API
-               ])
+    if env['platform'] == 'windows':
+        env.Append(CPPDEFINES = [
+            '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
+            'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+            'WIN32_THREADS', # use Win32 thread API
+        ])
 
-       env.Append(CPPPATH = [
-               '#/src/mapi',
-               '#/src/mesa',
-       ])
-       
-       glapi_sources = [
-               'glapi_dispatch.c',
-               'glapi_entrypoint.c',
-               'glapi_getproc.c',
-               'glapi_nop.c',
-               'glthread.c',
-       ]
-       
-       mapi_sources = [
-               'u_current.c',
-               'u_execmem.c',
-               'u_thread.c',
-       ]
-       for s in mapi_sources:
-               o = env.SharedObject(s[:-2], '../mapi/' + s)
-               glapi_sources.append(o)
+    env.Append(CPPPATH = [
+        '#/src/mapi',
+        '#/src/mesa',
+    ])
+    
+    glapi_sources = [
+        'glapi_dispatch.c',
+        'glapi_entrypoint.c',
+        'glapi_getproc.c',
+        'glapi_nop.c',
+        'glthread.c',
+    ]
+    
+    mapi_sources = [
+        'u_current.c',
+        'u_execmem.c',
+        'u_thread.c',
+    ]
+    for s in mapi_sources:
+        o = env.SharedObject(s[:-2], '../mapi/' + s)
+        glapi_sources.append(o)
 
-       #
-       # Assembly sources
-       #
-       if gcc and env['machine'] == 'x86':
-               env.Append(CPPDEFINES = [
-                       'USE_X86_ASM', 
-                       'USE_MMX_ASM',
-                       'USE_3DNOW_ASM',
-                       'USE_SSE_ASM',
-               ])
-               glapi_sources += [
-                       'glapi_x86.S',
-               ]
-       elif gcc and env['machine'] == 'x86_64':
-               env.Append(CPPDEFINES = [
-                       'USE_X86_64_ASM', 
-               ])
-               glapi_sources += [
-                       'glapi_x86-64.S'
-               ]
-       elif gcc and env['machine'] == 'ppc':
-               env.Append(CPPDEFINES = [
-                       'USE_PPC_ASM', 
-                       'USE_VMX_ASM', 
-               ])
-               glapi_sources += [
-               ]
-       elif gcc and env['machine'] == 'sparc':
-               glapi_sources += [
-                       'glapi_sparc.S'
-               ]
-       else:
-               pass
-       
-       glapi = env.ConvenienceLibrary(
-               target = 'glapi',
-               source = glapi_sources,
-       )
-       Export('glapi')
+    #
+    # Assembly sources
+    #
+    if env['gcc'] and env['platform'] != 'windows':
+        if env['machine'] == 'x86':
+            env.Append(CPPDEFINES = [
+                'USE_X86_ASM', 
+                'USE_MMX_ASM',
+                'USE_3DNOW_ASM',
+                'USE_SSE_ASM',
+            ])
+            glapi_sources += [
+                'glapi_x86.S',
+            ]
+        elif env['machine'] == 'x86_64':
+            env.Append(CPPDEFINES = [
+                'USE_X86_64_ASM', 
+            ])
+            glapi_sources += [
+                'glapi_x86-64.S'
+            ]
+        elif env['machine'] == 'ppc':
+            env.Append(CPPDEFINES = [
+                'USE_PPC_ASM', 
+                'USE_VMX_ASM', 
+            ])
+            glapi_sources += [
+            ]
+        elif env['machine'] == 'sparc':
+            glapi_sources += [
+                'glapi_sparc.S'
+            ]
+        else:
+            pass
+    
+    glapi = env.ConvenienceLibrary(
+        target = 'glapi',
+        source = glapi_sources,
+    )
+    Export('glapi')
diff --git a/src/mapi/vgapi/.gitignore b/src/mapi/vgapi/.gitignore
new file mode 100644 (file)
index 0000000..5becb99
--- /dev/null
@@ -0,0 +1 @@
+vgapi_tmp.h
index e54737aed18102704e490ef7e7b8c55cd1bf6852..7550c6d5ed44729d248e49bcd12a9ba901394d21 100644 (file)
 
 Import('*')
 
-if env['platform'] != 'winddk':
+env = env.Clone()
 
-       env = env.Clone()
-       
-       env.Append(CPPPATH = [
-               '#/src/mapi',
-               '#/src/glsl',
-               '#/src/mesa',
-       ])
-       
-       if env['platform'] == 'windows':
-               env.Append(CPPDEFINES = [
-                       '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
-                       'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 
-                       'WIN32_THREADS', # use Win32 thread API
-               ])       
-        env.Prepend(CPPPATH = ['#src/talloc'])
+env.Append(CPPPATH = [
+    '#/src/mapi',
+    '#/src/glsl',
+    '#/src/mesa',
+])
 
-       #
-       # Source files
-       #
-       
-       main_sources = [
-               'main/api_arrayelt.c',
-               'main/api_exec.c',
-               'main/api_loopback.c',
-               'main/api_noop.c',
-               'main/api_validate.c',
-               'main/accum.c',
-               'main/arbprogram.c',
-               'main/atifragshader.c',
-               'main/attrib.c',
-               'main/arrayobj.c',
-               'main/blend.c',
-               'main/bufferobj.c',
-               'main/buffers.c',
-               'main/clear.c',
-               'main/clip.c',
-               'main/colortab.c',
-               'main/condrender.c',
-               'main/context.c',
-               'main/convolve.c',
-               'main/cpuinfo.c',
-               'main/debug.c',
-               'main/depth.c',
-               'main/depthstencil.c',
-               'main/dlist.c',
-               'main/dlopen.c',
-               'main/drawpix.c',
-               'main/drawtex.c',
-               'main/enable.c',
-               'main/enums.c',
-               'main/eval.c',
-               'main/execmem.c',
-               'main/extensions.c',
-               'main/fbobject.c',
-               'main/feedback.c',
-               'main/ffvertex_prog.c',
-               'main/fog.c',
-               'main/formats.c',
-               'main/framebuffer.c',
-               'main/get.c',
-               'main/getstring.c',
-               'main/hash.c',
-               'main/hint.c',
-               'main/histogram.c',
-               'main/image.c',
-               'main/imports.c',
-               'main/light.c',
-               'main/lines.c',
-               'main/matrix.c',
-               'main/mipmap.c',
-               'main/mm.c',
-               'main/multisample.c',
-               'main/nvprogram.c',
-               'main/pack.c',
-               'main/pixel.c',
-               'main/pixelstore.c',
-               'main/pixeltransfer.c',
-               'main/points.c',
-               'main/polygon.c',
-               'main/querymatrix.c',
-               'main/queryobj.c',
-               'main/rastpos.c',
-               'main/readpix.c',
-               'main/remap.c',
-               'main/renderbuffer.c',
-               'main/scissor.c',
-               'main/shaderapi.c',
-               'main/shaderobj.c',
-               'main/shared.c',
-               'main/state.c',
-               'main/stencil.c',
-               'main/syncobj.c',
-               'main/texcompress.c',
-               'main/texcompress_s3tc.c',
-               'main/texcompress_fxt1.c',
-               'main/texenv.c',
-               'main/texenvprogram.c',
-               'main/texfetch.c',
-               'main/texformat.c',
-               'main/texgen.c',
-               'main/texgetimage.c',
-               'main/teximage.c',
-               'main/texobj.c',
-               'main/texpal.c',
-               'main/texparam.c',
-               'main/texrender.c',
-               'main/texstate.c',
-               'main/texstore.c',
-               'main/transformfeedback.c',
-               'main/uniforms.c',
-               'main/varray.c',
-               'main/version.c',
-               'main/viewport.c',
-               'main/vtxfmt.c',
-       ]
-       
-       math_sources = [
-               'math/m_debug_clip.c',
-               'math/m_debug_norm.c',
-               'math/m_debug_xform.c',
-               'math/m_eval.c',
-               'math/m_matrix.c',
-               'math/m_translate.c',
-               'math/m_vector.c',
-               'math/m_xform.c',
-       ]
-       
-       vbo_sources = [
-               'vbo/vbo_context.c',
-               'vbo/vbo_exec.c',
-               'vbo/vbo_exec_api.c',
-               'vbo/vbo_exec_array.c',
-               'vbo/vbo_exec_draw.c',
-               'vbo/vbo_exec_eval.c',
-               'vbo/vbo_rebase.c',
-               'vbo/vbo_split.c',
-               'vbo/vbo_split_copy.c',
-               'vbo/vbo_split_inplace.c',
-               'vbo/vbo_save.c',
-               'vbo/vbo_save_api.c',
-               'vbo/vbo_save_draw.c',
-               'vbo/vbo_save_loopback.c',
-       ]
-       
-       vf_sources = [
-               'vf/vf.c',
-               'vf/vf_generic.c',
-               'vf/vf_sse.c',
-       ]
-       
-       statetracker_sources = [
-               'state_tracker/st_atom.c',
-               'state_tracker/st_atom_blend.c',
-               'state_tracker/st_atom_clip.c',
-               'state_tracker/st_atom_constbuf.c',
-               'state_tracker/st_atom_depth.c',
-               'state_tracker/st_atom_framebuffer.c',
-               'state_tracker/st_atom_msaa.c',
-               'state_tracker/st_atom_pixeltransfer.c',
-               'state_tracker/st_atom_sampler.c',
-               'state_tracker/st_atom_scissor.c',
-               'state_tracker/st_atom_shader.c',
-               'state_tracker/st_atom_rasterizer.c',
-               'state_tracker/st_atom_stipple.c',
-               'state_tracker/st_atom_texture.c',
-               'state_tracker/st_atom_viewport.c',
-               'state_tracker/st_cb_accum.c',
-               'state_tracker/st_cb_bitmap.c',
-               'state_tracker/st_cb_blit.c',
-               'state_tracker/st_cb_bufferobjects.c',
-               'state_tracker/st_cb_clear.c',
-               'state_tracker/st_cb_condrender.c',
-               'state_tracker/st_cb_flush.c',
-               'state_tracker/st_cb_drawpixels.c',
-               'state_tracker/st_cb_drawtex.c',
-               'state_tracker/st_cb_eglimage.c',
-               'state_tracker/st_cb_fbo.c',
-               'state_tracker/st_cb_feedback.c',
-               'state_tracker/st_cb_program.c',
-               'state_tracker/st_cb_queryobj.c',
-               'state_tracker/st_cb_rasterpos.c',
-               'state_tracker/st_cb_readpixels.c',
-               'state_tracker/st_cb_strings.c',
-               'state_tracker/st_cb_texture.c',
-               'state_tracker/st_cb_viewport.c',
-               'state_tracker/st_cb_xformfb.c',
-               'state_tracker/st_context.c',
-               'state_tracker/st_debug.c',
-               'state_tracker/st_draw.c',
-               'state_tracker/st_draw_feedback.c',
-               'state_tracker/st_extensions.c',
-               'state_tracker/st_format.c',
-               'state_tracker/st_gen_mipmap.c',
-               'state_tracker/st_manager.c',
-               'state_tracker/st_mesa_to_tgsi.c',
-               'state_tracker/st_program.c',
-               'state_tracker/st_texture.c',
-       ]
-       
-       program_sources = [
-               'program/arbprogparse.c',
-               'program/hash_table.c',
-        'program/ir_to_mesa.cpp',
-               'program/lex.yy.c',
-               'program/nvfragparse.c',
-               'program/nvvertparse.c',
-               'program/program.c',
-               'program/program_parse.tab.c',
-               'program/program_parse_extra.c',
-               'program/prog_cache.c',
-               'program/prog_execute.c',
-               'program/prog_instruction.c',
-               'program/prog_noise.c',
-               'program/prog_optimize.c',
-               'program/prog_parameter.c',
-               'program/prog_parameter_layout.c',
-               'program/prog_print.c',
-               'program/prog_statevars.c',
-               'program/prog_uniform.c',
-               'program/programopt.c',
-               'program/sampler.cpp',
-               'program/symbol_table.c',
-       ]
-       
-       mesa_sources = (
-               main_sources +
-               math_sources +
-               program_sources +
-               vbo_sources +
-               vf_sources +
-               statetracker_sources
-       )
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = [
+        '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
+        'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+        'WIN32_THREADS', # use Win32 thread API
+    ])
+    env.Prepend(CPPPATH = ['#src/talloc'])
 
-       #
-       # Assembly sources
-       #
-       if gcc and env['machine'] == 'x86':
-               env.Append(CPPDEFINES = [
-                       'USE_X86_ASM', 
-                       'USE_MMX_ASM',
-                       'USE_3DNOW_ASM',
-                       'USE_SSE_ASM',
-               ])
-               mesa_sources += [
-                       'x86/common_x86.c',
-                       'x86/x86_xform.c',
-                       'x86/3dnow.c',
-                       'x86/sse.c',
-                       'x86/common_x86_asm.S',
-                       'x86/x86_xform2.S',
-                       'x86/x86_xform3.S',
-                       'x86/x86_xform4.S',
-                       'x86/x86_cliptest.S',
-                       'x86/mmx_blend.S',
-                       'x86/3dnow_xform1.S',
-                       'x86/3dnow_xform2.S',
-                       'x86/3dnow_xform3.S',
-                       'x86/3dnow_xform4.S',
-                       'x86/3dnow_normal.S',
-                       'x86/sse_xform1.S',
-                       'x86/sse_xform2.S',
-                       'x86/sse_xform3.S',
-                       'x86/sse_xform4.S',
-                       'x86/sse_normal.S',
-                       'x86/read_rgba_span_x86.S',
-               ]
-       elif gcc and env['machine'] == 'x86_64':
-               env.Append(CPPDEFINES = [
-                       'USE_X86_64_ASM', 
-               ])
-               mesa_sources += [
-                       'x86-64/x86-64.c',
-                       'x86-64/xform4.S',
-               ]
-       elif gcc and env['machine'] == 'ppc':
-               env.Append(CPPDEFINES = [
-                       'USE_PPC_ASM', 
-                       'USE_VMX_ASM', 
-               ])
-               mesa_sources += [
-                       'ppc/common_ppc.c',
-               ]
-       elif gcc and env['machine'] == 'sparc':
-               mesa_sources += [
-                       'sparc/sparc.c',
-                       'sparc/clip.S',
-                       'sparc/norm.S',
-                       'sparc/xform.S',
-               ]
-       else:
-               pass
-       
-       # Generate matypes.h
-       if gcc and env['machine'] in ('x86', 'x86_64'):
-               # See http://www.scons.org/wiki/UsingCodeGenerators
-               gen_matypes = env.Program(
-                       target = 'gen_matypes',
-                       source = 'x86/gen_matypes.c',
-               )
-               matypes = env.Command(
-                       'matypes.h',
-                       gen_matypes,
-                       gen_matypes[0].abspath + ' > $TARGET',
-               )
-               # Add the dir containing the generated header (somewhere inside  the
-               # build dir) to the include path  
-               env.Append(CPPPATH = [matypes[0].dir])
+#
+# Source files
+#
 
-       #
-       # Libraries
-       # 
+main_sources = [
+    'main/api_arrayelt.c',
+    'main/api_exec.c',
+    'main/api_loopback.c',
+    'main/api_noop.c',
+    'main/api_validate.c',
+    'main/accum.c',
+    'main/arbprogram.c',
+    'main/atifragshader.c',
+    'main/attrib.c',
+    'main/arrayobj.c',
+    'main/blend.c',
+    'main/bufferobj.c',
+    'main/buffers.c',
+    'main/clear.c',
+    'main/clip.c',
+    'main/colortab.c',
+    'main/condrender.c',
+    'main/context.c',
+    'main/convolve.c',
+    'main/cpuinfo.c',
+    'main/debug.c',
+    'main/depth.c',
+    'main/depthstencil.c',
+    'main/dlist.c',
+    'main/dlopen.c',
+    'main/drawpix.c',
+    'main/drawtex.c',
+    'main/enable.c',
+    'main/enums.c',
+    'main/eval.c',
+    'main/execmem.c',
+    'main/extensions.c',
+    'main/fbobject.c',
+    'main/feedback.c',
+    'main/ffvertex_prog.c',
+    'main/fog.c',
+    'main/formats.c',
+    'main/framebuffer.c',
+    'main/get.c',
+    'main/getstring.c',
+    'main/hash.c',
+    'main/hint.c',
+    'main/histogram.c',
+    'main/image.c',
+    'main/imports.c',
+    'main/light.c',
+    'main/lines.c',
+    'main/matrix.c',
+    'main/mipmap.c',
+    'main/mm.c',
+    'main/multisample.c',
+    'main/nvprogram.c',
+    'main/pack.c',
+    'main/pixel.c',
+    'main/pixelstore.c',
+    'main/pixeltransfer.c',
+    'main/points.c',
+    'main/polygon.c',
+    'main/querymatrix.c',
+    'main/queryobj.c',
+    'main/rastpos.c',
+    'main/readpix.c',
+    'main/remap.c',
+    'main/renderbuffer.c',
+    'main/scissor.c',
+    'main/shaderapi.c',
+    'main/shaderobj.c',
+    'main/shared.c',
+    'main/state.c',
+    'main/stencil.c',
+    'main/syncobj.c',
+    'main/texcompress.c',
+    'main/texcompress_s3tc.c',
+    'main/texcompress_fxt1.c',
+    'main/texenv.c',
+    'main/texenvprogram.c',
+    'main/texfetch.c',
+    'main/texformat.c',
+    'main/texgen.c',
+    'main/texgetimage.c',
+    'main/teximage.c',
+    'main/texobj.c',
+    'main/texpal.c',
+    'main/texparam.c',
+    'main/texrender.c',
+    'main/texstate.c',
+    'main/texstore.c',
+    'main/transformfeedback.c',
+    'main/uniforms.c',
+    'main/varray.c',
+    'main/version.c',
+    'main/viewport.c',
+    'main/vtxfmt.c',
+]
 
-       mesa = env.ConvenienceLibrary(
-               target = 'mesa',
-               source = mesa_sources,
-       )
-       Export('mesa')
+math_sources = [
+    'math/m_debug_clip.c',
+    'math/m_debug_norm.c',
+    'math/m_debug_xform.c',
+    'math/m_eval.c',
+    'math/m_matrix.c',
+    'math/m_translate.c',
+    'math/m_vector.c',
+    'math/m_xform.c',
+]
+
+vbo_sources = [
+    'vbo/vbo_context.c',
+    'vbo/vbo_exec.c',
+    'vbo/vbo_exec_api.c',
+    'vbo/vbo_exec_array.c',
+    'vbo/vbo_exec_draw.c',
+    'vbo/vbo_exec_eval.c',
+    'vbo/vbo_rebase.c',
+    'vbo/vbo_split.c',
+    'vbo/vbo_split_copy.c',
+    'vbo/vbo_split_inplace.c',
+    'vbo/vbo_save.c',
+    'vbo/vbo_save_api.c',
+    'vbo/vbo_save_draw.c',
+    'vbo/vbo_save_loopback.c',
+]
+
+vf_sources = [
+    'vf/vf.c',
+    'vf/vf_generic.c',
+    'vf/vf_sse.c',
+]
+
+statetracker_sources = [
+    'state_tracker/st_atom.c',
+    'state_tracker/st_atom_blend.c',
+    'state_tracker/st_atom_clip.c',
+    'state_tracker/st_atom_constbuf.c',
+    'state_tracker/st_atom_depth.c',
+    'state_tracker/st_atom_framebuffer.c',
+    'state_tracker/st_atom_msaa.c',
+    'state_tracker/st_atom_pixeltransfer.c',
+    'state_tracker/st_atom_sampler.c',
+    'state_tracker/st_atom_scissor.c',
+    'state_tracker/st_atom_shader.c',
+    'state_tracker/st_atom_rasterizer.c',
+    'state_tracker/st_atom_stipple.c',
+    'state_tracker/st_atom_texture.c',
+    'state_tracker/st_atom_viewport.c',
+    'state_tracker/st_cb_accum.c',
+    'state_tracker/st_cb_bitmap.c',
+    'state_tracker/st_cb_blit.c',
+    'state_tracker/st_cb_bufferobjects.c',
+    'state_tracker/st_cb_clear.c',
+    'state_tracker/st_cb_condrender.c',
+    'state_tracker/st_cb_flush.c',
+    'state_tracker/st_cb_drawpixels.c',
+    'state_tracker/st_cb_drawtex.c',
+    'state_tracker/st_cb_eglimage.c',
+    'state_tracker/st_cb_fbo.c',
+    'state_tracker/st_cb_feedback.c',
+    'state_tracker/st_cb_program.c',
+    'state_tracker/st_cb_queryobj.c',
+    'state_tracker/st_cb_rasterpos.c',
+    'state_tracker/st_cb_readpixels.c',
+    'state_tracker/st_cb_strings.c',
+    'state_tracker/st_cb_texture.c',
+    'state_tracker/st_cb_viewport.c',
+    'state_tracker/st_cb_xformfb.c',
+    'state_tracker/st_context.c',
+    'state_tracker/st_debug.c',
+    'state_tracker/st_draw.c',
+    'state_tracker/st_draw_feedback.c',
+    'state_tracker/st_extensions.c',
+    'state_tracker/st_format.c',
+    'state_tracker/st_gen_mipmap.c',
+    'state_tracker/st_manager.c',
+    'state_tracker/st_mesa_to_tgsi.c',
+    'state_tracker/st_program.c',
+    'state_tracker/st_texture.c',
+]
+
+program_sources = [
+    'program/arbprogparse.c',
+    'program/hash_table.c',
+    'program/ir_to_mesa.cpp',
+    'program/lex.yy.c',
+    'program/nvfragparse.c',
+    'program/nvvertparse.c',
+    'program/program.c',
+    'program/program_parse.tab.c',
+    'program/program_parse_extra.c',
+    'program/prog_cache.c',
+    'program/prog_execute.c',
+    'program/prog_instruction.c',
+    'program/prog_noise.c',
+    'program/prog_optimize.c',
+    'program/prog_parameter.c',
+    'program/prog_parameter_layout.c',
+    'program/prog_print.c',
+    'program/prog_statevars.c',
+    'program/prog_uniform.c',
+    'program/programopt.c',
+    'program/sampler.cpp',
+    'program/symbol_table.c',
+]
+
+mesa_sources = (
+    main_sources +
+    math_sources +
+    program_sources +
+    vbo_sources +
+    vf_sources +
+    statetracker_sources
+)
+
+#
+# Assembly sources
+#
+if env['gcc'] and env['machine'] == 'x86':
+    env.Append(CPPDEFINES = [
+        'USE_X86_ASM',
+        'USE_MMX_ASM',
+        'USE_3DNOW_ASM',
+        'USE_SSE_ASM',
+    ])
+    mesa_sources += [
+        'x86/common_x86.c',
+        'x86/x86_xform.c',
+        'x86/3dnow.c',
+        'x86/sse.c',
+        'x86/common_x86_asm.S',
+        'x86/x86_xform2.S',
+        'x86/x86_xform3.S',
+        'x86/x86_xform4.S',
+        'x86/x86_cliptest.S',
+        'x86/mmx_blend.S',
+        'x86/3dnow_xform1.S',
+        'x86/3dnow_xform2.S',
+        'x86/3dnow_xform3.S',
+        'x86/3dnow_xform4.S',
+        'x86/3dnow_normal.S',
+        'x86/sse_xform1.S',
+        'x86/sse_xform2.S',
+        'x86/sse_xform3.S',
+        'x86/sse_xform4.S',
+        'x86/sse_normal.S',
+        'x86/read_rgba_span_x86.S',
+    ]
+elif env['gcc'] and env['machine'] == 'x86_64':
+    env.Append(CPPDEFINES = [
+        'USE_X86_64_ASM',
+    ])
+    mesa_sources += [
+        'x86-64/x86-64.c',
+        'x86-64/xform4.S',
+    ]
+elif env['gcc'] and env['machine'] == 'ppc':
+    env.Append(CPPDEFINES = [
+        'USE_PPC_ASM',
+        'USE_VMX_ASM',
+    ])
+    mesa_sources += [
+        'ppc/common_ppc.c',
+    ]
+elif env['gcc'] and env['machine'] == 'sparc':
+    mesa_sources += [
+        'sparc/sparc.c',
+        'sparc/clip.S',
+        'sparc/norm.S',
+        'sparc/xform.S',
+    ]
+else:
+    pass
+
+# Generate matypes.h
+if env['gcc'] and env['machine'] in ('x86', 'x86_64'):
+    # See http://www.scons.org/wiki/UsingCodeGenerators
+    gen_matypes = env.Program(
+        target = 'gen_matypes',
+        source = 'x86/gen_matypes.c',
+    )
+    matypes = env.Command(
+        'matypes.h',
+        gen_matypes,
+        gen_matypes[0].abspath + ' > $TARGET',
+    )
+    # Add the dir containing the generated header (somewhere inside  the
+    # build dir) to the include path
+    env.Append(CPPPATH = [matypes[0].dir])
+
+#
+# Libraries
+#
+
+mesa = env.ConvenienceLibrary(
+    target = 'mesa',
+    source = mesa_sources,
+)
+
+env.Alias('mesa', mesa)
+
+Export('mesa')