| OLD | NEW | 
|    1 # Copyright 2008 the V8 project authors. All rights reserved. |    1 # Copyright 2008 the V8 project authors. All rights reserved. | 
|    2 # Redistribution and use in source and binary forms, with or without |    2 # Redistribution and use in source and binary forms, with or without | 
|    3 # modification, are permitted provided that the following conditions are |    3 # modification, are permitted provided that the following conditions are | 
|    4 # met: |    4 # met: | 
|    5 # |    5 # | 
|    6 #     * Redistributions of source code must retain the above copyright |    6 #     * Redistributions of source code must retain the above copyright | 
|    7 #       notice, this list of conditions and the following disclaimer. |    7 #       notice, this list of conditions and the following disclaimer. | 
|    8 #     * Redistributions in binary form must reproduce the above |    8 #     * Redistributions in binary form must reproduce the above | 
|    9 #       copyright notice, this list of conditions and the following |    9 #       copyright notice, this list of conditions and the following | 
|   10 #       disclaimer in the documentation and/or other materials provided |   10 #       disclaimer in the documentation and/or other materials provided | 
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  190     'arch:arm': { |  190     'arch:arm': { | 
|  191       'CPPDEFINES':   ['ARM'] |  191       'CPPDEFINES':   ['ARM'] | 
|  192     }, |  192     }, | 
|  193     'arch:android': { |  193     'arch:android': { | 
|  194       'CPPDEFINES':   ['ARM'] |  194       'CPPDEFINES':   ['ARM'] | 
|  195     }, |  195     }, | 
|  196     'os:win32': { |  196     'os:win32': { | 
|  197       'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] |  197       'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] | 
|  198     }, |  198     }, | 
|  199     'os:linux': { |  199     'os:linux': { | 
|  200       'WARNINGFLAGS': ['-pedantic'] |  200       'WARNINGFLAGS': ['-pedantic'], | 
 |  201       'library:shared': { | 
 |  202         'soname:on': { | 
 |  203           'LINKFLAGS': ['-Wl,-soname,${SONAME}'] | 
 |  204         } | 
 |  205       } | 
|  201     }, |  206     }, | 
|  202     'os:macos': { |  207     'os:macos': { | 
|  203       'WARNINGFLAGS': ['-pedantic'] |  208       'WARNINGFLAGS': ['-pedantic'] | 
|  204     }, |  209     }, | 
|  205     'disassembler:on': { |  210     'disassembler:on': { | 
|  206       'CPPDEFINES':   ['ENABLE_DISASSEMBLER'] |  211       'CPPDEFINES':   ['ENABLE_DISASSEMBLER'] | 
|  207     } |  212     } | 
|  208   }, |  213   }, | 
|  209   'msvc': { |  214   'msvc': { | 
|  210     'all': { |  215     'all': { | 
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  486   'prof': { |  491   'prof': { | 
|  487     'values': ['on', 'off', 'oprofile'], |  492     'values': ['on', 'off', 'oprofile'], | 
|  488     'default': 'off', |  493     'default': 'off', | 
|  489     'help': 'enable profiling of build target' |  494     'help': 'enable profiling of build target' | 
|  490   }, |  495   }, | 
|  491   'library': { |  496   'library': { | 
|  492     'values': ['static', 'shared'], |  497     'values': ['static', 'shared'], | 
|  493     'default': 'static', |  498     'default': 'static', | 
|  494     'help': 'the type of library to produce' |  499     'help': 'the type of library to produce' | 
|  495   }, |  500   }, | 
 |  501   'soname': { | 
 |  502     'values': ['on', 'off'], | 
 |  503     'default': 'off', | 
 |  504     'help': 'turn on setting soname for Linux shared library' | 
 |  505   }, | 
|  496   'msvcrt': { |  506   'msvcrt': { | 
|  497     'values': ['static', 'shared'], |  507     'values': ['static', 'shared'], | 
|  498     'default': 'static', |  508     'default': 'static', | 
|  499     'help': 'the type of Microsoft Visual C++ runtime library to use' |  509     'help': 'the type of Microsoft Visual C++ runtime library to use' | 
|  500   }, |  510   }, | 
|  501   'msvcltcg': { |  511   'msvcltcg': { | 
|  502     'values': ['on', 'off'], |  512     'values': ['on', 'off'], | 
|  503     'default': 'on', |  513     'default': 'on', | 
|  504     'help': 'use Microsoft Visual C++ link-time code generation' |  514     'help': 'use Microsoft Visual C++ link-time code generation' | 
|  505   }, |  515   }, | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|  536   result.Add('mode', 'compilation mode (debug, release)', 'release') |  546   result.Add('mode', 'compilation mode (debug, release)', 'release') | 
|  537   result.Add('sample', 'build sample (shell, process)', '') |  547   result.Add('sample', 'build sample (shell, process)', '') | 
|  538   result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
     .)', '') |  548   result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
     .)', '') | 
|  539   result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') |  549   result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') | 
|  540   for (name, option) in SIMPLE_OPTIONS.iteritems(): |  550   for (name, option) in SIMPLE_OPTIONS.iteritems(): | 
|  541     help = '%s (%s)' % (name, ", ".join(option['values'])) |  551     help = '%s (%s)' % (name, ", ".join(option['values'])) | 
|  542     result.Add(name, help, option.get('default')) |  552     result.Add(name, help, option.get('default')) | 
|  543   return result |  553   return result | 
|  544  |  554  | 
|  545  |  555  | 
 |  556 def GetVersionComponents(): | 
 |  557   MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") | 
 |  558   MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") | 
 |  559   BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") | 
 |  560   PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") | 
 |  561  | 
 |  562   patterns = [MAJOR_VERSION_PATTERN, | 
 |  563               MINOR_VERSION_PATTERN, | 
 |  564               BUILD_NUMBER_PATTERN, | 
 |  565               PATCH_LEVEL_PATTERN] | 
 |  566  | 
 |  567   source = open(join('src', 'version.cc')).read() | 
 |  568   version_components = [] | 
 |  569   for pattern in patterns: | 
 |  570     match = pattern.search(source) | 
 |  571     if match: | 
 |  572       version_components.append(match.group(1).strip()) | 
 |  573     else: | 
 |  574       version_components.append('0') | 
 |  575  | 
 |  576   return version_components | 
 |  577  | 
 |  578  | 
 |  579 def GetVersion(): | 
 |  580   version_components = GetVersionComponents() | 
 |  581    | 
 |  582   if version_components[len(version_components) - 1] == '0': | 
 |  583     version_components.pop() | 
 |  584   return '.'.join(version_components) | 
 |  585  | 
 |  586  | 
 |  587 def GetSpecificSONAME(): | 
 |  588   SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") | 
 |  589    | 
 |  590   source = open(join('src', 'version.cc')).read() | 
 |  591   match = SONAME_PATTERN.search(source) | 
 |  592    | 
 |  593   if match: | 
 |  594     return match.group(1).strip() | 
 |  595   else: | 
 |  596     return '' | 
 |  597  | 
 |  598  | 
|  546 def SplitList(str): |  599 def SplitList(str): | 
|  547   return [ s for s in str.split(",") if len(s) > 0 ] |  600   return [ s for s in str.split(",") if len(s) > 0 ] | 
|  548  |  601  | 
|  549  |  602  | 
|  550 def IsLegal(env, option, values): |  603 def IsLegal(env, option, values): | 
|  551   str = env[option] |  604   str = env[option] | 
|  552   for s in SplitList(str): |  605   for s in SplitList(str): | 
|  553     if not s in values: |  606     if not s in values: | 
|  554       Abort("Illegal value for option %s '%s'." % (option, s)) |  607       Abort("Illegal value for option %s '%s'." % (option, s)) | 
|  555       return False |  608       return False | 
|  556   return True |  609   return True | 
|  557  |  610  | 
|  558  |  611  | 
|  559 def VerifyOptions(env): |  612 def VerifyOptions(env): | 
|  560   if not IsLegal(env, 'mode', ['debug', 'release']): |  613   if not IsLegal(env, 'mode', ['debug', 'release']): | 
|  561     return False |  614     return False | 
|  562   if not IsLegal(env, 'sample', ["shell", "process"]): |  615   if not IsLegal(env, 'sample', ["shell", "process"]): | 
|  563     return False |  616     return False | 
|  564   if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on'
     : |  617   if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on'
     : | 
|  565     Abort("Profiling on windows only supported for static library.") |  618     Abort("Profiling on windows only supported for static library.") | 
|  566   if env['prof'] == 'oprofile' and env['os'] != 'linux': |  619   if env['prof'] == 'oprofile' and env['os'] != 'linux': | 
|  567     Abort("OProfile is only supported on Linux.") |  620     Abort("OProfile is only supported on Linux.") | 
 |  621   if env['os'] == 'win32' and env['soname'] == 'on': | 
 |  622     Abort("Shared Object soname not applicable for Windows.") | 
 |  623   if env['soname'] == 'on' and env['library'] == 'static': | 
 |  624     Abort("Shared Object soname not applicable for static library.") | 
|  568   for (name, option) in SIMPLE_OPTIONS.iteritems(): |  625   for (name, option) in SIMPLE_OPTIONS.iteritems(): | 
|  569     if (not option.get('default')) and (name not in ARGUMENTS): |  626     if (not option.get('default')) and (name not in ARGUMENTS): | 
|  570       message = ("A value for option %s must be specified (%s)." % |  627       message = ("A value for option %s must be specified (%s)." % | 
|  571           (name, ", ".join(option['values']))) |  628           (name, ", ".join(option['values']))) | 
|  572       Abort(message) |  629       Abort(message) | 
|  573     if not env[name] in option['values']: |  630     if not env[name] in option['values']: | 
|  574       message = ("Unknown %s value '%s'.  Possible values are (%s)." % |  631       message = ("Unknown %s value '%s'.  Possible values are (%s)." % | 
|  575           (name, env[name], ", ".join(option['values']))) |  632           (name, env[name], ", ".join(option['values']))) | 
|  576       Abort(message) |  633       Abort(message) | 
|  577  |  634  | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  688  |  745  | 
|  689   context.flags = { |  746   context.flags = { | 
|  690     'v8': v8_flags, |  747     'v8': v8_flags, | 
|  691     'mksnapshot': mksnapshot_flags, |  748     'mksnapshot': mksnapshot_flags, | 
|  692     'dtoa': dtoa_flags, |  749     'dtoa': dtoa_flags, | 
|  693     'cctest': cctest_flags, |  750     'cctest': cctest_flags, | 
|  694     'sample': sample_flags, |  751     'sample': sample_flags, | 
|  695     'd8': d8_flags |  752     'd8': d8_flags | 
|  696   } |  753   } | 
|  697  |  754  | 
 |  755   # Generate library base name. | 
|  698   target_id = mode |  756   target_id = mode | 
|  699   suffix = SUFFIXES[target_id] |  757   suffix = SUFFIXES[target_id] | 
|  700   library_name = 'v8' + suffix |  758   library_name = 'v8' + suffix | 
 |  759   version = GetVersion() | 
 |  760   if context.options['soname'] == 'on': | 
 |  761     # When building shared object with SONAME version the library name. | 
 |  762     library_name += '-' + version | 
|  701   env['LIBRARY'] = library_name |  763   env['LIBRARY'] = library_name | 
|  702  |  764  | 
 |  765   # Generate library SONAME if required by the build. | 
 |  766   if context.options['soname'] == 'on': | 
 |  767     soname = GetSpecificSONAME() | 
 |  768     if soname == '': | 
 |  769       soname = 'lib' + library_name + '.so' | 
 |  770     env['SONAME'] = soname | 
 |  771  | 
|  703   # Build the object files by invoking SCons recursively. |  772   # Build the object files by invoking SCons recursively. | 
|  704   (object_files, shell_files, mksnapshot) = env.SConscript( |  773   (object_files, shell_files, mksnapshot) = env.SConscript( | 
|  705     join('src', 'SConscript'), |  774     join('src', 'SConscript'), | 
|  706     build_dir=join('obj', target_id), |  775     build_dir=join('obj', target_id), | 
|  707     exports='context', |  776     exports='context', | 
|  708     duplicate=False |  777     duplicate=False | 
|  709   ) |  778   ) | 
|  710  |  779  | 
|  711   context.mksnapshot_targets.append(mksnapshot) |  780   context.mksnapshot_targets.append(mksnapshot) | 
|  712  |  781  | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  794 # version of scons.  Also, there's a bug in some revisions that |  863 # version of scons.  Also, there's a bug in some revisions that | 
|  795 # doesn't allow this flag to be set, so we swallow any exceptions. |  864 # doesn't allow this flag to be set, so we swallow any exceptions. | 
|  796 # Lovely. |  865 # Lovely. | 
|  797 try: |  866 try: | 
|  798   SetOption('warn', 'no-deprecated') |  867   SetOption('warn', 'no-deprecated') | 
|  799 except: |  868 except: | 
|  800   pass |  869   pass | 
|  801  |  870  | 
|  802  |  871  | 
|  803 Build() |  872 Build() | 
| OLD | NEW |