From 4509f39a591e170cb1efef0b5e21658d29a2f896 Mon Sep 17 00:00:00 2001
From: "mpcomplete@google.com"
 <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 29 Oct 2008 18:35:46 +0000
Subject: Fix various Gears build breaks caused by latest Hammer changes.
 Review URL: http://codereview.chromium.org/7999

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4151 0039d316-1c4b-4281-b951-d872f2087c98
---
 gears/SConscript         | 57 +++++++++++++++++++++++++-----------------------
 gears/SConscript.common  |  4 ++--
 gears/SConscript.dll     | 17 +++++++++++----
 gears/SConscript.libjpeg |  2 +-
 gears/SConscript.sqlite  |  2 +-
 5 files changed, 47 insertions(+), 35 deletions(-)

(limited to 'gears')

diff --git a/gears/SConscript b/gears/SConscript
index bfc0b65..f24eed3 100644
--- a/gears/SConscript
+++ b/gears/SConscript
@@ -138,14 +138,16 @@ env.Replace(
 )
 
 # Add our tools to the PATH.
-if os.path.exists(env.Dir('#/$PRIVATE_THIRD_PARTY_DIR').abspath):
-  paths = []
-  if env['OS'] in ['win32', 'wince']:
-    # Clear out our environment so we don't accidentally use the system's libs.
+if env['OS'] in ['win32', 'wince']:
+  if os.path.exists(env.Dir('#/$PRIVATE_THIRD_PARTY_DIR').abspath):
+    # Clear out our environment so we don't accidentally use the system's
+    # libs.
     env['ENV']['PATH'] = ''
     env['ENV']['LIB'] = ''
     env['ENV']['INCLUDE'] = ''
 
+    paths = []
+
     # Keep system32 for 'xcopy'.
     paths += [env.subst('${ENV["SYSTEMROOT"]}/system32')]
     if env['OS'] == 'win32':
@@ -170,21 +172,25 @@ if os.path.exists(env.Dir('#/$PRIVATE_THIRD_PARTY_DIR').abspath):
           env.subst('$VC80/smartdevices/sdktools'),
       ]
 
