[Mesa-dev] [PATCH] scons: Add Haiku build support

Alexander von Gluck kallisti5 at unixzen.com
Mon Jan 16 10:48:35 PST 2012


Enables building stock Mesa under the Haiku operating system.
---
  common.py              |    2 +-
  scons/gallium.py       |    2 ++
  src/SConscript         |    5 +++--
  src/gallium/SConscript |   14 ++++++++++----
  src/glu/sgi/SConscript |   16 +++++++++++-----
  5 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/common.py b/common.py
index 5578f72..2674f32 100644
--- a/common.py
+++ b/common.py
@@ -83,7 +83,7 @@ def AddOptions(opts):
  	opts.Add(EnumOption('machine', 'use machine-specific assembly code', 
default_machine,
  											 allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
  	opts.Add(EnumOption('platform', 'target platform', host_platform,
-											 allowed_values=('linux', 'windows', 'darwin', 'cygwin', 
'sunos', 'freebsd8')))
+											 allowed_values=('linux', 'windows', 'darwin', 'cygwin', 
'sunos', 'freebsd8', 'haiku')))
  	opts.Add(BoolOption('embedded', 'embedded build', 'no'))
  	opts.Add('toolchain', 'compiler toolchain', default_toolchain)
  	opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 
'no'))
diff --git a/scons/gallium.py b/scons/gallium.py
index 221d184..5a0c6fe 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -289,6 +289,8 @@ def generate(env):
              cppdefines += ['_DEBUG']
      if platform == 'windows':
          cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
+    if platform == 'haiku':
+        cppdefines += ['BEOS_THREADS']
      if env['embedded']:
          cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
      env.Append(CPPDEFINES = cppdefines)
diff --git a/src/SConscript b/src/SConscript
index 0a30838..ba6be0b 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -22,10 +22,11 @@ SConscript('mesa/SConscript')
  SConscript('mapi/vgapi/SConscript')

  if not env['embedded']:
-    if env['platform'] not in ['windows', 'darwin']:
+    if env['platform'] not in ['windows', 'darwin', 'haiku']:
          SConscript('glx/SConscript')
-    if env['platform'] not in ['darwin']:
+    if env['platform'] not in ['darwin', 'haiku']:
          SConscript('egl/main/SConscript')
+    if env['platform'] not in ['darwin']:
          SConscript('glu/sgi/SConscript')

      if env['gles']:
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 4f46506..8efd04c 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -10,16 +10,22 @@ SConscript('auxiliary/SConscript')
  # Drivers
  #

+# These are common and work across all platforms
  SConscript([
      'drivers/galahad/SConscript',
      'drivers/identity/SConscript',
-    'drivers/llvmpipe/SConscript',
      'drivers/rbug/SConscript',
      'drivers/softpipe/SConscript',
-    'drivers/svga/SConscript',
      'drivers/trace/SConscript',
  ])

+# These drivers do not build on Haiku
+if env['platform'] not in ['haiku']:
+    SConscript([
+        'drivers/llvmpipe/SConscript',
+        'drivers/svga/SConscript',
+    ])
+
  if not env['msvc']:
      # These drivers do not build on MSVC compilers
      SConscript([
@@ -53,7 +59,7 @@ SConscript('winsys/sw/null/SConscript')

  if not env['embedded']:
      SConscript('state_trackers/vega/SConscript')
-    if env['platform'] not in ['darwin']:
+    if env['platform'] not in ['darwin', 'haiku']:
          SConscript('state_trackers/egl/SConscript')

      if env['x11']:
@@ -83,7 +89,7 @@ SConscript([
  ])

  if not env['embedded']:
-    if env['platform'] not in ['darwin']:
+    if env['platform'] not in ['darwin', 'haiku']:
          SConscript([
              'targets/egl-static/SConscript'
          ])
diff --git a/src/glu/sgi/SConscript b/src/glu/sgi/SConscript
index 94c7426..97405d8 100644
--- a/src/glu/sgi/SConscript
+++ b/src/glu/sgi/SConscript
@@ -122,12 +122,18 @@ else:
      ])
      target = 'glu'

-glu = env.SharedLibrary(
-    target = target,
-    source = sources
-)
+if env['platform'] == 'haiku':
+    glu = env.StaticLibrary(
+        target = target,
+        source = sources
+    )
+else:
+    glu = env.SharedLibrary(
+        target = target,
+        source = sources
+    )
+    env.Alias('glu', env.InstallSharedLibrary(glu, version=(1, 3, 0)))

-env.Alias('glu', env.InstallSharedLibrary(glu, version=(1, 3, 0)))

  if env['platform'] == 'windows':
      glu = env.FindIxes(glu, 'LIBPREFIX', 'LIBSUFFIX')
-- 
1.7.7.2



More information about the mesa-dev mailing list