st/xorg: Cleanly shutdown
[mesa.git] / scons / gallium.py
index 217478bd50df467d50903e0c0cb1315dd4ad76b4..587294af71dcbd0e7bc7f10d498f74d7880e28db 100644 (file)
@@ -38,21 +38,24 @@ import SCons.Action
 import SCons.Builder
 import SCons.Scanner
 
+import fixes
+
 
 def quietCommandLines(env):
     # Quiet command lines
     # See also http://www.scons.org/wiki/HidingCommandLinesInOutput
-    env['ASCOMSTR'] = "Assembling $SOURCE ..."
-    env['CCCOMSTR'] = "Compiling $SOURCE ..."
-    env['SHCCCOMSTR'] = "Compiling $SOURCE ..."
-    env['CXXCOMSTR'] = "Compiling $SOURCE ..."
-    env['SHCXXCOMSTR'] = "Compiling $SOURCE ..."
-    env['ARCOMSTR'] = "Archiving $TARGET ..."
-    env['RANLIBCOMSTR'] = "Indexing $TARGET ..."
-    env['LINKCOMSTR'] = "Linking $TARGET ..."
-    env['SHLINKCOMSTR'] = "Linking $TARGET ..."
-    env['LDMODULECOMSTR'] = "Linking $TARGET ..."
-    env['SWIGCOMSTR'] = "Generating $TARGET ..."
+    env['ASCOMSTR'] = "  Assembling $SOURCE ..."
+    env['ASPPCOMSTR'] = "  Assembling $SOURCE ..."
+    env['CCCOMSTR'] = "  Compiling $SOURCE ..."
+    env['SHCCCOMSTR'] = "  Compiling $SOURCE ..."
+    env['CXXCOMSTR'] = "  Compiling $SOURCE ..."
+    env['SHCXXCOMSTR'] = "  Compiling $SOURCE ..."
+    env['ARCOMSTR'] = "  Archiving $TARGET ..."
+    env['RANLIBCOMSTR'] = "  Indexing $TARGET ..."
+    env['LINKCOMSTR'] = "  Linking $TARGET ..."
+    env['SHLINKCOMSTR'] = "  Linking $TARGET ..."
+    env['LDMODULECOMSTR'] = "  Linking $TARGET ..."
+    env['SWIGCOMSTR'] = "  Generating $TARGET ..."
 
 
 def createConvenienceLibBuilder(env):
@@ -331,14 +334,27 @@ def generate(env):
         else:
             ccflags += ['-O3', '-g3']
         if env['profile']:
-            ccflags += ['-pg']
+            # See http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#Which_options_should_I_pass_to_gcc_when_compiling_for_profiling?
+            ccflags += [
+                '-fno-omit-frame-pointer',
+                '-fno-optimize-sibling-calls',
+            ]
         if env['machine'] == 'x86':
             ccflags += [
                 '-m32',
                 #'-march=pentium4',
-                '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
                 #'-mfpmath=sse',
             ]
+            if platform != 'windows':
+                # XXX: -mstackrealign causes stack corruption on MinGW. Ditto
+                # for -mincoming-stack-boundary=2.  Still enable it on other
+                # platforms for now, but we can't rely on it for cross platform
+                # code. We have to use __attribute__((force_align_arg_pointer))
+                # instead.
+                ccflags += [
+                    '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
+                    '-mstackrealign', # ensure stack is aligned
+                ]
         if env['machine'] == 'x86_64':
             ccflags += ['-m64']
         # See also:
@@ -459,6 +475,8 @@ def generate(env):
         shlinkflags += [
             '-Wl,-Bsymbolic',
         ]
+        # Handle circular dependencies in the libraries
+        env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
     if platform == 'windows' and msvc:
         # See also:
         # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx