Author: [email protected]
Date: Fri May  1 04:38:26 2009
New Revision: 1831

Modified:
    branches/1.1/SConstruct
    branches/1.1/src/SConscript
    branches/1.1/src/api.cc
    branches/1.1/test/cctest/SConscript
    branches/1.1/tools/v8.xcodeproj/project.pbxproj
    branches/1.1/tools/visual_studio/v8_base.vcproj
    branches/1.1/tools/visual_studio/v8_base_arm.vcproj
    branches/1.1/tools/visual_studio/v8_cctest.vcproj
    branches/1.1/tools/visual_studio/v8_cctest_arm.vcproj

Log:
Merge version info handling to branches/1.1.

Merge r1826 (http://codereview.chromium.org/100104), r1827
(http://codereview.chromium.org/100201) and r1828
(http://codereview.chromium.org/100211) to the V8 version 1.1 branch. This  
adds
the new version handling to the branch.

Changed the version number from 1.1.10.5 to 1.1.10.6.

Set a specific soname of libv8.so.1 for Linux shared libraries. This should  
make
it easier for Linux package maintainers to include V8 1.1 in Linux
distributions.

Note that the gyp file changes in r1826 is not merged in, as there is no gyp
file on this branch.

BUG=151

Review URL: http://codereview.chromium.org/100251



Modified: branches/1.1/SConstruct
==============================================================================
--- branches/1.1/SConstruct     (original)
+++ branches/1.1/SConstruct     Fri May  1 04:38:26 2009
@@ -191,7 +191,12 @@
        'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
      },
      'os:linux': {
-      'WARNINGFLAGS': ['-pedantic']
+      'WARNINGFLAGS': ['-pedantic'],
+      'library:shared': {
+        'soname:on': {
+          'LINKFLAGS': ['-Wl,-soname,${SONAME}']
+        }
+      }
      },
      'os:macos': {
        'WARNINGFLAGS': ['-pedantic']
@@ -470,6 +475,11 @@
      'default': 'static',
      'help': 'the type of library to produce'
    },
+  'soname': {
+    'values': ['on', 'off'],
+    'default': 'off',
+    'help': 'turn on setting soname for Linux shared library'
+  },
    'msvcrt': {
      'values': ['static', 'shared'],
      'default': 'static',
@@ -515,6 +525,49 @@
    return result


+def GetVersionComponents():
+  MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)")
+  MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)")
+  BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)")
+  PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)")
+
+  patterns = [MAJOR_VERSION_PATTERN,
+              MINOR_VERSION_PATTERN,
+              BUILD_NUMBER_PATTERN,
+              PATCH_LEVEL_PATTERN]
+
+  source = open(join(root_dir, 'src', 'version.cc')).read()
+  version_components = []
+  for pattern in patterns:
+    match = pattern.search(source)
+    if match:
+      version_components.append(match.group(1).strip())
+    else:
+      version_components.append('0')
+
+  return version_components
+
+
+def GetVersion():
+  version_components = GetVersionComponents()
+
+  if version_components[len(version_components) - 1] == '0':
+    version_components.pop()
+  return '.'.join(version_components)
+
+
+def GetSpecificSONAME():
+  SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"")
+
+  source = open(join(root_dir, 'src', 'version.cc')).read()
+  match = SONAME_PATTERN.search(source)
+
+  if match:
+    return match.group(1).strip()
+  else:
+    return ''
+
+
  def SplitList(str):
    return [ s for s in str.split(",") if len(s) > 0 ]

@@ -537,6 +590,10 @@
      Abort("Profiling on windows only supported for static library.")
    if env['prof'] == 'oprofile' and env['os'] != 'linux':
      Abort("OProfile is only supported on Linux.")
+  if env['os'] == 'win32' and env['soname'] == 'on':
+    Abort("Shared Object soname not applicable for Windows.")
+  if env['soname'] == 'on' and env['library'] == 'static':
+    Abort("Shared Object soname not applicable for static library.")
    for (name, option) in SIMPLE_OPTIONS.iteritems():
      if (not option.get('default')) and (name not in ARGUMENTS):
        message = ("A value for option %s must be specified (%s)." %
@@ -667,10 +724,22 @@
      'd8': d8_flags
    }

+  # Generate library base name.
    target_id = mode
    suffix = SUFFIXES[target_id]
    library_name = 'v8' + suffix
+  version = GetVersion()
+  if context.options['soname'] == 'on':
+    # When building shared object with SONAME version the library name.
+    library_name += '-' + version
    env['LIBRARY'] = library_name
