| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 'values': ['on', 'off'], | 611 'values': ['on', 'off'], |
| 612 'default': 'off', | 612 'default': 'off', |
| 613 'help': 'more output from compiler and linker' | 613 'help': 'more output from compiler and linker' |
| 614 } | 614 } |
| 615 } | 615 } |
| 616 | 616 |
| 617 | 617 |
| 618 def GetOptions(): | 618 def GetOptions(): |
| 619 result = Options() | 619 result = Options() |
| 620 result.Add('mode', 'compilation mode (debug, release)', 'release') | 620 result.Add('mode', 'compilation mode (debug, release)', 'release') |
| 621 result.Add('prefix', 'destination directory for install', '/usr') |
| 622 result.Add('destdir', 'destination directory for install', '') |
| 621 result.Add('sample', 'build sample (shell, process)', '') | 623 result.Add('sample', 'build sample (shell, process)', '') |
| 622 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
.)', '') | 624 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
.)', '') |
| 623 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') | 625 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') |
| 624 for (name, option) in SIMPLE_OPTIONS.iteritems(): | 626 for (name, option) in SIMPLE_OPTIONS.iteritems(): |
| 625 help = '%s (%s)' % (name, ", ".join(option['values'])) | 627 help = '%s (%s)' % (name, ", ".join(option['values'])) |
| 626 result.Add(name, help, option.get('default')) | 628 result.Add(name, help, option.get('default')) |
| 627 return result | 629 return result |
| 628 | 630 |
| 629 | 631 |
| 630 def GetVersionComponents(): | 632 def GetVersionComponents(): |
| (...skipping 13 matching lines...) Expand all Loading... |
| 644 match = pattern.search(source) | 646 match = pattern.search(source) |
| 645 if match: | 647 if match: |
| 646 version_components.append(match.group(1).strip()) | 648 version_components.append(match.group(1).strip()) |
| 647 else: | 649 else: |
| 648 version_components.append('0') | 650 version_components.append('0') |
| 649 | 651 |
| 650 return version_components | 652 return version_components |
| 651 | 653 |
| 652 | 654 |
| 653 def GetVersion(): | 655 def GetVersion(): |
| 654 version_components = GetVersionComponents() | 656 return '.'.join(GetVersionComponents()) |
| 655 | |
| 656 if version_components[len(version_components) - 1] == '0': | |
| 657 version_components.pop() | |
| 658 return '.'.join(version_components) | |
| 659 | 657 |
| 660 | 658 |
| 661 def GetSpecificSONAME(): | 659 def GetSpecificSONAME(): |
| 662 SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") | 660 SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") |
| 663 | 661 |
| 664 source = open(join(root_dir, 'src', 'version.cc')).read() | 662 source = open(join(root_dir, 'src', 'version.cc')).read() |
| 665 match = SONAME_PATTERN.search(source) | 663 match = SONAME_PATTERN.search(source) |
| 666 | 664 |
| 667 if match: | 665 if match: |
| 668 return match.group(1).strip() | 666 return match.group(1).strip() |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 'cctest': cctest_flags, | 836 'cctest': cctest_flags, |
| 839 'sample': sample_flags, | 837 'sample': sample_flags, |
| 840 'd8': d8_flags | 838 'd8': d8_flags |
| 841 } | 839 } |
| 842 | 840 |
| 843 # Generate library base name. | 841 # Generate library base name. |
| 844 target_id = mode | 842 target_id = mode |
| 845 suffix = SUFFIXES[target_id] | 843 suffix = SUFFIXES[target_id] |
| 846 library_name = 'v8' + suffix | 844 library_name = 'v8' + suffix |
| 847 version = GetVersion() | 845 version = GetVersion() |
| 848 if context.options['soname'] == 'on': | |
| 849 # When building shared object with SONAME version the library name. | |
| 850 library_name += '-' + version | |
| 851 env['LIBRARY'] = library_name | |
| 852 | 846 |
| 853 # Generate library SONAME if required by the build. | 847 # Generate library SONAME if required by the build. |
| 854 if context.options['soname'] == 'on': | 848 if context.options['soname'] == 'on': |
| 849 # When building shared object with SONAME version the library suffix. |
| 855 soname = GetSpecificSONAME() | 850 soname = GetSpecificSONAME() |
| 856 if soname == '': | 851 if soname == '': |
| 857 soname = 'lib' + library_name + '.so' | 852 library_prefix = 'lib' # TODO: use env['SHLIBPREFIX'] |
| 853 library_suffix = env['SHLIBSUFFIX'] + '.' + version |
| 854 soname = library_prefix + library_name + library_suffix |
| 855 env['SHLIBSUFFIX'] = library_suffix |
| 858 env['SONAME'] = soname | 856 env['SONAME'] = soname |
| 859 | 857 |
| 858 env['LIBRARY'] = library_name |
| 859 |
| 860 # Build the object files by invoking SCons recursively. | 860 # Build the object files by invoking SCons recursively. |
| 861 (object_files, shell_files, mksnapshot) = env.SConscript( | 861 (object_files, shell_files, mksnapshot) = env.SConscript( |
| 862 join('src', 'SConscript'), | 862 join('src', 'SConscript'), |
| 863 build_dir=join('obj', target_id), | 863 build_dir=join('obj', target_id), |
| 864 exports='context', | 864 exports='context', |
| 865 duplicate=False | 865 duplicate=False |
| 866 ) | 866 ) |
| 867 | 867 |
| 868 context.mksnapshot_targets.append(mksnapshot) | 868 context.mksnapshot_targets.append(mksnapshot) |
| 869 | 869 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 d8s = [] | 927 d8s = [] |
| 928 modes = SplitList(env['mode']) | 928 modes = SplitList(env['mode']) |
| 929 for mode in modes: | 929 for mode in modes: |
| 930 context = BuildSpecific(env.Copy(), mode, env_overrides) | 930 context = BuildSpecific(env.Copy(), mode, env_overrides) |
| 931 libraries += context.library_targets | 931 libraries += context.library_targets |
| 932 mksnapshots += context.mksnapshot_targets | 932 mksnapshots += context.mksnapshot_targets |
| 933 cctests += context.cctest_targets | 933 cctests += context.cctest_targets |
| 934 samples += context.sample_targets | 934 samples += context.sample_targets |
| 935 d8s += context.d8_targets | 935 d8s += context.d8_targets |
| 936 | 936 |
| 937 installdir = env['destdir'] + env['prefix'] |
| 938 installs = [] |
| 939 installs += env.Install(installdir + '/include', ['include/v8.h', 'include/v8-
debug.h']) |
| 940 installs += env.Install(installdir + '/lib', libraries) |
| 941 |
| 937 env.Alias('library', libraries) | 942 env.Alias('library', libraries) |
| 938 env.Alias('mksnapshot', mksnapshots) | 943 env.Alias('mksnapshot', mksnapshots) |
| 939 env.Alias('cctests', cctests) | 944 env.Alias('cctests', cctests) |
| 940 env.Alias('sample', samples) | 945 env.Alias('sample', samples) |
| 941 env.Alias('d8', d8s) | 946 env.Alias('d8', d8s) |
| 947 env.Alias('install', installs) |
| 942 | 948 |
| 943 if env['sample']: | 949 if env['sample']: |
| 944 env.Default('sample') | 950 env.Default('sample') |
| 945 else: | 951 else: |
| 946 env.Default('library') | 952 env.Default('library') |
| 947 | 953 |
| 948 | 954 |
| 949 # We disable deprecation warnings because we need to be able to use | 955 # We disable deprecation warnings because we need to be able to use |
| 950 # env.Copy without getting warnings for compatibility with older | 956 # env.Copy without getting warnings for compatibility with older |
| 951 # version of scons. Also, there's a bug in some revisions that | 957 # version of scons. Also, there's a bug in some revisions that |
| 952 # doesn't allow this flag to be set, so we swallow any exceptions. | 958 # doesn't allow this flag to be set, so we swallow any exceptions. |
| 953 # Lovely. | 959 # Lovely. |
| 954 try: | 960 try: |
| 955 SetOption('warn', 'no-deprecated') | 961 SetOption('warn', 'no-deprecated') |
| 956 except: | 962 except: |
| 957 pass | 963 pass |
| 958 | 964 |
| 959 | 965 |
| 960 Build() | 966 Build() |
| OLD | NEW |