-    paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath]
+    paths += [
+        env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/wix/v3_0_2925/files').abspath]
 
-  paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/gnu/files').abspath]
-  paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/python_24').abspath]
+    paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/gnu/files').abspath]
+    paths += [env.Dir('#/$PRIVATE_THIRD_PARTY_DIR/python_24').abspath]
 
-  # Prepend them so our tools come first.
-  for each in reversed(paths):
-    env.PrependENVPath('PATH', each)
-else:
-  # If we don't have a private third_party dir, we expect the system
-  # environment to be set up correctly to point to tool paths.
-  env['ENV']['PATH'] = os.environ['PATH']
-  env['ENV']['LIB'] = os.environ['LIB']
-  env['ENV']['INCLUDE'] = os.environ['INCLUDE']
+    # Prepend them so our tools come first.
+    for each in reversed(paths):
+      env.PrependENVPath('PATH', each)
+  else:
+    # If we don't have a private third_party dir, we expect the system
+    # environment to be set up correctly to point to tool paths.
+    env['ENV']['PATH'] = os.environ['PATH']
+    env['ENV']['LIB'] = os.environ['LIB']
+    env['ENV']['INCLUDE'] = os.environ['INCLUDE']
 
+  # HACK to disable manifest creation, since it breaks all the time.
+  env['LINKCOM'] = env['LINKCOM'][0]
+  env['SHLINKCOM'] = env['SHLINKCOM'][0]
 
 # Building M4 files
 env.Tool('m4')
@@ -257,12 +263,10 @@ env.Replace(
         '.',
         '$COMMON_OUTDIR',
     ],
-    LIBPATH = [
-        '$LIBS_DIR',
-    ],
     CFLAGS = [],
     CCFLAGS = [],
     CXXFLAGS = [],
+    CCPDBFLAGS = [],
     CPPDEFINES = [
     # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs
     # this defined to work with the gecko SDK that we've built.
@@ -408,7 +412,6 @@ if env['OS'] in ['win32', 'wince']:
       ],
       CPPFLAGS = [
           '/nologo',
-          '/Zi',  # TODO: Chrome defines /Z7, no idea what these are.
           '/Zc:wchar_t-',
           '/c',
           '/W3',
@@ -424,6 +427,9 @@ if env['OS'] in ['win32', 'wince']:
           '$VC80_CPPPATH',
           '$THIRD_PARTY_DIR/breakpad/src',
       ],
+      CCPDBFLAGS = [
+          '/Zi',  # TODO: Chrome defines /Z7, no idea what these are.
+      ],
       LIBPATH = [
           '$VC80_LIBPATH',
       ],
@@ -683,13 +689,10 @@ elif env['OS'] == 'osx':
 
 # TODO(mpcomplete): fix this and properly separate our DLL flags from EXE
 # flags.
-env.Append(
-    SHLINKFLAGS = [
-        '$LINKFLAGS',
-        '/DLL',
-    ],
-)
-    
+env.Append(SHLINKFLAGS = ['$LINKFLAGS'])
+if env['OS'] in ['wince', 'win32']:
+  env.Append(SHLINKFLAGS = ['/DLL'])
+
 # Load all the components
 
 sconscripts = [
diff --git a/gears/SConscript.common b/gears/SConscript.common
index a497601..0e1aa43 100644
--- a/gears/SConscript.common
+++ b/gears/SConscript.common
@@ -147,13 +147,13 @@ common_targets['src'] = [env.SharedObject(bin) for bin in bins]
 
 Export('common_targets')
 
-env.Program('ipc_test', ipc_test_srcs)
+env.ChromeProgram('ipc_test', ipc_test_srcs)
 
 # Note: crash_sender.exe name needs to stay in sync with name used in
 # exception_handler_win32.cc and exception_handler_osx/google_breakpad.mm.
 crash_sender = None
 if env['OS'] == 'win32':
-  crash_sender = env.Program('crash_sender', crash_sender_srcs,
+  crash_sender = env.ChromeProgram('crash_sender', crash_sender_srcs,
       LIBS = Split('advapi32.lib shell32.lib wininet.lib'))
 elif env['OS'] == 'osx':
   pass
diff --git a/gears/SConscript.dll b/gears/SConscript.dll
index 4759308..8f17a4e 100644
--- a/gears/SConscript.dll
+++ b/gears/SConscript.dll
@@ -1324,8 +1324,17 @@ if env['OS'] in ['win32', 'wince']:
   env.Depends(ui_res, html_m4s)
   env.Depends(module_res, m4s)
 
-module = env.ChromeSharedLibrary('gears',
-    srcs['all'] + libs + dll_resources + browser_specific_objects)
+# HACK: gears and vista_broker share some inputs, but ChromeSharedLibrary
+# and ChromeProgram use slightly different environments, so SCons complains if
+# we try to compile those inputs differently.  So we compile them using a
+# common environment here first.
+common_srcs = [src for src in srcs['all'] if str(src) in vista_broker_srcs]
+gears_srcs = [src for src in srcs['all'] if str(src) not in vista_broker_srcs]
+common_objs = env.SharedObject(common_srcs)
+vista_broker_objs = env.SharedObject(vista_broker_srcs)
+module = env.ChromeSharedLibrary('gears-$OS-$ARCH-$MODE-${BROWSER}',
+    common_objs + gears_srcs + libs + dll_resources + browser_specific_objects)
+module = env.InstallAs('${SHLIBPREFIX}gears${SHLIBSUFFIX}', module)
 env.Alias('gears', module)
 
 if env['OS'] == 'wince':
@@ -1337,6 +1346,6 @@ if env['OS'] == 'win32' and env['BROWSER'] == 'IE':
 # Note: vista_broker.exe needs to stay in sync with name used in
 # desktop_win32.cc.
 # TODO(aa): This can move to common_outdir like crash_sender.exe
-  vista_broker = env.Program('vista_broker',
-      vista_broker_srcs + vista_broker_resources)
+  vista_broker = env.ChromeProgram('vista_broker',
+      vista_broker_objs + vista_broker_resources)
   env.Alias('gears', vista_broker)
diff --git a/gears/SConscript.libjpeg b/gears/SConscript.libjpeg
index 167f026..a4237c4 100644
--- a/gears/SConscript.libjpeg
+++ b/gears/SConscript.libjpeg
@@ -20,7 +20,7 @@ env.Replace(
 
 if env['OS'] in ['osx', 'linux']:
   env.Append(
-      CFLAGS = [
+      CCFLAGS = [
           '-Wno-main',
       ],
   )
diff --git a/gears/SConscript.sqlite b/gears/SConscript.sqlite
index 09fe8fa9..c0c7e66 100644
--- a/gears/SConscript.sqlite
+++ b/gears/SConscript.sqlite
@@ -75,7 +75,7 @@ elif env['OS'] == 'linux':
   )
 elif env['OS'] == 'osx':
   env.Append(
-      CFLAGS = [
+      CCFLAGS = [
           '-Wno-uninitialized',
           '-Wno-pointer-sign',
       ],
-- 
cgit v1.1