+
+  # Generate library SONAME if required by the build.
+  if context.options['soname'] == 'on':
+    soname = GetSpecificSONAME()
+    if soname == '':
+      soname = 'lib' + library_name + '.so'
+    env['SONAME'] = soname

    # Build the object files by invoking SCons recursively.
    (object_files, shell_files, mksnapshot) = env.SConscript(

Modified: branches/1.1/src/SConscript
==============================================================================
--- branches/1.1/src/SConscript (original)
+++ branches/1.1/src/SConscript Fri May  1 04:38:26 2009
@@ -50,7 +50,8 @@
      'scopeinfo.cc', 'scopes.cc', 'serialize.cc', 'snapshot-common.cc',
      'spaces.cc', 'string-stream.cc', 'stub-cache.cc', 'token.cc', 'top.cc',
      'unicode.cc', 'usage-analyzer.cc', 'utils.cc', 'v8-counters.cc',
-    'v8.cc', 'v8threads.cc', 'variables.cc', 'virtual-frame.cc', 'zone.cc'
+    'v8.cc', 'v8threads.cc', 'variables.cc', 'version.cc',
+    'virtual-frame.cc', 'zone.cc'
    ],
    'arch:arm': [
      'assembler-arm.cc', 'builtins-arm.cc', 'codegen-arm.cc', 'cpu-arm.cc',

Modified: branches/1.1/src/api.cc
==============================================================================
--- branches/1.1/src/api.cc     (original)
+++ branches/1.1/src/api.cc     Fri May  1 04:38:26 2009
@@ -37,6 +37,7 @@
  #include "serialize.h"
  #include "snapshot.h"
  #include "v8threads.h"
+#include "version.h"


  #define LOG_API(expr) LOG(ApiEntryCall(expr))
@@ -2373,7 +2374,9 @@


  const char* v8::V8::GetVersion() {
-  return "1.1.10.5";
+  static v8::internal::EmbeddedVector<char, 128> buffer;
+  v8::internal::Version::GetString(buffer);
+  return buffer.start();
  }



Modified: branches/1.1/test/cctest/SConscript
==============================================================================
--- branches/1.1/test/cctest/SConscript (original)
+++ branches/1.1/test/cctest/SConscript Fri May  1 04:38:26 2009
@@ -54,7 +54,8 @@
      'test-spaces.cc',
      'test-strings.cc',
      'test-threads.cc',
-    'test-utils.cc'
+    'test-utils.cc',
+    'test-version.cc'
    ],
    'arch:arm':  ['test-assembler-arm.cc', 'test-disasm-arm.cc'],
    'arch:ia32': [

Modified: branches/1.1/tools/v8.xcodeproj/project.pbxproj
==============================================================================
--- branches/1.1/tools/v8.xcodeproj/project.pbxproj     (original)
+++ branches/1.1/tools/v8.xcodeproj/project.pbxproj     Fri May  1 04:38:26 2009
@@ -132,6 +132,8 @@
                89A88E2C0E71A6D20043BA31 /* v8threads.cc in Sources */ = {isa = 
 
PBXBuildFile; fileRef = 897FF19D0E719B8F00D62E90 /* v8threads.cc */; };
                89A88E2D0E71A6D50043BA31 /* variables.cc in Sources */ = {isa = 
 
PBXBuildFile; fileRef = 897FF19F0E719B8F00D62E90 /* variables.cc */; };
                89A88E2E0E71A6D60043BA31 /* zone.cc in Sources */ = {isa = 
PBXBuildFile;  
fileRef = 897FF1A20E719B8F00D62E90 /* zone.cc */; };
+               89B933AF0FAA0F9600201304 /* version.cc in Sources */ = {isa =  
PBXBuildFile; fileRef = 897FF32F0FAA0ED200136CF6 /* version.cc */; };
+               89B933B00FAA0F9D00201304 /* version.cc in Sources */ = {isa =  
PBXBuildFile; fileRef = 897FF32F0FAA0ED200136CF6 /* version.cc */; };
                89F23C3F0E78D5B2006B2466 /* accessors.cc in Sources */ = {isa = 
 
PBXBuildFile; fileRef = 897FF0F60E719B8F00D62E90 /* accessors.cc */; };
                89F23C400E78D5B2006B2466 /* allocation.cc in Sources */ = {isa 
=  
PBXBuildFile; fileRef = 897FF0F80E719B8F00D62E90 /* allocation.cc */; };
                89F23C410E78D5B2006B2466 /* api.cc in Sources */ = {isa = 
PBXBuildFile;  
fileRef = 897FF0FA0E719B8F00D62E90 /* api.cc */; };
@@ -495,8 +497,10 @@
                897FF1B50E719C0900D62E90 /* shell.cc */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shell.cc;  
sourceTree = "<group>"; };
                897FF1B60E719C2300D62E90 /* js2c.py */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = text.script.python; path = js2c.py;  
sourceTree = "<group>"; };
                897FF1B70E719C2E00D62E90 /* macros.py */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = text.script.python; name = macros.py;  
