Fix linking of mksnapshot
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 9 Feb 2009 16:00:55 +0000 (16:00 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 9 Feb 2009 16:00:55 +0000 (16:00 +0000)
Changelist http://codereview.chromium.org/20177 caused linking of mksnapshot to fail as link libraries where not specified. Updated build to link mksnapshot with pthread on Linux and Mac OS and with winmm on Windows.
Review URL: http://codereview.chromium.org/21171

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1241 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

SConstruct
src/SConscript

index 1aefee80eaa844469045687e5558dc9148cdadeb..a9585c6497c8e180640c5edde9ab9452dddcdaea 100644 (file)
@@ -144,6 +144,29 @@ V8_EXTRA_FLAGS = {
 }
 
 
+MKSNAPSHOT_EXTRA_FLAGS = {
+  'gcc': {
+    'os:linux': {
+      'LIBS': ['pthread'],
+    },
+    'os:macos': {
+      'LIBS': ['pthread'],
+    },
+    'os:freebsd': {
+      'LIBS': ['pthread'],
+    },
+    'os:win32': {
+      'LIBS': ['winmm'],
+    },
+  },
+  'msvc': {
+    'all': {
+      'LIBS': ['winmm']
+    }
+  }
+}
+
+
 JSCRE_EXTRA_FLAGS = {
   'gcc': {
     'all': {
@@ -540,6 +563,7 @@ def BuildSpecific(env, mode, env_overrides):
 
   library_flags = context.AddRelevantFlags(os.environ, LIBRARY_FLAGS)
   v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS)
+  mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS)
   jscre_flags = context.AddRelevantFlags(library_flags, JSCRE_EXTRA_FLAGS)
   dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS)
   cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS)
@@ -548,7 +572,7 @@ def BuildSpecific(env, mode, env_overrides):
 
   context.flags = {
     'v8': v8_flags,
-    'mksnapshot': v8_flags,
+    'mksnapshot': mksnapshot_flags,
     'jscre': jscre_flags,
     'dtoa': dtoa_flags,
     'cctest': cctest_flags,
index a6d09482f912f7dea629b8aec54daca29d93e1ee..27bd638f8c17487fdca5c1af27dd4c4ddd37bf98 100644 (file)
@@ -150,8 +150,10 @@ def ConfigureObjectFiles():
 
   # Create snapshot if necessary.
   empty_snapshot_obj = context.ConfigureObject(env, 'snapshot-empty.cc')
+  mksnapshot_env = env.Copy()
+  mksnapshot_env.Replace(**context.flags['mksnapshot'])
   mksnapshot_src = 'mksnapshot.cc'
-  mksnapshot = env.Program('mksnapshot', [mksnapshot_src, libraries_obj, non_snapshot_files, empty_snapshot_obj], PDB='mksnapshot.exe.pdb')
+  mksnapshot = mksnapshot_env.Program('mksnapshot', [mksnapshot_src, libraries_obj, non_snapshot_files, empty_snapshot_obj], PDB='mksnapshot.exe.pdb')
   if context.use_snapshot:
     if context.build_snapshot:
       snapshot_cc = env.Snapshot('snapshot.cc', mksnapshot, LOGFILE=File('snapshot.log').abspath)