2010-03-30 11:38:39 +00:00
|
|
|
# Copyright 2010 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
|
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)
|
|
|
|
sys.path.append(join(root_dir, 'tools'))
|
2008-09-02 15:20:38 +00:00
|
|
|
import js2c, utils
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-03-23 12:37:53 +00:00
|
|
|
# ANDROID_TOP is the top of the Android checkout, fetched from the environment
|
|
|
|
# variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB
|
|
|
|
# environment variables to the cross-compiling tools.
|
|
|
|
ANDROID_TOP = os.environ.get('TOP')
|
|
|
|
if ANDROID_TOP is None:
|
|
|
|
ANDROID_TOP=""
|
|
|
|
|
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
|
|
|
|
2010-04-14 07:49:30 +00:00
|
|
|
ANDROID_FLAGS = ['-march=armv7-a',
|
|
|
|
'-mtune=cortex-a8',
|
|
|
|
'-mfloat-abi=softfp',
|
|
|
|
'-mfpu=vfp',
|
2009-03-23 12:37:53 +00:00
|
|
|
'-fpic',
|
|
|
|
'-mthumb-interwork',
|
|
|
|
'-funwind-tables',
|
|
|
|
'-fstack-protector',
|
|
|
|
'-fno-short-enums',
|
|
|
|
'-fmessage-length=0',
|
|
|
|
'-finline-functions',
|
|
|
|
'-fno-inline-functions-called-once',
|
|
|
|
'-fgcse-after-reload',
|
|
|
|
'-frerun-cse-after-loop',
|
|
|
|
'-frename-registers',
|
|
|
|
'-fomit-frame-pointer',
|
|
|
|
'-finline-limit=64',
|
2010-04-14 07:49:30 +00:00
|
|
|
'-DCAN_USE_VFP_INSTRUCTIONS=1',
|
|
|
|
'-DCAN_USE_ARMV7_INSTRUCTIONS=1',
|
2010-05-06 12:49:12 +00:00
|
|
|
'-DCAN_USE_UNALIGNED_ACCESSES=1',
|
2009-03-23 12:37:53 +00:00
|
|
|
'-MD']
|
|
|
|
|
|
|
|
ANDROID_INCLUDES = [ANDROID_TOP + '/bionic/libc/arch-arm/include',
|
|
|
|
ANDROID_TOP + '/bionic/libc/include',
|
|
|
|
ANDROID_TOP + '/bionic/libstdc++/include',
|
|
|
|
ANDROID_TOP + '/bionic/libc/kernel/common',
|
|
|
|
ANDROID_TOP + '/bionic/libc/kernel/arch-arm',
|
|
|
|
ANDROID_TOP + '/bionic/libm/include',
|
|
|
|
ANDROID_TOP + '/bionic/libm/include/arch/arm',
|
2009-08-06 08:27:10 +00:00
|
|
|
ANDROID_TOP + '/bionic/libthread_db/include',
|
|
|
|
ANDROID_TOP + '/frameworks/base/include',
|
|
|
|
ANDROID_TOP + '/system/core/include']
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-03-24 14:29:49 +00:00
|
|
|
ANDROID_LINKFLAGS = ['-nostdlib',
|
|
|
|
'-Bdynamic',
|
|
|
|
'-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x',
|
|
|
|
'-Wl,-dynamic-linker,/system/bin/linker',
|
|
|
|
'-Wl,--gc-sections',
|
|
|
|
'-Wl,-z,nocopyreloc',
|
|
|
|
'-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/generic/obj/lib',
|
|
|
|
ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o',
|
2010-03-24 13:10:18 +00:00
|
|
|
ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a',
|
2009-03-24 14:29:49 +00:00
|
|
|
ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_android.o'];
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
LIBRARY_FLAGS = {
|
|
|
|
'all': {
|
2009-07-07 08:11:19 +00:00
|
|
|
'CPPPATH': [join(root_dir, 'src')],
|
2010-04-19 19:30:11 +00:00
|
|
|
'regexp:interpreted': {
|
|
|
|
'CPPDEFINES': ['V8_INTERPRETED_REGEXP']
|
2009-08-26 10:33:11 +00:00
|
|
|
},
|
|
|
|
'mode:debug': {
|
|
|
|
'CPPDEFINES': ['V8_ENABLE_CHECKS']
|
2009-09-11 12:26:15 +00:00
|
|
|
},
|
2010-04-08 13:37:39 +00:00
|
|
|
'vmstate:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING'],
|
|
|
|
},
|
|
|
|
'protectheap:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_HEAP_PROTECTION'],
|
|
|
|
},
|
2009-09-11 12:26:15 +00:00
|
|
|
'profilingsupport:on': {
|
2010-04-08 13:37:39 +00:00
|
|
|
'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_LOGGING_AND_PROFILING'],
|
2009-09-11 12:26:15 +00:00
|
|
|
},
|
|
|
|
'debuggersupport:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
|
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'],
|
2008-09-11 18:46:29 +00:00
|
|
|
'CXXFLAGS': ['$CCFLAGS', '-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']
|
|
|
|
},
|
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'],
|
|
|
|
'os:android': {
|
|
|
|
'CCFLAGS': ['-mthumb']
|
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'mode:release': {
|
2009-03-23 12:37:53 +00:00
|
|
|
'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections',
|
|
|
|
'-ffunction-sections'],
|
|
|
|
'os:android': {
|
2009-03-31 13:24:59 +00:00
|
|
|
'CCFLAGS': ['-mthumb', '-Os'],
|
2009-09-11 12:26:15 +00:00
|
|
|
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
|
2009-03-23 12:37:53 +00:00
|
|
|
}
|
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': {
|
2009-06-08 08:51:35 +00:00
|
|
|
'CPPPATH' : ['/usr/local/include'],
|
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
2009-02-09 15:06:07 +00:00
|
|
|
'CCFLAGS': ['-ansi'],
|
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
|
|
|
'CPPPATH' : ['/usr/local/include'],
|
|
|
|
'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__'],
|
2010-01-25 12:37:31 +00:00
|
|
|
'CPPPATH' : ['/usr/local/include'],
|
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'CCFLAGS': ['-ansi'],
|
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:win32': {
|
|
|
|
'CCFLAGS': ['-DWIN32'],
|
|
|
|
'CXXFLAGS': ['-DWIN32'],
|
2008-11-21 10:06:29 +00:00
|
|
|
},
|
2009-03-23 12:37:53 +00:00
|
|
|
'os:android': {
|
|
|
|
'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
|
|
|
|
'__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
|
|
|
|
'CCFLAGS': ANDROID_FLAGS,
|
|
|
|
'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type',
|
|
|
|
'-Wstrict-aliasing=2'],
|
|
|
|
'CPPPATH': ANDROID_INCLUDES,
|
|
|
|
},
|
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']
|
|
|
|
}
|
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'],
|
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-EL', '-mips32r2', '-Wa,-mips32r2', '-fno-inline'],
|
|
|
|
'LDFLAGS': ['-EL']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'simulator:mips': {
|
|
|
|
'CCFLAGS': ['-m32'],
|
2010-10-14 11:39:48 +00:00
|
|
|
'LINKFLAGS': ['-m32'],
|
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
|
|
|
},
|
2009-03-05 10:53:08 +00:00
|
|
|
'prof:oprofile': {
|
|
|
|
'CPPDEFINES': ['ENABLE_OPROFILE_AGENT']
|
2008-09-05 12:21:04 +00:00
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
|
|
|
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
|
2008-09-01 10:16:00 +00:00
|
|
|
'CXXFLAGS': ['$CCFLAGS', '/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',
|
|
|
|
'-Wnon-virtual-dtor']
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
2009-02-09 15:06:07 +00:00
|
|
|
'os:win32': {
|
2009-03-23 12:37:53 +00:00
|
|
|
'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
|
|
|
|
},
|
|
|
|
'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
|
|
|
},
|
2008-09-05 12:21:04 +00:00
|
|
|
'disassembler:on': {
|
|
|
|
'CPPDEFINES': ['ENABLE_DISASSEMBLER']
|
|
|
|
}
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'msvc': {
|
|
|
|
'all': {
|
2010-01-27 16:18:58 +00:00
|
|
|
'WARNINGFLAGS': ['/W3', '/WX', '/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'],
|
|
|
|
},
|
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
|
|
|
},
|
|
|
|
},
|
|
|
|
'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': {
|
|
|
|
'CPPPATH': [join(root_dir, 'src')],
|
|
|
|
},
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
|
|
|
'LIBPATH': [abspath('.')]
|
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'],
|
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
|
|
|
},
|
2009-04-27 10:52:44 +00:00
|
|
|
'os:android': {
|
|
|
|
'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
|
|
|
|
'__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
|
|
|
|
'CCFLAGS': ANDROID_FLAGS,
|
|
|
|
'CPPPATH': ANDROID_INCLUDES,
|
2010-03-24 13:10:18 +00:00
|
|
|
'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib',
|
|
|
|
ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork'],
|
2009-04-27 10:52:44 +00:00
|
|
|
'LINKFLAGS': ANDROID_LINKFLAGS,
|
2010-03-24 13:10:18 +00:00
|
|
|
'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'],
|
2009-04-27 10:52:44 +00:00
|
|
|
'mode:release': {
|
|
|
|
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
|
|
|
|
}
|
|
|
|
},
|
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
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['USING_V8_SHARED']
|
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'],
|
|
|
|
'LINKFLAGS': ['/STACK:2091752']
|
2009-08-27 13:12:28 +00:00
|
|
|
},
|
2008-08-22 13:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE_FLAGS = {
|
|
|
|
'all': {
|
2008-09-01 11:48:50 +00:00
|
|
|
'CPPPATH': [join(abspath('.'), 'include')],
|
2008-08-22 13:33:59 +00:00
|
|
|
},
|
|
|
|
'gcc': {
|
|
|
|
'all': {
|
2009-03-23 12:37:53 +00:00
|
|
|
'LIBPATH': ['.'],
|
|
|
|
'CCFLAGS': ['-fno-rtti', '-fno-exceptions']
|
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': {
|
2009-06-08 08:51:35 +00:00
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
2009-12-02 13:38:50 +00:00
|
|
|
'LIBS': ['execinfo', 'pthread']
|
|
|
|
},
|
2010-01-25 12:37:31 +00:00
|
|
|
'os:solaris': {
|
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
|
|
|
|
'LINKFLAGS': ['-mt']
|
|
|
|
},
|
2009-12-02 13:38:50 +00:00
|
|
|
'os:openbsd': {
|
|
|
|
'LIBPATH' : ['/usr/local/lib'],
|
|
|
|
'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']
|
2008-11-21 10:06:29 +00:00
|
|
|
},
|
2009-03-23 12:37:53 +00:00
|
|
|
'os:android': {
|
|
|
|
'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
|
|
|
|
'__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
|
|
|
|
'CCFLAGS': ANDROID_FLAGS,
|
|
|
|
'CPPPATH': ANDROID_INCLUDES,
|
2010-03-24 13:10:18 +00:00
|
|
|
'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib',
|
|
|
|
ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork'],
|
2009-03-24 14:29:49 +00:00
|
|
|
'LINKFLAGS': ANDROID_LINKFLAGS,
|
2010-03-24 13:10:18 +00:00
|
|
|
'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'],
|
2009-03-23 12:37:53 +00:00
|
|
|
'mode:release': {
|
|
|
|
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
|
|
|
|
}
|
|
|
|
},
|
2010-04-16 11:47:23 +00:00
|
|
|
'arch:arm': {
|
|
|
|
'LINKFLAGS': ARM_LINK_FLAGS
|
|
|
|
},
|
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'],
|
|
|
|
'simulator:none': {
|
|
|
|
'CCFLAGS': ['-EL', '-mips32r2', '-Wa,-mips32r2', '-fno-inline'],
|
|
|
|
'LINKFLAGS': ['-EL'],
|
|
|
|
'LDFLAGS': ['-EL']
|
|
|
|
}
|
|
|
|
},
|
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'],
|
|
|
|
'LINKFLAGS': ['-m32']
|
|
|
|
},
|
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
|
|
|
},
|
|
|
|
'prof:oprofile': {
|
|
|
|
'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'],
|
|
|
|
'LIBS': ['opagent']
|
2008-09-09 19:08:40 +00:00
|
|
|
}
|
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-08-22 13:33:59 +00:00
|
|
|
'library:shared': {
|
|
|
|
'CPPDEFINES': ['USING_V8_SHARED']
|
|
|
|
},
|
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': {
|
2009-08-27 13:12:28 +00:00
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_IA32'],
|
|
|
|
'LINKFLAGS': ['/MACHINE:X86']
|
|
|
|
},
|
|
|
|
'arch:x64': {
|
|
|
|
'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
|
2009-10-13 10:56:13 +00:00
|
|
|
'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752']
|
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 = {
|
|
|
|
'gcc': {
|
|
|
|
'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-03-24 14:29:49 +00:00
|
|
|
'os:android': {
|
2010-03-24 13:10:18 +00:00
|
|
|
'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib',
|
|
|
|
ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/interwork'],
|
2009-03-24 14:29:49 +00:00
|
|
|
'LINKFLAGS': ANDROID_LINKFLAGS,
|
2010-03-24 13:10:18 +00:00
|
|
|
'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'],
|
2009-03-24 14:29:49 +00:00
|
|
|
},
|
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
|
|
|
},
|
2010-07-22 12:57:48 +00:00
|
|
|
'arch:arm': {
|
|
|
|
'LINKFLAGS': ARM_LINK_FLAGS
|
|
|
|
},
|
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']
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
def GuessToolchain(os):
|
|
|
|
tools = Environment()['TOOLS']
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2010-12-02 15:37:45 +00:00
|
|
|
def GuessVisibility(os, toolchain):
|
|
|
|
if os == 'win32' and toolchain == 'gcc':
|
|
|
|
# MinGW can't do it.
|
|
|
|
return 'default'
|
|
|
|
else:
|
|
|
|
return 'hidden'
|
|
|
|
|
|
|
|
|
2008-10-31 13:12:35 +00:00
|
|
|
OS_GUESS = utils.GuessOS()
|
2008-08-27 10:11:39 +00:00
|
|
|
TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
|
2008-09-02 15:20:38 +00:00
|
|
|
ARCH_GUESS = utils.GuessArchitecture()
|
2010-12-02 15:37:45 +00:00
|
|
|
VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS)
|
2008-08-27 10:11:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
SIMPLE_OPTIONS = {
|
|
|
|
'toolchain': {
|
|
|
|
'values': ['gcc', 'msvc'],
|
|
|
|
'default': TOOLCHAIN_GUESS,
|
2010-10-18 14:39:59 +00:00
|
|
|
'help': 'the toolchain to use (%s)' % TOOLCHAIN_GUESS
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
|
|
|
'os': {
|
2010-01-25 12:37:31 +00:00
|
|
|
'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'solaris'],
|
2008-08-27 10:11:39 +00:00
|
|
|
'default': OS_GUESS,
|
2010-10-18 14:39:59 +00:00
|
|
|
'help': 'the os to build for (%s)' % OS_GUESS
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
|
|
|
'arch': {
|
2010-02-04 20:36:58 +00:00
|
|
|
'values':['arm', 'ia32', 'x64', 'mips'],
|
2008-08-27 10:11:39 +00:00
|
|
|
'default': ARCH_GUESS,
|
2010-10-18 14:39:59 +00:00
|
|
|
'help': 'the architecture to build for (%s)' % ARCH_GUESS
|
2008-08-27 10:11:39 +00:00
|
|
|
},
|
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': {
|
2009-03-05 10:53:08 +00:00
|
|
|
'values': ['on', 'off', 'oprofile'],
|
2008-09-24 08:47:39 +00:00
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable profiling of build target'
|
|
|
|
},
|
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-04-08 13:37:39 +00:00
|
|
|
'vmstate': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable VM state tracking'
|
|
|
|
},
|
|
|
|
'protectheap': {
|
|
|
|
'values': ['on', 'off'],
|
|
|
|
'default': 'off',
|
|
|
|
'help': 'enable heap protection'
|
|
|
|
},
|
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'
|
|
|
|
},
|
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
|
|
|
},
|
|
|
|
'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'],
|
2010-12-02 15:37:45 +00:00
|
|
|
'default': VISIBILITY_GUESS,
|
|
|
|
'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS
|
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',
|
2008-08-27 10:11:39 +00:00
|
|
|
}
|
|
|
|
}
|
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,...)', '')
|
2008-09-22 15:50:30 +00:00
|
|
|
for (name, option) in SIMPLE_OPTIONS.iteritems():
|
2008-08-27 10:11:39 +00:00
|
|
|
help = '%s (%s)' % (name, ", ".join(option['values']))
|
|
|
|
result.Add(name, help, option.get('default'))
|
2008-07-03 15:10:15 +00:00
|
|
|
return result
|
|
|
|
|
|
|
|
|
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.")
|
2009-03-05 10:53:08 +00:00
|
|
|
if env['prof'] == 'oprofile' and env['os'] != 'linux':
|
|
|
|
Abort("OProfile is only supported on Linux.")
|
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.")
|
2008-09-22 15:50:30 +00:00
|
|
|
for (name, option) in SIMPLE_OPTIONS.iteritems():
|
2008-08-27 10:11:39 +00:00
|
|
|
if (not option.get('default')) and (name not in ARGUMENTS):
|
|
|
|
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
|
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'
|
2010-02-04 20:36:58 +00:00
|
|
|
if options['arch'] == 'mips':
|
|
|
|
if ('regexp' in ARGUMENTS) and options['regexp'] == 'native':
|
|
|
|
# Print a warning if native regexp is specified for mips
|
|
|
|
print "Warning: forcing regexp to interpreted for mips"
|
|
|
|
options['regexp'] = 'interpreted'
|
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
|
|
|
|
|
|
|
|
|
|
|
|
def BuildSpecific(env, mode, env_overrides):
|
2008-08-27 10:11:39 +00:00
|
|
|
options = {'mode': mode}
|
|
|
|
for option in SIMPLE_OPTIONS:
|
|
|
|
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)
|
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,
|
|
|
|
'd8': d8_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
|
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.
|
2009-01-30 09:34:55 +00:00
|
|
|
(object_files, shell_files, mksnapshot) = 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),
|
|
|
|
exports='context',
|
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)
|
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)
|
|
|
|
context.library_targets.append(library)
|
2009-03-20 14:49:12 +00:00
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
d8_env = Environment()
|
|
|
|
d8_env.Replace(**context.flags['d8'])
|
2010-01-11 10:00:07 +00:00
|
|
|
context.ApplyEnvOverrides(d8_env)
|
2008-10-21 09:12:27 +00:00
|
|
|
shell = d8_env.Program('d8' + suffix, object_files + shell_files)
|
|
|
|
context.d8_targets.append(shell)
|
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
for sample in context.samples:
|
2010-03-24 13:10:18 +00:00
|
|
|
sample_env = Environment()
|
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),
|
|
|
|
exports='sample context',
|
|
|
|
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),
|
|
|
|
exports='context object_files',
|
|
|
|
duplicate=False
|
|
|
|
)
|
|
|
|
context.cctest_targets.append(cctest_program)
|
2009-03-20 14:49:12 +00:00
|
|
|
|
2008-08-22 13:33:59 +00:00
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
def Build():
|
|
|
|
opts = GetOptions()
|
|
|
|
env = Environment(options=opts)
|
|
|
|
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 = []
|
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:
|
2008-09-02 09:05:53 +00:00
|
|
|
context = BuildSpecific(env.Copy(), mode, env_overrides)
|
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
|
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)
|
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()
|