Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: SConstruct

Issue 100104: Added better version information (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/SConscript » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: SConstruct
===================================================================
--- SConstruct (revision 1814)
+++ SConstruct (working copy)
@@ -197,7 +197,12 @@
'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
},
'os:linux': {
- 'WARNINGFLAGS': ['-pedantic']
+ 'WARNINGFLAGS': ['-pedantic'],
+ 'library:shared': {
+ 'soname:on': {
+ 'LINKFLAGS': ['-Wl,-soname,${SONAME}']
+ }
+ }
},
'os:macos': {
'WARNINGFLAGS': ['-pedantic']
@@ -493,6 +498,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',
@@ -543,6 +553,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('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('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 ]
@@ -565,6 +618,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)." %
@@ -695,11 +752,23 @@
'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(
join('src', 'SConscript'),
« no previous file with comments | « no previous file | src/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698