path = ../src/macros.py; sourceTree = "<group>"; };
-               898BD20C0EF6CC850068B00A /* debug-arm.cc */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path  
= "debug-arm.cc"; sourceTree = "<group>"; };
-               898BD20D0EF6CC850068B00A /* debug-ia32.cc */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path  
= "debug-ia32.cc"; sourceTree = "<group>"; };
+               897FF32F0FAA0ED200136CF6 /* version.cc */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path =  
version.cc; sourceTree = "<group>"; };
+               897FF3300FAA0ED200136CF6 /* version.h */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h;  
sourceTree = "<group>"; };
+               898BD20C0EF6CC850068B00A /* debug-arm.cc */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name  
= "debug-arm.cc"; path = "debug-arm.cc"; sourceTree = "<group>"; };
+               898BD20D0EF6CC850068B00A /* debug-ia32.cc */ = {isa = 
PBXFileReference;  
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name  
= "debug-ia32.cc"; path = "debug-ia32.cc"; sourceTree = "<group>"; };
                89A15C630EE4661A00B48DEB /* bytecodes-irregexp.h */ = {isa =  
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;  
path = "bytecodes-irregexp.h"; sourceTree = "<group>"; };
                89A15C660EE4665300B48DEB /* interpreter-irregexp.cc */ = {isa = 
 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp;  
path = "interpreter-irregexp.cc"; sourceTree = "<group>"; };
                89A15C670EE4665300B48DEB /* interpreter-irregexp.h */ = {isa =  
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;  
path = "interpreter-irregexp.h"; sourceTree = "<group>"; };
@@ -826,6 +830,8 @@
                                897FF19E0E719B8F00D62E90 /* v8threads.h */,
                                897FF19F0E719B8F00D62E90 /* variables.cc */,
                                897FF1A00E719B8F00D62E90 /* variables.h */,
+                               897FF32F0FAA0ED200136CF6 /* version.cc */,
+                               897FF3300FAA0ED200136CF6 /* version.h */,
                                58950D560F55514900F3E8BA /* 
virtual-frame-arm.cc */,
                                58950D570F55514900F3E8BA /* virtual-frame-arm.h 
*/,
                                58950D580F55514900F3E8BA /* 
virtual-frame-ia32.cc */,
@@ -1175,6 +1181,7 @@
                                89A88E2B0E71A6D10043BA31 /* v8.cc in Sources */,
                                89A88E2C0E71A6D20043BA31 /* v8threads.cc in 
Sources */,
                                89A88E2D0E71A6D50043BA31 /* variables.cc in 
Sources */,
+                               89B933AF0FAA0F9600201304 /* version.cc in 
Sources */,
                                58950D660F5551C200F3E8BA /* virtual-frame.cc in 
Sources */,
                                58950D670F5551C400F3E8BA /* 
virtual-frame-ia32.cc in Sources */,
                                89A88E2E0E71A6D60043BA31 /* zone.cc in Sources 
*/,
@@ -1277,6 +1284,7 @@
                                89F23C7F0E78D5B2006B2466 /* v8.cc in Sources */,
                                89F23C800E78D5B2006B2466 /* v8threads.cc in 
Sources */,
                                89F23C810E78D5B2006B2466 /* variables.cc in 
Sources */,
+                               89B933B00FAA0F9D00201304 /* version.cc in 
Sources */,
                                58950D680F5551CB00F3E8BA /* virtual-frame.cc in 
Sources */,
                                58950D690F5551CE00F3E8BA /* 
virtual-frame-arm.cc in Sources */,
                                89F23C820E78D5B2006B2466 /* zone.cc in Sources 
*/,

Modified: branches/1.1/tools/visual_studio/v8_base.vcproj
==============================================================================
--- branches/1.1/tools/visual_studio/v8_base.vcproj     (original)
+++ branches/1.1/tools/visual_studio/v8_base.vcproj     Fri May  1 04:38:26 2009
@@ -857,6 +857,14 @@
                                >
                        </File>
                        <File
+                               RelativePath="..\..\src\version.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\version.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\src\virtual-frame.h"
                                >
                        </File>

Modified: branches/1.1/tools/visual_studio/v8_base_arm.vcproj
==============================================================================
--- branches/1.1/tools/visual_studio/v8_base_arm.vcproj (original)
+++ branches/1.1/tools/visual_studio/v8_base_arm.vcproj Fri May  1 04:38:26  
2009
@@ -853,6 +853,14 @@
                                >
                        </File>
                        <File
+                               RelativePath="..\..\src\version.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\version.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\src\virtual-frame.h"
                                >
                        </File>

Modified: branches/1.1/tools/visual_studio/v8_cctest.vcproj
==============================================================================
--- branches/1.1/tools/visual_studio/v8_cctest.vcproj   (original)
+++ branches/1.1/tools/visual_studio/v8_cctest.vcproj   Fri May  1 04:38:26  
2009
@@ -233,6 +233,10 @@
                        RelativePath="..\..\test\cctest\test-utils.cc"
                        >
                </File>
+               <File
+                       RelativePath="..\..\test\cctest\test-version.cc"
+                       >
+               </File>
        </Files>
        <Globals>
        </Globals>

Modified: branches/1.1/tools/visual_studio/v8_cctest_arm.vcproj
==============================================================================
--- branches/1.1/tools/visual_studio/v8_cctest_arm.vcproj       (original)
+++ branches/1.1/tools/visual_studio/v8_cctest_arm.vcproj       Fri May  1  
04:38:26 2009
@@ -219,6 +219,10 @@
                        RelativePath="..\..\test\cctest\test-utils.cc"
                        >
                </File>
+               <File
+                       RelativePath="..\..\test\cctest\test-version.cc"
+                       >
+               </File>
        </Files>
        <Globals>
        </Globals>

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to