2012-02-22 12:26:36 +00:00
|
|
|
# Copyright 2012 the V8 project authors. All rights reserved.
|
2008-07-03 15:10:15 +00:00
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above
|
|
|
|
# copyright notice, this list of conditions and the following
|
|
|
|
# disclaimer in the documentation and/or other materials provided
|
|
|
|
# with the distribution.
|
|
|
|
# * Neither the name of Google Inc. nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived
|
|
|
|
# from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
import platform
|
2008-07-16 07:07:30 +00:00
|
|
|
import re
|
2011-03-30 17:33:18 +00:00
|
|
|
import subprocess
|
2008-07-03 15:10:15 +00:00
|
|
|
import sys
|
2008-08-27 10:11:39 +00:00
|
|
|
import os
|
2008-07-03 15:10:15 +00:00
|
|
|
from os.path import join, dirname, abspath
|
2008-09-22 15:50:30 +00:00
|
|
|
from types import DictType, StringTypes
|
2008-07-03 15:10:15 +00:00
|
|
|
root_dir = dirname(File('SConstruct').rfile().abspath)
|
2012-01-19 08:43:11 +00:00
|
|
|
src_dir = join(root_dir, 'src')
|
2011-01-25 12:56:04 +00:00
|
|
|
sys.path.insert(0, join(root_dir, 'tools'))
|
2008-09-02 15:20:38 +00:00
|
|
|
import js2c, utils
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-04-16 11:47:23 +00:00
|
|
|
# ARM_TARGET_LIB is the path to the dynamic library to use on the target
|
2010-07-22 12:57:48 +00:00
|
|
|
# machine if cross-compiling to an arm machine. You will also need to set
|
2010-04-16 11:47:23 +00:00
|
|
|
# the additional cross-compiling environment variables to the cross compiler.
|
|
|
|
ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB')
|
|
|
|
if ARM_TARGET_LIB:
|
|
|
|
ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' +
|
|
|
|
ARM_TARGET_LIB + '/usr/lib',
|
|
|
|
'-Wl,--dynamic-linker=' + ARM_TARGET_LIB +
|
|
|
|
'/lib/ld-linux.so.3']
|
|
|
|
else:
|
2010-04-16 12:20:02 +00:00
|
|
|
ARM_LINK_FLAGS = []
|
2010-04-16 11:47:23 +00:00
|
|
|
|
2010-08-16 17:14:34 +00:00
|
|
|
GCC_EXTRA_CCFLAGS = []
|
|
|
|
GCC_DTOA_EXTRA_CCFLAGS = []
|
2009-05-22 06:52:02 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
LIBRARY_FLAGS = {
|
|
|
|
'all': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH': [src_dir],
|
2010-04-19 19:30:11 +00:00
|
|
|
'regexp:interpreted': {
|
|
|
|
'CPPDEFINES': ['V8_INTERPRETED_REGEXP']
|
2009-08-26 10:33:11 +00:00
|
|
|
},
|
|
|
|
'mode:debug': {
|
2010-12-20 10:38:19 +00:00
|
|
|
'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT']
|
2009-09-11 12:26:15 +00:00
|
|
|
},
|
2010-12-20 10:38:19 +00:00
|
|
|
'objectprint:on': {
|
|
|
|
'CPPDEFINES': ['OBJECT_PRINT'],
|
|
|
|
},
|
2009-09-11 12:26:15 +00:00
|
|
|
'debuggersupport:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
|
2011-01-19 08:04:48 +00:00
|
|
|
},
|
|
|
|
'inspector:on': {
|
|
|
|
'CPPDEFINES': ['INSPECTOR'],
|
2011-01-20 08:38:01 +00:00
|
|
|
},
|
2011-07-13 10:00:33 +00:00
|
|
|
'fasttls:off': {
|
|
|
|
'CPPDEFINES': ['V8_NO_FAST_TLS'],
|
2011-03-27 16:14:20 +00:00
|
|
|
},
|
2011-01-20 08:38:01 +00:00
|
|
|
'liveobjectlist:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT', 'INSPECTOR',
|
|
|
|
'LIVE_OBJECT_LIST', 'OBJECT_PRINT'],
|
2009-07-07 08:11:19 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2008-10-03 15:53:44 +00:00
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2011-07-01 09:02:25 +00:00
|
|
|
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-09-15 11:11:09 +00:00
|
|
|
'visibility:hidden': {
|
|
|
|
# Use visibility=default to disable this.
|
|
|
|
'CXXFLAGS': ['-fvisibility=hidden']
|
|
|
|
},
|
2011-03-30 17:33:18 +00:00
|
|
|
'strictaliasing:off': {
|
|
|
|
'CCFLAGS': ['-fno-strict-aliasing']
|
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
'mode:debug': {
|
|
|
|
'CCFLAGS': ['-g', '-O0'],
|
2009-03-31 13:55:33 +00:00
|
|
|
'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'],
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'mode:release': {
|
2011-01-12 14:32:51 +00:00
|
|
|
'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections',
|
2009-03-23 12:37:53 +00:00
|
|
|
'-ffunction-sections'],
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:linux': {
|
2009-05-22 06:52:02 +00:00
|
|
|
'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS,
|
2009-04-01 07:17:29 +00:00
|
|
|
'library:shared': {
|
2009-08-05 07:59:46 +00:00
|
|
|
'CPPDEFINES': ['V8_SHARED'],
|
2009-04-17 00:56:52 +00:00
|
|
|
'LIBS': ['pthread']
|
2009-04-01 07:17:29 +00:00
|
|
|
}
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
|
|
|
'os:macos': {
|
2009-06-18 00:22:52 +00:00
|
|
|
'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'],
|
2009-12-14 10:20:35 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['V8_SHARED']
|
|
|
|
}
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
2008-11-21 10:06:29 +00:00
|
|
|
'os:freebsd': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH' : [src_dir, '/usr/local/include'],
|
2009-06-08 08:51:35 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
2009-02-09 15:06:07 +00:00
|
|
|
'CCFLAGS': ['-ansi'],
|
2011-03-16 11:15:43 +00:00
|
|
|
'LIBS': ['execinfo']
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH' : [src_dir, '/usr/local/include'],
|
2009-12-02 13:38:50 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'CCFLAGS': ['-ansi'],
|
|
|
|
},
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': {
|
2010-05-11 07:04:42 +00:00
|
|
|
# On Solaris, to get isinf, INFINITY, fpclassify and other macros one
|
|
|
|
# needs to define __C99FEATURES__.
|
|
|
|
'CPPDEFINES': ['__C99FEATURES__'],
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH' : [src_dir, '/usr/local/include'],
|
2010-01-25 12:37:31 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'CCFLAGS': ['-ansi'],
|
|
|
|
},
|
2011-11-16 14:35:47 +00:00
|
|
|
'os:netbsd': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH' : [src_dir, '/usr/pkg/include'],
|
2011-11-16 14:35:47 +00:00
|
|
|
'LIBPATH' : ['/usr/pkg/lib'],
|
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:win32': {
|
|
|
|
'CCFLAGS': ['-DWIN32'],
|
|
|
|
'CXXFLAGS': ['-DWIN32'],
|
2008-11-21 10:06:29 +00:00
|
|
|
},
|
2009-04-29 13:11:48 +00:00
|
|
|
'arch:ia32': {
|
2009-07-16 22:41:28 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32'],
|
|
|
|
'CCFLAGS': ['-m32'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
2009-04-29 13:11:48 +00:00
|
|
|
},
|
|
|
|
'arch:arm': {
|
2010-05-27 07:31:10 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_ARM'],
|
|
|
|
'unalignedaccesses:on' : {
|
|
|
|
'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1']
|
|
|
|
},
|
|
|
|
'unalignedaccesses:off' : {
|
|
|
|
'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0']
|
2011-04-29 08:50:38 +00:00
|
|
|
},
|
2011-04-29 12:13:46 +00:00
|
|
|
'armeabi:soft' : {
|
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
|
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=soft'],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'armeabi:softfp' : {
|
2011-08-10 11:14:32 +00:00
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
|
|
|
|
'vfp3:on': {
|
|
|
|
'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
|
|
|
|
},
|
2011-04-29 08:50:38 +00:00
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=softfp'],
|
|
|
|
}
|
|
|
|
},
|
2011-04-29 12:13:46 +00:00
|
|
|
'armeabi:hard' : {
|
2011-08-10 11:14:32 +00:00
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'],
|
|
|
|
'vfp3:on': {
|
|
|
|
'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
|
|
|
|
},
|
2011-04-29 08:50:38 +00:00
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=hard'],
|
|
|
|
}
|
2010-05-27 07:31:10 +00:00
|
|
|
}
|
2009-04-29 13:11:48 +00:00
|
|
|
},
|
2009-07-16 22:41:28 +00:00
|
|
|
'simulator:arm': {
|
2010-05-27 07:31:10 +00:00
|
|
|
'CCFLAGS': ['-m32'],
|
2010-10-14 11:39:48 +00:00
|
|
|
'LINKFLAGS': ['-m32'],
|
2009-07-16 22:41:28 +00:00
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
'arch:mips': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
|
2011-03-28 13:05:36 +00:00
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
|
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
'simulator:none': {
|
2011-03-28 13:05:36 +00:00
|
|
|
'CCFLAGS': ['-EL'],
|
|
|
|
'LINKFLAGS': ['-EL'],
|
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2']
|
|
|
|
},
|
|
|
|
'mips_arch_variant:mips32r1': {
|
|
|
|
'CCFLAGS': ['-mips32', '-Wa,-mips32']
|
|
|
|
},
|
|
|
|
'library:static': {
|
|
|
|
'LINKFLAGS': ['-static', '-static-libgcc']
|
|
|
|
},
|
|
|
|
'mipsabi:softfloat': {
|
|
|
|
'CCFLAGS': ['-msoft-float'],
|
|
|
|
'LINKFLAGS': ['-msoft-float']
|
|
|
|
},
|
|
|
|
'mipsabi:hardfloat': {
|
|
|
|
'CCFLAGS': ['-mhard-float'],
|
|
|
|
'LINKFLAGS': ['-mhard-float']
|
|
|
|
}
|
2010-02-04 20:36:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'simulator:mips': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
2010-10-14 11:39:48 +00:00
|
|
|
'LINKFLAGS': ['-m32'],
|
2011-03-28 13:05:36 +00:00
|
|
|
'mipsabi:softfloat': {
|
|
|
|
'CPPDEFINES': ['__mips_soft_float=1'],
|
2011-05-24 07:23:32 +00:00
|
|
|
},
|
|
|
|
'mipsabi:hardfloat': {
|
|
|
|
'CPPDEFINES': ['__mips_hard_float=1'],
|
2011-03-28 13:05:36 +00:00
|
|
|
}
|
2010-02-04 20:36:58 +00:00
|
|
|
},
|
2009-04-29 13:11:48 +00:00
|
|
|
'arch:x64': {
|
2009-10-12 11:19:20 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
|
2009-08-14 17:19:51 +00:00
|
|
|
'CCFLAGS': ['-m64'],
|
2009-07-16 22:41:28 +00:00
|
|
|
'LINKFLAGS': ['-m64'],
|
2009-04-29 13:11:48 +00:00
|
|
|
},
|
2011-01-18 16:11:01 +00:00
|
|
|
'gdbjit:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_GDB_JIT_INTERFACE']
|
2011-04-29 12:08:33 +00:00
|
|
|
},
|
|
|
|
'compress_startup_data:bz2': {
|
|
|
|
'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2']
|
2008-09-05 12:21:04 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2011-07-01 09:02:25 +00:00
|
|
|
'CXXFLAGS': ['/GR-', '/Gy'],
|
2009-08-27 13:12:28 +00:00
|
|
|
'CPPDEFINES': ['WIN32'],
|
|
|
|
'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'],
|
2008-08-22 13:33:59 +00:00
|
|
|
'CCPDBFLAGS': ['/Zi']
|
|
|
|
},
|
2009-08-27 13:12:28 +00:00
|
|
|
'verbose:off': {
|
|
|
|
'DIALECTFLAGS': ['/nologo'],
|
|
|
|
'ARFLAGS': ['/NOLOGO']
|
|
|
|
},
|
2009-04-30 07:21:54 +00:00
|
|
|
'arch:ia32': {
|
2009-08-27 13:12:28 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'],
|
|
|
|
'LINKFLAGS': ['/MACHINE:X86'],
|
|
|
|
'ARFLAGS': ['/MACHINE:X86']
|
|
|
|
},
|
|
|
|
'arch:x64': {
|
2009-10-12 11:19:20 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
|
2009-08-27 13:12:28 +00:00
|
|
|
'LINKFLAGS': ['/MACHINE:X64'],
|
|
|
|
'ARFLAGS': ['/MACHINE:X64']
|
2009-04-30 07:21:54 +00:00
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
'mode:debug': {
|
2008-11-21 11:19:01 +00:00
|
|
|
'CCFLAGS': ['/Od', '/Gm'],
|
2008-08-22 13:33:59 +00:00
|
|
|
'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'],
|
2008-11-21 11:19:01 +00:00
|
|
|
'LINKFLAGS': ['/DEBUG'],
|
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MTd']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MDd']
|
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'mode:release': {
|
2009-04-18 00:03:15 +00:00
|
|
|
'CCFLAGS': ['/O2'],
|
|
|
|
'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
|
2008-11-21 11:19:01 +00:00
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MT']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MD']
|
2009-04-18 00:03:15 +00:00
|
|
|
},
|
|
|
|
'msvcltcg:on': {
|
|
|
|
'CCFLAGS': ['/GL'],
|
|
|
|
'ARFLAGS': ['/LTCG'],
|
2010-02-23 15:22:48 +00:00
|
|
|
'pgo:off': {
|
|
|
|
'LINKFLAGS': ['/LTCG'],
|
|
|
|
},
|
|
|
|
'pgo:instrument': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGI']
|
|
|
|
},
|
|
|
|
'pgo:optimize': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGO']
|
|
|
|
}
|
2008-11-21 11:19:01 +00:00
|
|
|
}
|
2009-04-29 13:11:48 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
V8_EXTRA_FLAGS = {
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2009-07-31 12:19:20 +00:00
|
|
|
'WARNINGFLAGS': ['-Wall',
|
|
|
|
'-Werror',
|
|
|
|
'-W',
|
|
|
|
'-Wno-unused-parameter',
|
2012-02-22 11:38:31 +00:00
|
|
|
'-Woverloaded-virtual',
|
2009-07-31 12:19:20 +00:00
|
|
|
'-Wnon-virtual-dtor']
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:win32': {
|
2012-02-22 12:26:36 +00:00
|
|
|
'WARNINGFLAGS': ['-pedantic', '-Wno-long-long', '-Wno-pedantic-ms-format']
|
2009-03-23 12:37:53 +00:00
|
|
|
},
|
|
|
|
'os:linux': {
|
2009-04-30 09:29:15 +00:00
|
|
|
'WARNINGFLAGS': ['-pedantic'],
|
|
|
|
'library:shared': {
|
|
|
|
'soname:on': {
|
|
|
|
'LINKFLAGS': ['-Wl,-soname,${SONAME}']
|
|
|
|
}
|
|
|
|
}
|
2009-03-23 12:37:53 +00:00
|
|
|
},
|
|
|
|
'os:macos': {
|
|
|
|
'WARNINGFLAGS': ['-pedantic']
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
2011-04-29 08:50:38 +00:00
|
|
|
'arch:arm': {
|
|
|
|
# This is to silence warnings about ABI changes that some versions of the
|
|
|
|
# CodeSourcery G++ tool chain produce for each occurrence of varargs.
|
|
|
|
'WARNINGFLAGS': ['-Wno-abi']
|
|
|
|
},
|
2008-09-05 12:21:04 +00:00
|
|
|
'disassembler:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_DISASSEMBLER']
|
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
2011-01-25 11:25:30 +00:00
|
|
|
'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800']
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-09-07 07:09:57 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['BUILDING_V8_SHARED'],
|
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
|
|
|
},
|
2008-08-27 10:11:39 +00:00
|
|
|
'arch:arm': {
|
2009-05-05 12:06:20 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_ARM'],
|
2008-11-12 22:57:04 +00:00
|
|
|
# /wd4996 is to silence the warning about sscanf
|
|
|
|
# used by the arm simulator.
|
|
|
|
'WARNINGFLAGS': ['/wd4996']
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
'arch:mips': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
|
2011-03-28 13:05:36 +00:00
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
|
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
},
|
2008-09-05 12:21:04 +00:00
|
|
|
'disassembler:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_DISASSEMBLER']
|
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-09 16:00:55 +00:00
|
|
|
MKSNAPSHOT_EXTRA_FLAGS = {
|
|
|
|
'gcc': {
|
|
|
|
'os:linux': {
|
2009-04-17 00:56:52 +00:00
|
|
|
'LIBS': ['pthread'],
|
2009-02-09 16:00:55 +00:00
|
|
|
},
|
|
|
|
'os:macos': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
|
|
|
'os:freebsd': {
|
2009-06-08 08:51:35 +00:00
|
|
|
'LIBS': ['execinfo', 'pthread']
|
2009-02-09 16:00:55 +00:00
|
|
|
},
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': {
|
|
|
|
'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
|
|
|
|
'LINKFLAGS': ['-mt']
|
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2009-02-09 16:00:55 +00:00
|
|
|
'os:win32': {
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32'],
|
2009-02-09 16:00:55 +00:00
|
|
|
},
|
2011-11-16 14:35:47 +00:00
|
|
|
'os:netbsd': {
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2011-04-29 12:08:33 +00:00
|
|
|
'compress_startup_data:bz2': {
|
|
|
|
'os:linux': {
|
|
|
|
'LIBS': ['bz2']
|
|
|
|
}
|
|
|
|
},
|
2009-02-09 16:00:55 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
2009-04-17 00:15:12 +00:00
|
|
|
'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
2009-02-09 16:00:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
DTOA_EXTRA_FLAGS = {
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2009-05-22 06:52:02 +00:00
|
|
|
'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'],
|
|
|
|
'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS
|
2008-09-22 15:50:30 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
|
|
|
'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CCTEST_EXTRA_FLAGS = {
|
|
|
|
'all': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH': [src_dir],
|
2011-06-30 11:53:54 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['USING_V8_SHARED']
|
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2011-04-29 08:50:38 +00:00
|
|
|
'LIBPATH': [abspath('.')],
|
2011-07-20 08:45:30 +00:00
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2011-07-01 09:02:25 +00:00
|
|
|
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
|
2011-04-29 08:50:38 +00:00
|
|
|
'LINKFLAGS': ['$CCFLAGS'],
|
2008-08-27 13:47:52 +00:00
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:linux': {
|
2009-04-17 00:56:52 +00:00
|
|
|
'LIBS': ['pthread'],
|
2011-07-20 08:45:30 +00:00
|
|
|
'CCFLAGS': ['-Wno-unused-but-set-variable'],
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
|
|
|
'os:macos': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
|
|
|
'os:freebsd': {
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': {
|
|
|
|
'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
|
|
|
|
'LINKFLAGS': ['-mt']
|
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:win32': {
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
2011-11-16 14:35:47 +00:00
|
|
|
'os:netbsd': {
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2010-04-16 11:47:23 +00:00
|
|
|
'arch:arm': {
|
|
|
|
'LINKFLAGS': ARM_LINK_FLAGS
|
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
2008-08-27 10:11:39 +00:00
|
|
|
'all': {
|
2009-02-09 15:06:07 +00:00
|
|
|
'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
2009-04-30 07:21:54 +00:00
|
|
|
'arch:ia32': {
|
2009-05-05 12:06:20 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
|
2009-08-27 13:12:28 +00:00
|
|
|
},
|
|
|
|
'arch:x64': {
|
2009-10-13 10:56:13 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
|
2011-08-05 10:00:35 +00:00
|
|
|
'LINKFLAGS': ['/STACK:2097152']
|
2009-08-27 13:12:28 +00:00
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE_FLAGS = {
|
|
|
|
'all': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH': [join(root_dir, 'include')],
|
2011-06-30 11:53:54 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['USING_V8_SHARED']
|
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2011-04-29 08:50:38 +00:00
|
|
|
'LIBPATH': ['.'],
|
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2011-07-01 09:02:25 +00:00
|
|
|
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
|
2011-04-29 08:50:38 +00:00
|
|
|
'LINKFLAGS': ['$CCFLAGS'],
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:linux': {
|
2009-04-17 00:56:52 +00:00
|
|
|
'LIBS': ['pthread'],
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
|
|
|
'os:macos': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
2008-11-21 10:06:29 +00:00
|
|
|
'os:freebsd': {
|
2011-03-29 09:21:25 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
2009-12-02 13:38:50 +00:00
|
|
|
},
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': {
|
2011-07-01 05:50:14 +00:00
|
|
|
# On Solaris, to get isinf, INFINITY, fpclassify and other macros one
|
|
|
|
# needs to define __C99FEATURES__.
|
|
|
|
'CPPDEFINES': ['__C99FEATURES__'],
|
2011-03-29 09:21:25 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
|
|
|
|
'LINKFLAGS': ['-mt']
|
2010-01-25 12:37:31 +00:00
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
2011-03-29 09:21:25 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
|
|
|
'os:win32': {
|
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
|
|
|
},
|
2011-11-16 14:35:47 +00:00
|
|
|
'os:netbsd': {
|
|
|
|
'LIBPATH' : ['/usr/pkg/lib'],
|
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2011-03-29 09:21:25 +00:00
|
|
|
'arch:arm': {
|
2011-04-29 08:50:38 +00:00
|
|
|
'LINKFLAGS': ARM_LINK_FLAGS,
|
2011-04-29 12:13:46 +00:00
|
|
|
'armeabi:soft' : {
|
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
|
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=soft'],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'armeabi:softfp' : {
|
2011-04-29 08:50:38 +00:00
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
|
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=softfp'],
|
|
|
|
}
|
|
|
|
},
|
2011-04-29 12:13:46 +00:00
|
|
|
'armeabi:hard' : {
|
2011-08-10 11:14:32 +00:00
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'],
|
|
|
|
'vfp3:on': {
|
|
|
|
'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
|
|
|
|
},
|
2011-04-29 08:50:38 +00:00
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=hard'],
|
|
|
|
}
|
|
|
|
}
|
2011-03-29 09:21:25 +00:00
|
|
|
},
|
|
|
|
'arch:ia32': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
|
|
|
},
|
|
|
|
'arch:x64': {
|
|
|
|
'CCFLAGS': ['-m64'],
|
|
|
|
'LINKFLAGS': ['-m64']
|
|
|
|
},
|
|
|
|
'arch:mips': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
|
2011-05-24 07:23:32 +00:00
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
|
|
|
|
},
|
2011-03-29 09:21:25 +00:00
|
|
|
'simulator:none': {
|
2011-05-24 07:23:32 +00:00
|
|
|
'CCFLAGS': ['-EL'],
|
2011-03-29 09:21:25 +00:00
|
|
|
'LINKFLAGS': ['-EL'],
|
2011-05-24 07:23:32 +00:00
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2']
|
|
|
|
},
|
|
|
|
'mips_arch_variant:mips32r1': {
|
|
|
|
'CCFLAGS': ['-mips32', '-Wa,-mips32']
|
|
|
|
},
|
|
|
|
'library:static': {
|
|
|
|
'LINKFLAGS': ['-static', '-static-libgcc']
|
|
|
|
},
|
|
|
|
'mipsabi:softfloat': {
|
|
|
|
'CCFLAGS': ['-msoft-float'],
|
|
|
|
'LINKFLAGS': ['-msoft-float']
|
|
|
|
},
|
|
|
|
'mipsabi:hardfloat': {
|
|
|
|
'CCFLAGS': ['-mhard-float'],
|
|
|
|
'LINKFLAGS': ['-mhard-float']
|
|
|
|
}
|
2011-03-29 09:21:25 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'simulator:arm': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
|
|
|
},
|
|
|
|
'simulator:mips': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
|
|
|
},
|
|
|
|
'mode:release': {
|
|
|
|
'CCFLAGS': ['-O2']
|
|
|
|
},
|
|
|
|
'mode:debug': {
|
|
|
|
'CCFLAGS': ['-g', '-O0'],
|
|
|
|
'CPPDEFINES': ['DEBUG']
|
|
|
|
},
|
2011-04-29 12:08:33 +00:00
|
|
|
'compress_startup_data:bz2': {
|
|
|
|
'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'],
|
|
|
|
'os:linux': {
|
|
|
|
'LIBS': ['bz2']
|
|
|
|
}
|
|
|
|
},
|
2011-03-29 09:21:25 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
|
|
|
},
|
|
|
|
'verbose:off': {
|
|
|
|
'CCFLAGS': ['/nologo'],
|
|
|
|
'LINKFLAGS': ['/NOLOGO']
|
|
|
|
},
|
|
|
|
'verbose:on': {
|
|
|
|
'LINKFLAGS': ['/VERBOSE']
|
|
|
|
},
|
|
|
|
'prof:on': {
|
|
|
|
'LINKFLAGS': ['/MAP']
|
|
|
|
},
|
|
|
|
'mode:release': {
|
|
|
|
'CCFLAGS': ['/O2'],
|
|
|
|
'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
|
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MT']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MD']
|
|
|
|
},
|
|
|
|
'msvcltcg:on': {
|
|
|
|
'CCFLAGS': ['/GL'],
|
|
|
|
'pgo:off': {
|
|
|
|
'LINKFLAGS': ['/LTCG'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pgo:instrument': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGI']
|
|
|
|
},
|
|
|
|
'pgo:optimize': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGO']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'arch:ia32': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
|
|
|
|
'LINKFLAGS': ['/MACHINE:X86']
|
|
|
|
},
|
|
|
|
'arch:x64': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
|
2011-08-05 10:00:35 +00:00
|
|
|
'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152']
|
2011-03-29 09:21:25 +00:00
|
|
|
},
|
|
|
|
'mode:debug': {
|
|
|
|
'CCFLAGS': ['/Od'],
|
|
|
|
'LINKFLAGS': ['/DEBUG'],
|
|
|
|
'CPPDEFINES': ['DEBUG'],
|
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MTd']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MDd']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PREPARSER_FLAGS = {
|
|
|
|
'all': {
|
2012-01-19 08:43:11 +00:00
|
|
|
'CPPPATH': [join(root_dir, 'include'), src_dir],
|
2011-06-30 11:53:54 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['USING_V8_SHARED']
|
|
|
|
},
|
2011-03-29 09:21:25 +00:00
|
|
|
},
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2011-04-29 08:50:38 +00:00
|
|
|
'LIBPATH': ['.'],
|
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2011-07-01 09:02:25 +00:00
|
|
|
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
|
2011-04-29 08:50:38 +00:00
|
|
|
'LINKFLAGS': ['$CCFLAGS'],
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
|
|
|
'os:win32': {
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
2008-11-21 10:06:29 +00:00
|
|
|
},
|
2010-04-16 11:47:23 +00:00
|
|
|
'arch:arm': {
|
2011-04-29 08:50:38 +00:00
|
|
|
'LINKFLAGS': ARM_LINK_FLAGS,
|
2011-04-29 12:13:46 +00:00
|
|
|
'armeabi:soft' : {
|
|
|
|
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
|
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=soft'],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'armeabi:softfp' : {
|
2011-04-29 08:50:38 +00:00
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=softfp'],
|
|
|
|
}
|
|
|
|
},
|
2011-04-29 12:13:46 +00:00
|
|
|
'armeabi:hard' : {
|
2011-04-29 08:50:38 +00:00
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-mfloat-abi=hard'],
|
|
|
|
}
|
|
|
|
}
|
2010-04-16 11:47:23 +00:00
|
|
|
},
|
2009-07-16 22:41:28 +00:00
|
|
|
'arch:ia32': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
2008-08-27 13:47:52 +00:00
|
|
|
},
|
2009-07-16 22:41:28 +00:00
|
|
|
'arch:x64': {
|
|
|
|
'CCFLAGS': ['-m64'],
|
|
|
|
'LINKFLAGS': ['-m64']
|
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
'arch:mips': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
|
2011-03-28 13:05:36 +00:00
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2']
|
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
'simulator:none': {
|
2011-03-28 13:05:36 +00:00
|
|
|
'CCFLAGS': ['-EL'],
|
2010-02-04 20:36:58 +00:00
|
|
|
'LINKFLAGS': ['-EL'],
|
2011-03-28 13:05:36 +00:00
|
|
|
'mips_arch_variant:mips32r2': {
|
|
|
|
'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2']
|
|
|
|
},
|
|
|
|
'mips_arch_variant:mips32r1': {
|
|
|
|
'CCFLAGS': ['-mips32', '-Wa,-mips32']
|
|
|
|
},
|
|
|
|
'library:static': {
|
|
|
|
'LINKFLAGS': ['-static', '-static-libgcc']
|
|
|
|
},
|
|
|
|
'mipsabi:softfloat': {
|
|
|
|
'CCFLAGS': ['-msoft-float'],
|
|
|
|
'LINKFLAGS': ['-msoft-float']
|
|
|
|
},
|
|
|
|
'mipsabi:hardfloat': {
|
|
|
|
'CCFLAGS': ['-mhard-float'],
|
|
|
|
'LINKFLAGS': ['-mhard-float']
|
|
|
|
}
|
2010-02-04 20:36:58 +00:00
|
|
|
}
|
|
|
|
},
|
2009-07-16 22:41:28 +00:00
|
|
|
'simulator:arm': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
2009-04-29 13:11:48 +00:00
|
|
|
},
|
2010-02-04 20:36:58 +00:00
|
|
|
'simulator:mips': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
2011-03-28 13:05:36 +00:00
|
|
|
'LINKFLAGS': ['-m32'],
|
|
|
|
'mipsabi:softfloat': {
|
|
|
|
'CPPDEFINES': ['__mips_soft_float=1'],
|
2011-05-24 07:23:32 +00:00
|
|
|
},
|
|
|
|
'mipsabi:hardfloat': {
|
|
|
|
'CPPDEFINES': ['__mips_hard_float=1'],
|
2011-03-28 13:05:36 +00:00
|
|
|
}
|
2010-02-04 20:36:58 +00:00
|
|
|
},
|
2008-09-22 08:27:54 +00:00
|
|
|
'mode:release': {
|
2008-09-26 16:14:22 +00:00
|
|
|
'CCFLAGS': ['-O2']
|
2008-09-22 08:27:54 +00:00
|
|
|
},
|
2008-09-09 19:08:40 +00:00
|
|
|
'mode:debug': {
|
2010-12-07 11:31:57 +00:00
|
|
|
'CCFLAGS': ['-g', '-O0'],
|
|
|
|
'CPPDEFINES': ['DEBUG']
|
2009-03-05 10:53:08 +00:00
|
|
|
},
|
2011-06-22 20:22:44 +00:00
|
|
|
'os:freebsd': {
|
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-08-27 13:12:28 +00:00
|
|
|
'verbose:off': {
|
|
|
|
'CCFLAGS': ['/nologo'],
|
|
|
|
'LINKFLAGS': ['/NOLOGO']
|
|
|
|
},
|
|
|
|
'verbose:on': {
|
|
|
|
'LINKFLAGS': ['/VERBOSE']
|
|
|
|
},
|
2008-09-24 08:47:39 +00:00
|
|
|
'prof:on': {
|
|
|
|
'LINKFLAGS': ['/MAP']
|
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
'mode:release': {
|
2008-11-21 11:19:01 +00:00
|
|
|
'CCFLAGS': ['/O2'],
|
2009-04-18 00:03:15 +00:00
|
|
|
'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
|
2008-11-21 11:19:01 +00:00
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MT']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MD']
|
2009-04-18 00:03:15 +00:00
|
|
|
},
|
|
|
|
'msvcltcg:on': {
|
|
|
|
'CCFLAGS': ['/GL'],
|
2010-02-23 15:22:48 +00:00
|
|
|
'pgo:off': {
|
|
|
|
'LINKFLAGS': ['/LTCG'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pgo:instrument': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGI']
|
|
|
|
},
|
|
|
|
'pgo:optimize': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGO']
|
2008-11-21 11:19:01 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-04-30 07:21:54 +00:00
|
|
|
'arch:ia32': {
|
2011-03-18 20:35:07 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
|
2009-08-27 13:12:28 +00:00
|
|
|
'LINKFLAGS': ['/MACHINE:X86']
|
|
|
|
},
|
|
|
|
'arch:x64': {
|
2011-03-18 21:37:28 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
|
2011-08-05 10:00:35 +00:00
|
|
|
'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152']
|
2009-04-30 07:21:54 +00:00
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
'mode:debug': {
|
2010-12-07 11:31:57 +00:00
|
|
|
'CCFLAGS': ['/Od'],
|
|
|
|
'LINKFLAGS': ['/DEBUG'],
|
|
|
|
'CPPDEFINES': ['DEBUG'],
|
2008-11-21 11:19:01 +00:00
|
|
|
'msvcrt:static': {
|
2010-12-07 11:31:57 +00:00
|
|
|
'CCFLAGS': ['/MTd']
|
2008-11-21 11:19:01 +00:00
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
2010-12-07 11:31:57 +00:00
|
|
|
'CCFLAGS': ['/MDd']
|
2008-11-21 11:19:01 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
D8_FLAGS = {
|
2011-07-14 15:43:40 +00:00
|
|
|
'all': {
|
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['V8_SHARED'],
|
|
|
|
'LIBS': ['v8'],
|
|
|
|
'LIBPATH': ['.']
|
|
|
|
},
|
|
|
|
},
|
2008-10-21 09:12:27 +00:00
|
|
|
'gcc': {
|
2011-04-29 08:50:38 +00:00
|
|
|
'all': {
|
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2011-07-01 09:02:25 +00:00
|
|
|
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
|
2011-04-29 08:50:38 +00:00
|
|
|
'LINKFLAGS': ['$CCFLAGS'],
|
|
|
|
},
|
2008-10-21 09:12:27 +00:00
|
|
|
'console:readline': {
|
|
|
|
'LIBS': ['readline']
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
|
|
|
'os:linux': {
|
2009-04-17 00:56:52 +00:00
|
|
|
'LIBS': ['pthread'],
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
|
|
|
'os:macos': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
|
|
|
'os:freebsd': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': {
|
|
|
|
'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
|
|
|
|
'LINKFLAGS': ['-mt']
|
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:win32': {
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32'],
|
2009-02-09 15:06:07 +00:00
|
|
|
},
|
2011-11-16 14:35:47 +00:00
|
|
|
'os:netbsd': {
|
|
|
|
'LIBS': ['pthread'],
|
|
|
|
},
|
2010-07-22 12:57:48 +00:00
|
|
|
'arch:arm': {
|
|
|
|
'LINKFLAGS': ARM_LINK_FLAGS
|
|
|
|
},
|
2011-06-08 09:00:25 +00:00
|
|
|
'compress_startup_data:bz2': {
|
|
|
|
'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'],
|
|
|
|
'os:linux': {
|
|
|
|
'LIBS': ['bz2']
|
|
|
|
}
|
|
|
|
}
|
2008-10-21 09:12:27 +00:00
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'msvc': {
|
|
|
|
'all': {
|
2009-02-24 13:32:01 +00:00
|
|
|
'LIBS': ['winmm', 'ws2_32']
|
2011-08-05 10:00:35 +00:00
|
|
|
},
|
|
|
|
'verbose:off': {
|
|
|
|
'CCFLAGS': ['/nologo'],
|
|
|
|
'LINKFLAGS': ['/NOLOGO']
|
|
|
|
},
|
|
|
|
'verbose:on': {
|
|
|
|
'LINKFLAGS': ['/VERBOSE']
|
|
|
|
},
|
|
|
|
'prof:on': {
|
|
|
|
'LINKFLAGS': ['/MAP']
|
|
|
|
},
|
|
|
|
'mode:release': {
|
|
|
|
'CCFLAGS': ['/O2'],
|
|
|
|
'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
|
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MT']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MD']
|
|
|
|
},
|
|
|
|
'msvcltcg:on': {
|
|
|
|
'CCFLAGS': ['/GL'],
|
|
|
|
'pgo:off': {
|
|
|
|
'LINKFLAGS': ['/LTCG'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pgo:instrument': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGI']
|
|
|
|
},
|
|
|
|
'pgo:optimize': {
|
|
|
|
'LINKFLAGS': ['/LTCG:PGO']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'arch:ia32': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
|
|
|
|
'LINKFLAGS': ['/MACHINE:X86']
|
|
|
|
},
|
|
|
|
'arch:x64': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
|
|
|
|
'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152']
|
|
|
|
},
|
|
|
|
'mode:debug': {
|
|
|
|
'CCFLAGS': ['/Od'],
|
|
|
|
'LINKFLAGS': ['/DEBUG'],
|
|
|
|
'CPPDEFINES': ['DEBUG'],
|
|
|
|
'msvcrt:static': {
|
|
|
|
'CCFLAGS': ['/MTd']
|
|
|
|
},
|
|
|
|
'msvcrt:shared': {
|
|
|
|
'CCFLAGS': ['/MDd']
|
|
|
|
}
|
2009-02-09 15:06:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-10-21 09:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
SUFFIXES = {
|
|
|
|
'release': '',
|
|
|
|
'debug': '_g'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
def Abort(message):
|
|
|
|
print message
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
def GuessOS(env):
|
|
|
|
return utils.GuessOS()
|
|
|
|
|
|
|
|
|
|
|
|
def GuessArch(env):
|
|
|
|
return utils.GuessArchitecture()
|
|
|
|
|
|
|
|
|
|
|
|
def GuessToolchain(env):
|
|
|
|
tools = env['TOOLS']
|
2008-07-03 15:10:15 +00:00
|
|
|
if 'gcc' in tools:
|
2008-07-30 08:49:36 +00:00
|
|
|
return 'gcc'
|
2008-07-03 15:10:15 +00:00
|
|
|
elif 'msvc' in tools:
|
|
|
|
return 'msvc'
|
|
|
|
else:
|
2008-08-27 10:11:39 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
def GuessVisibility(env):
|
|
|
|
os = env['os']
|
|
|
|
toolchain = env['toolchain'];
|
2011-02-17 16:33:10 +00:00
|
|
|
if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc':
|
|
|
|
# MinGW / Cygwin can't do it.
|
2010-12-02 15:37:45 +00:00
|
|
|
return 'default'
|
2011-01-11 11:44:16 +00:00
|
|
|
elif os == 'solaris':
|
|
|
|
return 'default'
|
2010-12-02 15:37:45 +00:00
|
|
|
else:
|
|
|
|
return 'hidden'
|
|
|
|
|
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
def GuessStrictAliasing(env):
|
|
|
|
# There seems to be a problem with gcc 4.5.x.
|
|
|
|
# See http://code.google.com/p/v8/issues/detail?id=884
|
|
|
|
# It can be worked around by disabling strict aliasing.
|
|
|
|
toolchain = env['toolchain'];
|
|
|
|
if toolchain == 'gcc':
|
|
|
|
env = Environment(tools=['gcc'])
|
|
|
|
# The gcc version should be available in env['CCVERSION'],
|
|
|
|
# but when scons detects msvc this value is not set.
|
|
|
|
version = subprocess.Popen([env['CC'], '-dumpversion'],
|
|
|
|
stdout=subprocess.PIPE).communicate()[0]
|
|
|
|
if version.find('4.5') == 0:
|
|
|
|
return 'off'
|
|
|
|
return 'default'
|
2008-08-27 10:11:39 +00:00
|
|
|
|
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
PLATFORM_OPTIONS = {
|
|
|
|
'arch': {
|
|
|
|
'values': ['arm', 'ia32', 'x64', 'mips'],
|
|
|
|
'guess': GuessArch,
|
|
|
|
'help': 'the architecture to build for'
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
|
|
|
'os': {
|
2011-11-16 14:35:47 +00:00
|
|
|
'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin', 'netbsd'],
|
2011-03-30 17:33:18 +00:00
|
|
|
'guess': GuessOS,
|
|
|
|
'help': 'the os to build for'
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
2011-03-30 17:33:18 +00:00
|
|
|
'toolchain': {
|
|
|
|
'values': ['gcc', 'msvc'],
|
|
|
|
'guess': GuessToolchain,
|
|
|
|
'help': 'the toolchain to use'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SIMPLE_OPTIONS = {
|
2009-07-07 08:11:19 +00:00
|
|
|
'regexp': {
|
|
|
|
'values': ['native', 'interpreted'],
|
|
|
|
'default': 'native',
|
|
|
|
'help': 'Whether to use native or interpreted regexp implementation'
|
|
|
|
},
|
2008-08-27 10:11:39 +00:00
|
|
|
'snapshot': {
|
2009-01-30 09:34:55 +00:00
|
|
|
'values': ['on', 'off', 'nobuild'],
|
2008-08-27 10:11:39 +00:00
|
|
|
'default': 'off',
|
|
|
|
'help': 'build using snapshots for faster start-up'
|
|
|
|
},
|
2008-09-24 08:47:39 +00:00
|
|
|
'prof': {
|
2011-02-11 12:25:41 +00:00
|
|
|
'values': ['on', 'off'],
|
2008-09-24 08:47:39 +00:00
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable profiling of build target'
|
|
|
|
},
|
2011-01-18 16:11:01 +00:00
|
|
|
'gdbjit': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable GDB JIT interface'
|
|
|
|
},
|
2008-08-27 10:11:39 +00:00
|
|
|
'library': {
|
2008-08-29 09:31:07 +00:00
|
|
|
'values': ['static', 'shared'],
|
|
|
|
'default': 'static',
|
2008-08-27 10:11:39 +00:00
|
|
|
'help': 'the type of library to produce'
|
|
|
|
},
|
2010-12-20 10:38:19 +00:00
|
|
|
'objectprint': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable object printing'
|
|
|
|
},
|
2009-09-11 12:26:15 +00:00
|
|
|
'profilingsupport': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'on',
|
|
|
|
'help': 'enable profiling of JavaScript code'
|
|
|
|
},
|
|
|
|
'debuggersupport': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'on',
|
|
|
|
'help': 'enable debugging of JavaScript code'
|
|
|
|
},
|
2011-01-19 08:04:48 +00:00
|
|
|
'inspector': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable inspector features'
|
|
|
|
},
|
2011-01-20 08:38:01 +00:00
|
|
|
'liveobjectlist': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable live object list features in the debugger'
|
|
|
|
},
|
2009-04-30 09:29:15 +00:00
|
|
|
'soname': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'turn on setting soname for Linux shared library'
|
|
|
|
},
|
2008-11-21 11:19:01 +00:00
|
|
|
'msvcrt': {
|
|
|
|
'values': ['static', 'shared'],
|
|
|
|
'default': 'static',
|
2009-04-18 00:03:15 +00:00
|
|
|
'help': 'the type of Microsoft Visual C++ runtime library to use'
|
|
|
|
},
|
|
|
|
'msvcltcg': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'on',
|
|
|
|
'help': 'use Microsoft Visual C++ link-time code generation'
|
2008-11-21 11:19:01 +00:00
|
|
|
},
|
2008-08-27 10:11:39 +00:00
|
|
|
'simulator': {
|
2010-02-04 20:36:58 +00:00
|
|
|
'values': ['arm', 'mips', 'none'],
|
2008-08-27 10:11:39 +00:00
|
|
|
'default': 'none',
|
|
|
|
'help': 'build with simulator'
|
2008-09-05 12:21:04 +00:00
|
|
|
},
|
2010-05-27 07:31:10 +00:00
|
|
|
'unalignedaccesses': {
|
|
|
|
'values': ['default', 'on', 'off'],
|
|
|
|
'default': 'default',
|
|
|
|
'help': 'set whether the ARM target supports unaligned accesses'
|
|
|
|
},
|
2008-09-05 12:21:04 +00:00
|
|
|
'disassembler': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable the disassembler to inspect generated code'
|
2008-09-08 13:08:10 +00:00
|
|
|
},
|
2011-03-27 16:14:20 +00:00
|
|
|
'fasttls': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'on',
|
|
|
|
'help': 'enable fast thread local storage support '
|
|
|
|
'(if available on the current architecture/platform)'
|
|
|
|
},
|
2008-09-08 13:08:10 +00:00
|
|
|
'sourcesignatures': {
|
|
|
|
'values': ['MD5', 'timestamp'],
|
|
|
|
'default': 'MD5',
|
|
|
|
'help': 'set how the build system detects file changes'
|
2008-10-21 09:12:27 +00:00
|
|
|
},
|
|
|
|
'console': {
|
|
|
|
'values': ['dumb', 'readline'],
|
|
|
|
'default': 'dumb',
|
|
|
|
'help': 'the console to use for the d8 shell'
|
2009-08-27 13:12:28 +00:00
|
|
|
},
|
|
|
|
'verbose': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'more output from compiler and linker'
|
2009-09-15 11:11:09 +00:00
|
|
|
},
|
|
|
|
'visibility': {
|
|
|
|
'values': ['default', 'hidden'],
|
2011-03-30 17:33:18 +00:00
|
|
|
'guess': GuessVisibility,
|
|
|
|
'help': 'shared library symbol visibility'
|
|
|
|
},
|
|
|
|
'strictaliasing': {
|
|
|
|
'values': ['default', 'off'],
|
|
|
|
'guess': GuessStrictAliasing,
|
|
|
|
'help': 'assume strict aliasing while optimizing'
|
2009-12-09 12:56:42 +00:00
|
|
|
},
|
2010-02-23 15:22:48 +00:00
|
|
|
'pgo': {
|
|
|
|
'values': ['off', 'instrument', 'optimize'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'select profile guided optimization variant',
|
2011-03-28 13:05:36 +00:00
|
|
|
},
|
2011-04-29 08:50:38 +00:00
|
|
|
'armeabi': {
|
2011-04-29 12:13:46 +00:00
|
|
|
'values': ['hard', 'softfp', 'soft'],
|
|
|
|
'default': 'softfp',
|
2011-04-29 08:50:38 +00:00
|
|
|
'help': 'generate calling conventiont according to selected ARM EABI variant'
|
|
|
|
},
|
2011-03-28 13:05:36 +00:00
|
|
|
'mipsabi': {
|
|
|
|
'values': ['hardfloat', 'softfloat', 'none'],
|
|
|
|
'default': 'hardfloat',
|
|
|
|
'help': 'generate calling conventiont according to selected mips ABI'
|
|
|
|
},
|
|
|
|
'mips_arch_variant': {
|
|
|
|
'values': ['mips32r2', 'mips32r1'],
|
|
|
|
'default': 'mips32r2',
|
|
|
|
'help': 'mips variant'
|
2011-04-29 12:08:33 +00:00
|
|
|
},
|
|
|
|
'compress_startup_data': {
|
|
|
|
'values': ['off', 'bz2'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'compress startup data (snapshot) [Linux only]'
|
|
|
|
},
|
2011-08-10 11:14:32 +00:00
|
|
|
'vfp3': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'on',
|
|
|
|
'help': 'use vfp3 instructions when building the snapshot [Arm only]'
|
|
|
|
},
|
|
|
|
|
2008-08-27 10:11:39 +00:00
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS)
|
|
|
|
|
|
|
|
|
|
|
|
def AddOptions(options, result):
|
|
|
|
guess_env = Environment(options=result)
|
|
|
|
for (name, option) in options.iteritems():
|
|
|
|
if 'guess' in option:
|
|
|
|
# Option has a guess function
|
|
|
|
guess = option.get('guess')
|
|
|
|
default = guess(guess_env)
|
|
|
|
else:
|
|
|
|
# Option has a fixed default
|
|
|
|
default = option.get('default')
|
|
|
|
help = '%s (%s)' % (option.get('help'), ", ".join(option['values']))
|
|
|
|
result.Add(name, help, default)
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
def GetOptions():
|
|
|
|
result = Options()
|
2008-07-30 08:49:36 +00:00
|
|
|
result.Add('mode', 'compilation mode (debug, release)', 'release')
|
2010-01-18 16:45:13 +00:00
|
|
|
result.Add('sample', 'build sample (shell, process, lineprocessor)', '')
|
2010-06-11 11:19:27 +00:00
|
|
|
result.Add('cache', 'directory to use for scons build cache', '')
|
2009-04-02 13:00:28 +00:00
|
|
|
result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '')
|
|
|
|
result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '')
|
2011-03-30 17:33:18 +00:00
|
|
|
AddOptions(PLATFORM_OPTIONS, result)
|
|
|
|
AddOptions(SIMPLE_OPTIONS, result)
|
2008-07-03 15:10:15 +00:00
|
|
|
return result
|
|
|
|
|
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
def GetTools(opts):
|
|
|
|
env = Environment(options=opts)
|
|
|
|
os = env['os']
|
|
|
|
toolchain = env['toolchain']
|
|
|
|
if os == 'win32' and toolchain == 'gcc':
|
|
|
|
return ['mingw']
|
|
|
|
elif os == 'win32' and toolchain == 'msvc':
|
|
|
|
return ['msvc', 'mslink', 'mslib', 'msvs']
|
|
|
|
else:
|
|
|
|
return ['default']
|
|
|
|
|
|
|
|
|
2009-04-30 09:29:15 +00:00
|
|
|
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]
|
|
|
|
|
2009-04-30 10:30:44 +00:00
|
|
|
source = open(join(root_dir, 'src', 'version.cc')).read()
|
2009-04-30 09:29:15 +00:00
|
|
|
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()
|
2009-06-18 00:22:52 +00:00
|
|
|
|
2009-04-30 09:29:15 +00:00
|
|
|
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+\"(.*)\"")
|
2009-06-18 00:22:52 +00:00
|
|
|
|
2009-04-30 10:30:44 +00:00
|
|
|
source = open(join(root_dir, 'src', 'version.cc')).read()
|
2009-04-30 09:29:15 +00:00
|
|
|
match = SONAME_PATTERN.search(source)
|
2009-06-18 00:22:52 +00:00
|
|
|
|
2009-04-30 09:29:15 +00:00
|
|
|
if match:
|
|
|
|
return match.group(1).strip()
|
|
|
|
else:
|
|
|
|
return ''
|
|
|
|
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
def SplitList(str):
|
|
|
|
return [ s for s in str.split(",") if len(s) > 0 ]
|
|
|
|
|
|
|
|
|
|
|
|
def IsLegal(env, option, values):
|
|
|
|
str = env[option]
|
|
|
|
for s in SplitList(str):
|
|
|
|
if not s in values:
|
|
|
|
Abort("Illegal value for option %s '%s'." % (option, s))
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
def VerifyOptions(env):
|
2008-08-22 13:33:59 +00:00
|
|
|
if not IsLegal(env, 'mode', ['debug', 'release']):
|
|
|
|
return False
|
2010-01-18 16:45:13 +00:00
|
|
|
if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]):
|
2008-08-22 13:33:59 +00:00
|
|
|
return False
|
2009-07-07 08:11:19 +00:00
|
|
|
if not IsLegal(env, 'regexp', ["native", "interpreted"]):
|
|
|
|
return False
|
2008-09-24 08:47:39 +00:00
|
|
|
if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on':
|
|
|
|
Abort("Profiling on windows only supported for static library.")
|
2011-06-30 11:52:00 +00:00
|
|
|
if env['gdbjit'] == 'on' and ((env['os'] != 'linux' and env['os'] != 'macos') or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')):
|
|
|
|
Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64) Linux/OSX target.")
|
2009-04-30 09:29:15 +00:00
|
|
|
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.")
|
2010-02-23 15:22:48 +00:00
|
|
|
if env['os'] != 'win32' and env['pgo'] != 'off':
|
|
|
|
Abort("Profile guided optimization only supported on Windows.")
|
2010-06-11 11:19:27 +00:00
|
|
|
if env['cache'] and not os.path.isdir(env['cache']):
|
|
|
|
Abort("The specified cache directory does not exist.")
|
2010-05-27 07:31:10 +00:00
|
|
|
if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS):
|
|
|
|
print env['arch']
|
|
|
|
print env['simulator']
|
|
|
|
Abort("Option unalignedaccesses only supported for the ARM architecture.")
|
2011-04-29 12:08:33 +00:00
|
|
|
if env['os'] != 'linux' and env['compress_startup_data'] != 'off':
|
|
|
|
Abort("Startup data compression is only available on Linux")
|
2011-03-30 17:33:18 +00:00
|
|
|
for (name, option) in ALL_OPTIONS.iteritems():
|
|
|
|
if (not name in env):
|
2008-08-27 10:11:39 +00:00
|
|
|
message = ("A value for option %s must be specified (%s)." %
|
|
|
|
(name, ", ".join(option['values'])))
|
|
|
|
Abort(message)
|
|
|
|
if not env[name] in option['values']:
|
|
|
|
message = ("Unknown %s value '%s'. Possible values are (%s)." %
|
|
|
|
(name, env[name], ", ".join(option['values'])))
|
|
|
|
Abort(message)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
class BuildContext(object):
|
|
|
|
|
2008-09-02 09:05:53 +00:00
|
|
|
def __init__(self, options, env_overrides, samples):
|
2008-08-22 13:33:59 +00:00
|
|
|
self.library_targets = []
|
2009-01-30 09:34:55 +00:00
|
|
|
self.mksnapshot_targets = []
|
2008-08-22 13:33:59 +00:00
|
|
|
self.cctest_targets = []
|
|
|
|
self.sample_targets = []
|
2008-10-21 09:12:27 +00:00
|
|
|
self.d8_targets = []
|
2008-08-27 10:11:39 +00:00
|
|
|
self.options = options
|
2008-09-02 09:05:53 +00:00
|
|
|
self.env_overrides = env_overrides
|
2008-08-22 13:33:59 +00:00
|
|
|
self.samples = samples
|
2011-03-29 09:21:25 +00:00
|
|
|
self.preparser_targets = []
|
2009-01-30 09:34:55 +00:00
|
|
|
self.use_snapshot = (options['snapshot'] != 'off')
|
|
|
|
self.build_snapshot = (options['snapshot'] == 'on')
|
2008-08-22 13:33:59 +00:00
|
|
|
self.flags = None
|
2008-09-22 15:50:30 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
def AddRelevantFlags(self, initial, flags):
|
|
|
|
result = initial.copy()
|
2008-08-27 10:11:39 +00:00
|
|
|
toolchain = self.options['toolchain']
|
2008-11-21 11:19:01 +00:00
|
|
|
if toolchain in flags:
|
|
|
|
self.AppendFlags(result, flags[toolchain].get('all'))
|
|
|
|
for option in sorted(self.options.keys()):
|
|
|
|
value = self.options[option]
|
|
|
|
self.AppendFlags(result, flags[toolchain].get(option + ':' + value))
|
2009-04-24 12:56:58 +00:00
|
|
|
self.AppendFlags(result, flags.get('all'))
|
2008-11-21 11:19:01 +00:00
|
|
|
return result
|
|
|
|
|
|
|
|
def AddRelevantSubFlags(self, options, flags):
|
|
|
|
self.AppendFlags(options, flags.get('all'))
|
2008-08-27 10:11:39 +00:00
|
|
|
for option in sorted(self.options.keys()):
|
|
|
|
value = self.options[option]
|
2008-11-21 11:19:01 +00:00
|
|
|
self.AppendFlags(options, flags.get(option + ':' + value))
|
2008-09-22 15:50:30 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
def GetRelevantSources(self, source):
|
|
|
|
result = []
|
|
|
|
result += source.get('all', [])
|
2008-09-22 15:50:30 +00:00
|
|
|
for (name, value) in self.options.iteritems():
|
2009-08-14 11:24:32 +00:00
|
|
|
source_value = source.get(name + ':' + value, [])
|
|
|
|
if type(source_value) == dict:
|
|
|
|
result += self.GetRelevantSources(source_value)
|
|
|
|
else:
|
|
|
|
result += source_value
|
2008-08-27 10:11:39 +00:00
|
|
|
return sorted(result)
|
2008-08-22 13:33:59 +00:00
|
|
|
|
|
|
|
def AppendFlags(self, options, added):
|
|
|
|
if not added:
|
|
|
|
return
|
2008-09-22 15:50:30 +00:00
|
|
|
for (key, value) in added.iteritems():
|
2008-11-21 11:19:01 +00:00
|
|
|
if key.find(':') != -1:
|
|
|
|
self.AddRelevantSubFlags(options, { key: value })
|
2008-08-22 13:33:59 +00:00
|
|
|
else:
|
2008-11-21 11:19:01 +00:00
|
|
|
if not key in options:
|
|
|
|
options[key] = value
|
|
|
|
else:
|
|
|
|
prefix = options[key]
|
|
|
|
if isinstance(prefix, StringTypes): prefix = prefix.split()
|
|
|
|
options[key] = prefix + value
|
2008-08-27 10:11:39 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
def ConfigureObject(self, env, input, **kw):
|
2009-03-23 12:37:53 +00:00
|
|
|
if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')):
|
|
|
|
kw['CPPPATH'] += env['CPPPATH']
|
2008-08-27 10:11:39 +00:00
|
|
|
if self.options['library'] == 'static':
|
2008-08-22 13:33:59 +00:00
|
|
|
return env.StaticObject(input, **kw)
|
|
|
|
else:
|
2008-08-29 09:31:07 +00:00
|
|
|
return env.SharedObject(input, **kw)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2008-09-05 10:00:50 +00:00
|
|
|
def ApplyEnvOverrides(self, env):
|
|
|
|
if not self.env_overrides:
|
|
|
|
return
|
|
|
|
if type(env['ENV']) == DictType:
|
|
|
|
env['ENV'].update(**self.env_overrides)
|
|
|
|
else:
|
|
|
|
env['ENV'] = self.env_overrides
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-02-23 15:22:48 +00:00
|
|
|
def PostprocessOptions(options, os):
|
2008-08-27 10:11:39 +00:00
|
|
|
# Adjust architecture if the simulator option has been set
|
|
|
|
if (options['simulator'] != 'none') and (options['arch'] != options['simulator']):
|
|
|
|
if 'arch' in ARGUMENTS:
|
|
|
|
# Print a warning if arch has explicitly been set
|
|
|
|
print "Warning: forcing architecture to match simulator (%s)" % options['simulator']
|
|
|
|
options['arch'] = options['simulator']
|
2009-09-11 12:26:15 +00:00
|
|
|
if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'):
|
|
|
|
# Print a warning if profiling is enabled without profiling support
|
|
|
|
print "Warning: forcing profilingsupport on when prof is on"
|
|
|
|
options['profilingsupport'] = 'on'
|
2010-02-23 15:22:48 +00:00
|
|
|
if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off':
|
|
|
|
if 'msvcltcg' in ARGUMENTS:
|
|
|
|
print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo']
|
|
|
|
options['msvcltcg'] = 'on'
|
2011-05-24 07:23:32 +00:00
|
|
|
if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options['simulator'] != 'mips'):
|
|
|
|
options['mipsabi'] = 'none'
|
2011-01-20 08:38:01 +00:00
|
|
|
if options['liveobjectlist'] == 'on':
|
|
|
|
if (options['debuggersupport'] != 'on') or (options['mode'] == 'release'):
|
|
|
|
# Print a warning that liveobjectlist will implicitly enable the debugger
|
|
|
|
print "Warning: forcing debuggersupport on for liveobjectlist"
|
|
|
|
options['debuggersupport'] = 'on'
|
2011-01-25 12:28:45 +00:00
|
|
|
options['inspector'] = 'on'
|
|
|
|
options['objectprint'] = 'on'
|
2008-08-27 10:11:39 +00:00
|
|
|
|
|
|
|
|
2009-04-02 13:00:28 +00:00
|
|
|
def ParseEnvOverrides(arg, imports):
|
|
|
|
# The environment overrides are in the format NAME0:value0,NAME1:value1,...
|
|
|
|
# The environment imports are in the format NAME0,NAME1,...
|
2008-09-02 09:05:53 +00:00
|
|
|
overrides = {}
|
2009-04-02 13:00:28 +00:00
|
|
|
for var in imports.split(','):
|
|
|
|
if var in os.environ:
|
|
|
|
overrides[var] = os.environ[var]
|
2008-09-02 09:05:53 +00:00
|
|
|
for override in arg.split(','):
|
|
|
|
pos = override.find(':')
|
|
|
|
if pos == -1:
|
|
|
|
continue
|
|
|
|
overrides[override[:pos].strip()] = override[pos+1:].strip()
|
|
|
|
return overrides
|
|
|
|
|
|
|
|
|
2011-03-30 17:33:18 +00:00
|
|
|
def BuildSpecific(env, mode, env_overrides, tools):
|
2008-08-27 10:11:39 +00:00
|
|
|
options = {'mode': mode}
|
2011-03-30 17:33:18 +00:00
|
|
|
for option in ALL_OPTIONS:
|
2008-08-27 10:11:39 +00:00
|
|
|
options[option] = env[option]
|
2010-02-23 15:22:48 +00:00
|
|
|
PostprocessOptions(options, env['os'])
|
2008-08-27 10:11:39 +00:00
|
|
|
|
2008-09-02 09:05:53 +00:00
|
|
|
context = BuildContext(options, env_overrides, samples=SplitList(env['sample']))
|
2008-08-22 13:33:59 +00:00
|
|
|
|
2009-08-25 06:31:17 +00:00
|
|
|
# Remove variables which can't be imported from the user's external
|
|
|
|
# environment into a construction environment.
|
|
|
|
user_environ = os.environ.copy()
|
|
|
|
try:
|
|
|
|
del user_environ['ENV']
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS)
|
2008-08-22 13:33:59 +00:00
|
|
|
v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS)
|
2009-02-09 16:00:55 +00:00
|
|
|
mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS)
|
2008-08-22 13:33:59 +00:00
|
|
|
dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS)
|
2008-09-22 15:50:30 +00:00
|
|
|
cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS)
|
2009-08-25 06:31:17 +00:00
|
|
|
sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS)
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS)
|
2008-10-21 09:12:27 +00:00
|
|
|
d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS)
|
2008-08-22 13:33:59 +00:00
|
|
|
|
|
|
|
context.flags = {
|
|
|
|
'v8': v8_flags,
|
2009-02-09 16:00:55 +00:00
|
|
|
'mksnapshot': mksnapshot_flags,
|
2008-08-22 13:33:59 +00:00
|
|
|
'dtoa': dtoa_flags,
|
|
|
|
'cctest': cctest_flags,
|
2008-10-21 09:12:27 +00:00
|
|
|
'sample': sample_flags,
|
2011-03-29 09:21:25 +00:00
|
|
|
'd8': d8_flags,
|
|
|
|
'preparser': preparser_flags
|
2008-08-22 13:33:59 +00:00
|
|
|
}
|
2008-09-22 15:50:30 +00:00
|
|
|
|
2009-04-30 09:29:15 +00:00
|
|
|
# Generate library base name.
|
2008-08-22 13:33:59 +00:00
|
|
|
target_id = mode
|
|
|
|
suffix = SUFFIXES[target_id]
|
|
|
|
library_name = 'v8' + suffix
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_library_name = 'v8preparser' + suffix
|
2009-04-30 09:29:15 +00:00
|
|
|
version = GetVersion()
|
|
|
|
if context.options['soname'] == 'on':
|
|
|
|
# When building shared object with SONAME version the library name.
|
|
|
|
library_name += '-' + version
|
2008-08-22 13:33:59 +00:00
|
|
|
|
2009-04-30 09:29:15 +00:00
|
|
|
# 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
|
|
|
|
|
2009-03-20 14:49:12 +00:00
|
|
|
# Build the object files by invoking SCons recursively.
|
2011-08-08 09:34:18 +00:00
|
|
|
d8_env = Environment(tools=tools)
|
|
|
|
d8_env.Replace(**context.flags['d8'])
|
2011-03-29 09:21:25 +00:00
|
|
|
(object_files, shell_files, mksnapshot, preparser_files) = env.SConscript(
|
2008-07-03 15:10:15 +00:00
|
|
|
join('src', 'SConscript'),
|
2008-08-22 13:33:59 +00:00
|
|
|
build_dir=join('obj', target_id),
|
2011-08-08 09:34:18 +00:00
|
|
|
exports='context tools d8_env',
|
2008-07-03 15:10:15 +00:00
|
|
|
duplicate=False
|
|
|
|
)
|
2008-10-21 09:12:27 +00:00
|
|
|
|
2009-01-30 09:34:55 +00:00
|
|
|
context.mksnapshot_targets.append(mksnapshot)
|
|
|
|
|
2008-07-30 08:49:36 +00:00
|
|
|
# Link the object files into a library.
|
2008-09-11 14:39:11 +00:00
|
|
|
env.Replace(**context.flags['v8'])
|
2010-01-25 12:37:31 +00:00
|
|
|
|
2008-09-05 10:00:50 +00:00
|
|
|
context.ApplyEnvOverrides(env)
|
2008-08-27 10:11:39 +00:00
|
|
|
if context.options['library'] == 'static':
|
2008-08-22 13:33:59 +00:00
|
|
|
library = env.StaticLibrary(library_name, object_files)
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_library = env.StaticLibrary(preparser_library_name,
|
|
|
|
preparser_files)
|
2008-08-29 09:31:07 +00:00
|
|
|
else:
|
2008-07-30 08:49:36 +00:00
|
|
|
# There seems to be a glitch in the way scons decides where to put
|
|
|
|
# PDB files when compiling using MSVC so we specify it manually.
|
|
|
|
# This should not affect any other platforms.
|
2008-08-22 13:33:59 +00:00
|
|
|
pdb_name = library_name + '.dll.pdb'
|
|
|
|
library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_pdb_name = preparser_library_name + '.dll.pdb';
|
2011-06-20 13:13:28 +00:00
|
|
|
preparser_soname = 'lib' + preparser_library_name + '.so';
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_library = env.SharedLibrary(preparser_library_name,
|
|
|
|
preparser_files,
|
2011-06-20 13:13:28 +00:00
|
|
|
PDB=preparser_pdb_name,
|
|
|
|
SONAME=preparser_soname)
|
2008-08-22 13:33:59 +00:00
|
|
|
context.library_targets.append(library)
|
2011-03-29 09:21:25 +00:00
|
|
|
context.library_targets.append(preparser_library)
|
2009-03-20 14:49:12 +00:00
|
|
|
|
2010-01-11 10:00:07 +00:00
|
|
|
context.ApplyEnvOverrides(d8_env)
|
2011-07-14 15:43:40 +00:00
|
|
|
if context.options['library'] == 'static':
|
|
|
|
shell = d8_env.Program('d8' + suffix, object_files + shell_files)
|
|
|
|
else:
|
|
|
|
shell = d8_env.Program('d8' + suffix, shell_files)
|
|
|
|
d8_env.Depends(shell, library)
|
2008-10-21 09:12:27 +00:00
|
|
|
context.d8_targets.append(shell)
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
for sample in context.samples:
|
2011-03-30 17:33:18 +00:00
|
|
|
sample_env = Environment(tools=tools)
|
2008-08-22 13:33:59 +00:00
|
|
|
sample_env.Replace(**context.flags['sample'])
|
2010-03-24 13:10:18 +00:00
|
|
|
sample_env.Prepend(LIBS=[library_name])
|
2008-09-08 15:42:29 +00:00
|
|
|
context.ApplyEnvOverrides(sample_env)
|
2008-08-22 13:33:59 +00:00
|
|
|
sample_object = sample_env.SConscript(
|
|
|
|
join('samples', 'SConscript'),
|
|
|
|
build_dir=join('obj', 'sample', sample, target_id),
|
2011-03-30 17:33:18 +00:00
|
|
|
exports='sample context tools',
|
2008-08-22 13:33:59 +00:00
|
|
|
duplicate=False
|
|
|
|
)
|
|
|
|
sample_name = sample + suffix
|
|
|
|
sample_program = sample_env.Program(sample_name, sample_object)
|
|
|
|
sample_env.Depends(sample_program, library)
|
|
|
|
context.sample_targets.append(sample_program)
|
2009-03-20 14:49:12 +00:00
|
|
|
|
2010-03-26 07:47:41 +00:00
|
|
|
cctest_env = env.Copy()
|
|
|
|
cctest_env.Prepend(LIBS=[library_name])
|
|
|
|
cctest_program = cctest_env.SConscript(
|
2008-08-22 13:33:59 +00:00
|
|
|
join('test', 'cctest', 'SConscript'),
|
|
|
|
build_dir=join('obj', 'test', target_id),
|
2011-03-30 17:33:18 +00:00
|
|
|
exports='context object_files tools',
|
2008-08-22 13:33:59 +00:00
|
|
|
duplicate=False
|
|
|
|
)
|
|
|
|
context.cctest_targets.append(cctest_program)
|
2009-03-20 14:49:12 +00:00
|
|
|
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_env = env.Copy()
|
|
|
|
preparser_env.Replace(**context.flags['preparser'])
|
|
|
|
preparser_env.Prepend(LIBS=[preparser_library_name])
|
|
|
|
context.ApplyEnvOverrides(preparser_env)
|
|
|
|
preparser_object = preparser_env.SConscript(
|
|
|
|
join('preparser', 'SConscript'),
|
|
|
|
build_dir=join('obj', 'preparser', target_id),
|
2011-07-06 12:36:05 +00:00
|
|
|
exports='context tools',
|
2011-03-29 09:21:25 +00:00
|
|
|
duplicate=False
|
|
|
|
)
|
2011-03-31 08:12:17 +00:00
|
|
|
preparser_name = join('obj', 'preparser', target_id, 'preparser')
|
2011-03-29 09:21:25 +00:00
|
|
|
preparser_program = preparser_env.Program(preparser_name, preparser_object);
|
|
|
|
preparser_env.Depends(preparser_program, preparser_library)
|
|
|
|
context.preparser_targets.append(preparser_program)
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
def Build():
|
|
|
|
opts = GetOptions()
|
2011-03-30 17:33:18 +00:00
|
|
|
tools = GetTools(opts)
|
|
|
|
env = Environment(options=opts, tools=tools)
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
Help(opts.GenerateHelpText(env))
|
|
|
|
VerifyOptions(env)
|
2009-04-02 13:00:28 +00:00
|
|
|
env_overrides = ParseEnvOverrides(env['env'], env['importenv'])
|
2008-10-21 09:12:27 +00:00
|
|
|
|
2008-09-08 13:08:10 +00:00
|
|
|
SourceSignatures(env['sourcesignatures'])
|
2008-10-21 09:12:27 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
libraries = []
|
2009-01-30 09:34:55 +00:00
|
|
|
mksnapshots = []
|
2008-08-22 13:33:59 +00:00
|
|
|
cctests = []
|
|
|
|
samples = []
|
2011-03-29 09:21:25 +00:00
|
|
|
preparsers = []
|
2008-10-21 09:12:27 +00:00
|
|
|
d8s = []
|
2008-08-22 13:33:59 +00:00
|
|
|
modes = SplitList(env['mode'])
|
|
|
|
for mode in modes:
|
2011-03-30 17:33:18 +00:00
|
|
|
context = BuildSpecific(env.Copy(), mode, env_overrides, tools)
|
2008-08-22 13:33:59 +00:00
|
|
|
libraries += context.library_targets
|
2009-01-30 09:34:55 +00:00
|
|
|
mksnapshots += context.mksnapshot_targets
|
2008-08-22 13:33:59 +00:00
|
|
|
cctests += context.cctest_targets
|
|
|
|
samples += context.sample_targets
|
2011-03-29 09:21:25 +00:00
|
|
|
preparsers += context.preparser_targets
|
2008-10-21 09:12:27 +00:00
|
|
|
d8s += context.d8_targets
|
2008-08-22 13:33:59 +00:00
|
|
|
|
|
|
|
env.Alias('library', libraries)
|
2009-01-30 09:34:55 +00:00
|
|
|
env.Alias('mksnapshot', mksnapshots)
|
2008-08-22 13:33:59 +00:00
|
|
|
env.Alias('cctests', cctests)
|
|
|
|
env.Alias('sample', samples)
|
2008-10-21 09:12:27 +00:00
|
|
|
env.Alias('d8', d8s)
|
2011-03-29 09:21:25 +00:00
|
|
|
env.Alias('preparser', preparsers)
|
2008-11-21 10:06:29 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
if env['sample']:
|
|
|
|
env.Default('sample')
|
2008-07-30 08:49:36 +00:00
|
|
|
else:
|
2008-08-22 13:33:59 +00:00
|
|
|
env.Default('library')
|
2008-07-30 08:49:36 +00:00
|
|
|
|
2010-06-11 11:19:27 +00:00
|
|
|
if env['cache']:
|
|
|
|
CacheDir(env['cache'])
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2008-09-01 09:34:14 +00:00
|
|
|
# We disable deprecation warnings because we need to be able to use
|
|
|
|
# env.Copy without getting warnings for compatibility with older
|
2008-09-01 12:00:32 +00:00
|
|
|
# version of scons. Also, there's a bug in some revisions that
|
|
|
|
# doesn't allow this flag to be set, so we swallow any exceptions.
|
|
|
|
# Lovely.
|
|
|
|
try:
|
|
|
|
SetOption('warn', 'no-deprecated')
|
|
|
|
except:
|
|
|
|
pass
|
2008-09-01 09:34:14 +00:00
|
|
|
|
|
|
|
|
2008-07-30 08:49:36 +00:00
|
|
|
Build()
|