wok rev 16509

mpg123: up to (1.19.0) with better ARM support
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 24 18:16:37 2014 +0200 (2014-04-24)
parents 9f3a7907cf0c
children cbb88e362894
files mpg123-dev/receipt mpg123/receipt node/receipt node/stuff/SConstruct node/stuff/SConstruct.patch
line diff
     1.1 --- a/mpg123-dev/receipt	Thu Apr 24 15:10:41 2014 +0000
     1.2 +++ b/mpg123-dev/receipt	Thu Apr 24 18:16:37 2014 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="mpg123-dev"
     1.7 -VERSION="1.18.1"
     1.8 +VERSION="1.19.0"
     1.9  CATEGORY="development"
    1.10  SHORT_DESC="mpg123 development files"
    1.11  MAINTAINER="devl547@gmail.com"
     2.1 --- a/mpg123/receipt	Thu Apr 24 15:10:41 2014 +0000
     2.2 +++ b/mpg123/receipt	Thu Apr 24 18:16:37 2014 +0200
     2.3 @@ -1,7 +1,7 @@
     2.4  # SliTaz package receipt.
     2.5  
     2.6  PACKAGE="mpg123"
     2.7 -VERSION="1.18.1"
     2.8 +VERSION="1.19.0"
     2.9  CATEGORY="multimedia"
    2.10  SHORT_DESC="Command line audio player and streamer"
    2.11  MAINTAINER="pankso@slitaz.org"
    2.12 @@ -25,9 +25,8 @@
    2.13  {
    2.14  	./configure \
    2.15  		--with-default-audio=alsa \
    2.16 -		--with-audio="alsa" \
    2.17  		$CONFIGURE_ARGS ${ARCH_ARGS} &&
    2.18 -	make && make install
    2.19 +	make CFLAGS="-I/cross/arm/sysroot/usr/include" && make install
    2.20  }
    2.21  
    2.22  # Rules to gen a SliTaz package suitable for Tazpkg.
     3.1 --- a/node/receipt	Thu Apr 24 15:10:41 2014 +0000
     3.2 +++ b/node/receipt	Thu Apr 24 18:16:37 2014 +0200
     3.3 @@ -9,6 +9,7 @@
     3.4  TARBALL="$PACKAGE-v$VERSION.tar.gz"
     3.5  WEB_SITE="http://nodejs.org/"
     3.6  WGET_URL="http://nodejs.org/dist/v$VERSION/$TARBALL"
     3.7 +#HOST_ARCH="i486 arm"
     3.8  
     3.9  DEPENDS="python libssl"
    3.10  BUILD_DEPENDS="python-dev openssl-dev"
    3.11 @@ -16,7 +17,7 @@
    3.12  # Rules to configure and make the package.
    3.13  compile_rules()
    3.14  {
    3.15 -	cd $src
    3.16 +	#patch -p0 < ${stuff}/SConstruct.patch || return 1
    3.17  	./configure --prefix=/usr &&
    3.18  	make && make install
    3.19  }
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/node/stuff/SConstruct	Thu Apr 24 18:16:37 2014 +0200
     4.3 @@ -0,0 +1,1636 @@
     4.4 +# Copyright 2012 the V8 project authors. All rights reserved.
     4.5 +# Redistribution and use in source and binary forms, with or without
     4.6 +# modification, are permitted provided that the following conditions are
     4.7 +# met:
     4.8 +#
     4.9 +#     * Redistributions of source code must retain the above copyright
    4.10 +#       notice, this list of conditions and the following disclaimer.
    4.11 +#     * Redistributions in binary form must reproduce the above
    4.12 +#       copyright notice, this list of conditions and the following
    4.13 +#       disclaimer in the documentation and/or other materials provided
    4.14 +#       with the distribution.
    4.15 +#     * Neither the name of Google Inc. nor the names of its
    4.16 +#       contributors may be used to endorse or promote products derived
    4.17 +#       from this software without specific prior written permission.
    4.18 +#
    4.19 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    4.20 +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    4.21 +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    4.22 +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    4.23 +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    4.24 +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    4.25 +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    4.26 +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    4.27 +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    4.28 +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    4.29 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    4.30 +
    4.31 +import platform
    4.32 +import re
    4.33 +import subprocess
    4.34 +import sys
    4.35 +import os
    4.36 +from os.path import join, dirname, abspath
    4.37 +from types import DictType, StringTypes
    4.38 +root_dir = dirname(File('SConstruct').rfile().abspath)
    4.39 +src_dir = join(root_dir, 'src')
    4.40 +sys.path.insert(0, join(root_dir, 'tools'))
    4.41 +import js2c, utils
    4.42 +
    4.43 +# ARM_TARGET_LIB is the path to the dynamic library to use on the target
    4.44 +# machine if cross-compiling to an arm machine. You will also need to set
    4.45 +# the additional cross-compiling environment variables to the cross compiler.
    4.46 +ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB')
    4.47 +if ARM_TARGET_LIB:
    4.48 +  ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' +
    4.49 +                     ARM_TARGET_LIB + '/usr/lib',
    4.50 +                    '-Wl,--dynamic-linker=' + ARM_TARGET_LIB +
    4.51 +                    '/lib/ld-linux.so.3']
    4.52 +else:
    4.53 +  ARM_LINK_FLAGS = []
    4.54 +
    4.55 +GCC_EXTRA_CCFLAGS = []
    4.56 +GCC_DTOA_EXTRA_CCFLAGS = []
    4.57 +
    4.58 +LIBRARY_FLAGS = {
    4.59 +  'all': {
    4.60 +    'CPPPATH': [src_dir],
    4.61 +    'regexp:interpreted': {
    4.62 +      'CPPDEFINES': ['V8_INTERPRETED_REGEXP']
    4.63 +    },
    4.64 +    'mode:debug': {
    4.65 +      'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT', 'VERIFY_HEAP']
    4.66 +    },
    4.67 +    'objectprint:on': {
    4.68 +      'CPPDEFINES':   ['OBJECT_PRINT'],
    4.69 +    },
    4.70 +    'debuggersupport:on': {
    4.71 +      'CPPDEFINES':   ['ENABLE_DEBUGGER_SUPPORT'],
    4.72 +    },
    4.73 +    'inspector:on': {
    4.74 +      'CPPDEFINES':   ['INSPECTOR'],
    4.75 +    },
    4.76 +    'fasttls:off': {
    4.77 +      'CPPDEFINES':   ['V8_NO_FAST_TLS'],
    4.78 +    },
    4.79 +    'liveobjectlist:on': {
    4.80 +      'CPPDEFINES':   ['ENABLE_DEBUGGER_SUPPORT', 'INSPECTOR',
    4.81 +                       'LIVE_OBJECT_LIST', 'OBJECT_PRINT'],
    4.82 +    }
    4.83 +  },
    4.84 +  'gcc': {
    4.85 +    'all': {
    4.86 +      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv6'],
    4.87 +      'CXXFLAGS':     ['-fno-rtti', '-fno-exceptions', '-march=armv6'],
    4.88 +    },
    4.89 +    'visibility:hidden': {
    4.90 +      # Use visibility=default to disable this.
    4.91 +      'CXXFLAGS':     ['-fvisibility=hidden']
    4.92 +    },
    4.93 +    'strictaliasing:off': {
    4.94 +      'CCFLAGS':      ['-fno-strict-aliasing']
    4.95 +    },
    4.96 +    'mode:debug': {
    4.97 +      'CCFLAGS':      ['-g', '-O0'],
    4.98 +      'CPPDEFINES':   ['ENABLE_DISASSEMBLER', 'DEBUG'],
    4.99 +    },
   4.100 +    'mode:release': {
   4.101 +      'CCFLAGS':      ['-O3', '-fomit-frame-pointer', '-fdata-sections',
   4.102 +                       '-ffunction-sections'],
   4.103 +    },
   4.104 +    'os:linux': {
   4.105 +      'CCFLAGS':      ['-ansi'] + GCC_EXTRA_CCFLAGS,
   4.106 +      'library:shared': {
   4.107 +        'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'],
   4.108 +        'LIBS': ['pthread']
   4.109 +      }
   4.110 +    },
   4.111 +    'os:macos': {
   4.112 +      'CCFLAGS':      ['-ansi', '-mmacosx-version-min=10.4'],
   4.113 +      'library:shared': {
   4.114 +        'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'],
   4.115 +      }
   4.116 +    },
   4.117 +    'os:freebsd': {
   4.118 +      'CPPPATH' : [src_dir, '/usr/local/include'],
   4.119 +      'LIBPATH' : ['/usr/local/lib'],
   4.120 +      'CCFLAGS':      ['-ansi'],
   4.121 +      'LIBS': ['execinfo']
   4.122 +    },
   4.123 +    'os:openbsd': {
   4.124 +      'CPPPATH' : [src_dir, '/usr/local/include'],
   4.125 +      'LIBPATH' : ['/usr/local/lib'],
   4.126 +      'CCFLAGS':      ['-ansi'],
   4.127 +    },
   4.128 +    'os:solaris': {
   4.129 +      # On Solaris, to get isinf, INFINITY, fpclassify and other macros one
   4.130 +      # needs to define __C99FEATURES__.
   4.131 +      'CPPDEFINES': ['__C99FEATURES__'],
   4.132 +      'CPPPATH' : [src_dir, '/usr/local/include'],
   4.133 +      'LIBPATH' : ['/usr/local/lib'],
   4.134 +      'CCFLAGS':      ['-ansi'],
   4.135 +    },
   4.136 +    'os:netbsd': {
   4.137 +      'CPPPATH' : [src_dir, '/usr/pkg/include'],
   4.138 +      'LIBPATH' : ['/usr/pkg/lib'],
   4.139 +    },
   4.140 +    'os:win32': {
   4.141 +      'CCFLAGS':      ['-DWIN32'],
   4.142 +      'CXXFLAGS':     ['-DWIN32'],
   4.143 +    },
   4.144 +    'arch:ia32': {
   4.145 +      'CPPDEFINES':   ['V8_TARGET_ARCH_IA32'],
   4.146 +      'CCFLAGS':      ['-m32'],
   4.147 +      'LINKFLAGS':    ['-m32']
   4.148 +    },
   4.149 +    'arch:arm': {
   4.150 +      'CPPDEFINES':   ['V8_TARGET_ARCH_ARM'],
   4.151 +      'unalignedaccesses:on' : {
   4.152 +        'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1']
   4.153 +      },
   4.154 +      'unalignedaccesses:off' : {
   4.155 +        'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0']
   4.156 +      },
   4.157 +      'armeabi:soft' : {
   4.158 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
   4.159 +        'simulator:none': {
   4.160 +          'CCFLAGS':     ['-mfloat-abi=soft'],
   4.161 +        }
   4.162 +      },
   4.163 +      'armeabi:softfp' : {
   4.164 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
   4.165 +        'vfp3:on': {
   4.166 +          'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
   4.167 +        },
   4.168 +        'simulator:none': {
   4.169 +          'CCFLAGS':     ['-mfloat-abi=softfp'],
   4.170 +        }
   4.171 +      },
   4.172 +      'armeabi:hard' : {
   4.173 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'],
   4.174 +        'vfp3:on': {
   4.175 +          'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
   4.176 +        },
   4.177 +        'simulator:none': {
   4.178 +          'CCFLAGS':     ['-mfloat-abi=hard'],
   4.179 +        }
   4.180 +      }
   4.181 +    },
   4.182 +    'simulator:arm': {
   4.183 +      'CCFLAGS':      ['-m32'],
   4.184 +      'LINKFLAGS':    ['-m32'],
   4.185 +    },
   4.186 +    'arch:mips': {
   4.187 +      'CPPDEFINES':   ['V8_TARGET_ARCH_MIPS'],
   4.188 +      'mips_arch_variant:mips32r2': {
   4.189 +        'CPPDEFINES':    ['_MIPS_ARCH_MIPS32R2']
   4.190 +      },
   4.191 +      'mips_arch_variant:loongson': {
   4.192 +        'CPPDEFINES':    ['_MIPS_ARCH_LOONGSON']
   4.193 +      },
   4.194 +      'simulator:none': {
   4.195 +        'CCFLAGS':      ['-EL'],
   4.196 +        'LINKFLAGS':    ['-EL'],
   4.197 +        'mips_arch_variant:mips32r2': {
   4.198 +          'CCFLAGS':      ['-mips32r2', '-Wa,-mips32r2']
   4.199 +        },
   4.200 +        'mips_arch_variant:mips32r1': {
   4.201 +          'CCFLAGS':      ['-mips32', '-Wa,-mips32']
   4.202 +        },
   4.203 +        'mips_arch_variant:loongson': {
   4.204 +          'CCFLAGS':      ['-march=mips3', '-Wa,-march=mips3']
   4.205 +        },
   4.206 +        'library:static': {
   4.207 +          'LINKFLAGS':    ['-static', '-static-libgcc']
   4.208 +        },
   4.209 +        'mipsabi:softfloat': {
   4.210 +          'CCFLAGS':      ['-msoft-float'],
   4.211 +          'LINKFLAGS':    ['-msoft-float']
   4.212 +        },
   4.213 +        'mipsabi:hardfloat': {
   4.214 +          'CCFLAGS':      ['-mhard-float'],
   4.215 +          'LINKFLAGS':    ['-mhard-float']
   4.216 +        }
   4.217 +      }
   4.218 +    },
   4.219 +    'simulator:mips': {
   4.220 +      'CCFLAGS':      ['-m32'],
   4.221 +      'LINKFLAGS':    ['-m32'],
   4.222 +      'mipsabi:softfloat': {
   4.223 +        'CPPDEFINES':    ['__mips_soft_float=1'],
   4.224 +        'fpu:on': {
   4.225 +          'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS']
   4.226 +        }
   4.227 +      },
   4.228 +      'mipsabi:hardfloat': {
   4.229 +        'CPPDEFINES':    ['__mips_hard_float=1', 'CAN_USE_FPU_INSTRUCTIONS'],
   4.230 +      }
   4.231 +    },
   4.232 +    'arch:x64': {
   4.233 +      'CPPDEFINES':   ['V8_TARGET_ARCH_X64'],
   4.234 +      'CCFLAGS':      ['-m64'],
   4.235 +      'LINKFLAGS':    ['-m64'],
   4.236 +    },
   4.237 +    'gdbjit:on': {
   4.238 +      'CPPDEFINES':   ['ENABLE_GDB_JIT_INTERFACE']
   4.239 +    },
   4.240 +    'compress_startup_data:bz2': {
   4.241 +      'CPPDEFINES':   ['COMPRESS_STARTUP_DATA_BZ2']
   4.242 +    }
   4.243 +  },
   4.244 +  'msvc': {
   4.245 +    'all': {
   4.246 +      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS'],
   4.247 +      'CXXFLAGS':     ['/GR-', '/Gy'],
   4.248 +      'CPPDEFINES':   ['WIN32'],
   4.249 +      'LINKFLAGS':    ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'],
   4.250 +      'CCPDBFLAGS':   ['/Zi']
   4.251 +    },
   4.252 +    'verbose:off': {
   4.253 +      'DIALECTFLAGS': ['/nologo'],
   4.254 +      'ARFLAGS':      ['/NOLOGO']
   4.255 +    },
   4.256 +    'arch:ia32': {
   4.257 +      'CPPDEFINES':   ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'],
   4.258 +      'LINKFLAGS':    ['/MACHINE:X86'],
   4.259 +      'ARFLAGS':      ['/MACHINE:X86']
   4.260 +    },
   4.261 +    'arch:x64': {
   4.262 +      'CPPDEFINES':   ['V8_TARGET_ARCH_X64'],
   4.263 +      'LINKFLAGS':    ['/MACHINE:X64'],
   4.264 +      'ARFLAGS':      ['/MACHINE:X64']
   4.265 +    },
   4.266 +    'mode:debug': {
   4.267 +      'CCFLAGS':      ['/Od', '/Gm'],
   4.268 +      'CPPDEFINES':   ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'],
   4.269 +      'LINKFLAGS':    ['/DEBUG'],
   4.270 +      'msvcrt:static': {
   4.271 +        'CCFLAGS': ['/MTd']
   4.272 +      },
   4.273 +      'msvcrt:shared': {
   4.274 +        'CCFLAGS': ['/MDd']
   4.275 +      }
   4.276 +    },
   4.277 +    'mode:release': {
   4.278 +      'CCFLAGS':      ['/O2'],
   4.279 +      'LINKFLAGS':    ['/OPT:REF', '/OPT:ICF'],
   4.280 +      'msvcrt:static': {
   4.281 +        'CCFLAGS': ['/MT']
   4.282 +      },
   4.283 +      'msvcrt:shared': {
   4.284 +        'CCFLAGS': ['/MD']
   4.285 +      },
   4.286 +      'msvcltcg:on': {
   4.287 +        'CCFLAGS':      ['/GL'],
   4.288 +        'ARFLAGS':      ['/LTCG'],
   4.289 +        'pgo:off': {
   4.290 +          'LINKFLAGS':    ['/LTCG'],
   4.291 +        },
   4.292 +        'pgo:instrument': {
   4.293 +          'LINKFLAGS':    ['/LTCG:PGI']
   4.294 +        },
   4.295 +        'pgo:optimize': {
   4.296 +          'LINKFLAGS':    ['/LTCG:PGO']
   4.297 +        }
   4.298 +      }
   4.299 +    }
   4.300 +  }
   4.301 +}
   4.302 +
   4.303 +
   4.304 +V8_EXTRA_FLAGS = {
   4.305 +  'gcc': {
   4.306 +    'all': {
   4.307 +      'WARNINGFLAGS': ['-Wall',
   4.308 +                       '-Werror',
   4.309 +                       '-W',
   4.310 +                       '-Wno-unused-parameter',
   4.311 +                       '-Woverloaded-virtual',
   4.312 +                       '-Wnon-virtual-dtor']
   4.313 +    },
   4.314 +    'os:win32': {
   4.315 +      'WARNINGFLAGS': ['-pedantic',
   4.316 +                       '-Wno-long-long',
   4.317 +                       '-Wno-pedantic-ms-format'],
   4.318 +      'library:shared': {
   4.319 +        'LIBS': ['winmm', 'ws2_32']
   4.320 +      }
   4.321 +    },
   4.322 +    'os:linux': {
   4.323 +      'WARNINGFLAGS': ['-pedantic'],
   4.324 +      'library:shared': {
   4.325 +        'soname:on': {
   4.326 +          'LINKFLAGS': ['-Wl,-soname,${SONAME}']
   4.327 +        }
   4.328 +      }
   4.329 +    },
   4.330 +    'os:macos': {
   4.331 +      'WARNINGFLAGS': ['-pedantic']
   4.332 +    },
   4.333 +    'arch:arm': {
   4.334 +      # This is to silence warnings about ABI changes that some versions of the
   4.335 +      # CodeSourcery G++ tool chain produce for each occurrence of varargs.
   4.336 +      'WARNINGFLAGS': ['-Wno-abi']
   4.337 +    },
   4.338 +    'disassembler:on': {
   4.339 +      'CPPDEFINES':   ['ENABLE_DISASSEMBLER']
   4.340 +    }
   4.341 +  },
   4.342 +  'msvc': {
   4.343 +    'all': {
   4.344 +      'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800']
   4.345 +    },
   4.346 +    'library:shared': {
   4.347 +      'CPPDEFINES': ['BUILDING_V8_SHARED'],
   4.348 +      'LIBS': ['winmm', 'ws2_32']
   4.349 +    },
   4.350 +    'arch:arm': {
   4.351 +      'CPPDEFINES':   ['V8_TARGET_ARCH_ARM'],
   4.352 +      # /wd4996 is to silence the warning about sscanf
   4.353 +      # used by the arm simulator.
   4.354 +      'WARNINGFLAGS': ['/wd4996']
   4.355 +    },
   4.356 +    'arch:mips': {
   4.357 +      'CPPDEFINES':   ['V8_TARGET_ARCH_MIPS'],
   4.358 +      'mips_arch_variant:mips32r2': {
   4.359 +        'CPPDEFINES':    ['_MIPS_ARCH_MIPS32R2']
   4.360 +      },
   4.361 +    },
   4.362 +    'disassembler:on': {
   4.363 +      'CPPDEFINES':   ['ENABLE_DISASSEMBLER']
   4.364 +    }
   4.365 +  }
   4.366 +}
   4.367 +
   4.368 +
   4.369 +MKSNAPSHOT_EXTRA_FLAGS = {
   4.370 +  'gcc': {
   4.371 +    'os:linux': {
   4.372 +      'LIBS': ['pthread'],
   4.373 +    },
   4.374 +    'os:macos': {
   4.375 +      'LIBS': ['pthread'],
   4.376 +    },
   4.377 +    'os:freebsd': {
   4.378 +      'LIBS': ['execinfo', 'pthread']
   4.379 +    },
   4.380 +    'os:solaris': {
   4.381 +      'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
   4.382 +      'LINKFLAGS': ['-mt']
   4.383 +    },
   4.384 +    'os:openbsd': {
   4.385 +      'LIBS': ['execinfo', 'pthread']
   4.386 +    },
   4.387 +    'os:win32': {
   4.388 +      'LIBS': ['winmm', 'ws2_32'],
   4.389 +    },
   4.390 +    'os:netbsd': {
   4.391 +      'LIBS': ['execinfo', 'pthread']
   4.392 +    },
   4.393 +    'compress_startup_data:bz2': {
   4.394 +      'os:linux': {
   4.395 +        'LIBS': ['bz2']
   4.396 +      }
   4.397 +    },
   4.398 +  },
   4.399 +  'msvc': {
   4.400 +    'all': {
   4.401 +      'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
   4.402 +      'LIBS': ['winmm', 'ws2_32']
   4.403 +    }
   4.404 +  }
   4.405 +}
   4.406 +
   4.407 +
   4.408 +DTOA_EXTRA_FLAGS = {
   4.409 +  'gcc': {
   4.410 +    'all': {
   4.411 +      'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'],
   4.412 +      'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS
   4.413 +    }
   4.414 +  },
   4.415 +  'msvc': {
   4.416 +    'all': {
   4.417 +      'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244']
   4.418 +    }
   4.419 +  }
   4.420 +}
   4.421 +
   4.422 +
   4.423 +CCTEST_EXTRA_FLAGS = {
   4.424 +  'all': {
   4.425 +    'CPPPATH': [src_dir],
   4.426 +    'library:shared': {
   4.427 +      'CPPDEFINES': ['USING_V8_SHARED']
   4.428 +    },
   4.429 +  },
   4.430 +  'gcc': {
   4.431 +    'all': {
   4.432 +      'LIBPATH':      [abspath('.')],
   4.433 +      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS'],
   4.434 +      'CXXFLAGS':     ['-fno-rtti', '-fno-exceptions'],
   4.435 +      'LINKFLAGS':    ['$CCFLAGS'],
   4.436 +    },
   4.437 +    'os:linux': {
   4.438 +      'LIBS':         ['pthread'],
   4.439 +      'CCFLAGS':      ['-Wno-unused-but-set-variable'],
   4.440 +    },
   4.441 +    'os:macos': {
   4.442 +      'LIBS':         ['pthread'],
   4.443 +    },
   4.444 +    'os:freebsd': {
   4.445 +      'LIBS':         ['execinfo', 'pthread']
   4.446 +    },
   4.447 +    'os:solaris': {
   4.448 +      'LIBS':         ['m', 'pthread', 'socket', 'nsl', 'rt'],
   4.449 +      'LINKFLAGS':    ['-mt']
   4.450 +    },
   4.451 +    'os:openbsd': {
   4.452 +      'LIBS':         ['execinfo', 'pthread']
   4.453 +    },
   4.454 +    'os:win32': {
   4.455 +      'LIBS': ['winmm', 'ws2_32']
   4.456 +    },
   4.457 +    'os:netbsd': {
   4.458 +      'LIBS':         ['execinfo', 'pthread']
   4.459 +    },
   4.460 +    'arch:arm': {
   4.461 +      'LINKFLAGS':   ARM_LINK_FLAGS
   4.462 +    },
   4.463 +  },
   4.464 +  'msvc': {
   4.465 +    'all': {
   4.466 +      'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
   4.467 +      'LIBS': ['winmm', 'ws2_32']
   4.468 +    },
   4.469 +    'arch:ia32': {
   4.470 +      'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
   4.471 +    },
   4.472 +    'arch:x64': {
   4.473 +      'CPPDEFINES':   ['V8_TARGET_ARCH_X64'],
   4.474 +      'LINKFLAGS': ['/STACK:2097152']
   4.475 +    },
   4.476 +  }
   4.477 +}
   4.478 +
   4.479 +
   4.480 +SAMPLE_FLAGS = {
   4.481 +  'all': {
   4.482 +    'CPPPATH': [join(root_dir, 'include')],
   4.483 +    'library:shared': {
   4.484 +      'CPPDEFINES': ['USING_V8_SHARED']
   4.485 +    },
   4.486 +  },
   4.487 +  'gcc': {
   4.488 +    'all': {
   4.489 +      'LIBPATH':      ['.'],
   4.490 +      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS'],
   4.491 +      'CXXFLAGS':     ['-fno-rtti', '-fno-exceptions'],
   4.492 +      'LINKFLAGS':    ['$CCFLAGS'],
   4.493 +    },
   4.494 +    'os:linux': {
   4.495 +      'LIBS':         ['pthread'],
   4.496 +    },
   4.497 +    'os:macos': {
   4.498 +      'LIBS':         ['pthread'],
   4.499 +    },
   4.500 +    'os:freebsd': {
   4.501 +      'LIBPATH' :     ['/usr/local/lib'],
   4.502 +      'LIBS':         ['execinfo', 'pthread']
   4.503 +    },
   4.504 +    'os:solaris': {
   4.505 +      # On Solaris, to get isinf, INFINITY, fpclassify and other macros one
   4.506 +      # needs to define __C99FEATURES__.
   4.507 +      'CPPDEFINES': ['__C99FEATURES__'],
   4.508 +      'LIBPATH' :     ['/usr/local/lib'],
   4.509 +      'LIBS':         ['m', 'pthread', 'socket', 'nsl', 'rt'],
   4.510 +      'LINKFLAGS':    ['-mt']
   4.511 +    },
   4.512 +    'os:openbsd': {
   4.513 +      'LIBPATH' :     ['/usr/local/lib'],
   4.514 +      'LIBS':         ['execinfo', 'pthread']
   4.515 +    },
   4.516 +    'os:win32': {
   4.517 +      'LIBS':         ['winmm', 'ws2_32']
   4.518 +    },
   4.519 +    'os:netbsd': {
   4.520 +      'LIBPATH' :     ['/usr/pkg/lib'],
   4.521 +      'LIBS':         ['execinfo', 'pthread']
   4.522 +    },
   4.523 +    'arch:arm': {
   4.524 +      'LINKFLAGS':   ARM_LINK_FLAGS,
   4.525 +      'armeabi:soft' : {
   4.526 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
   4.527 +        'simulator:none': {
   4.528 +          'CCFLAGS':     ['-mfloat-abi=soft'],
   4.529 +        }
   4.530 +      },
   4.531 +      'armeabi:softfp' : {
   4.532 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
   4.533 +        'simulator:none': {
   4.534 +          'CCFLAGS':     ['-mfloat-abi=softfp'],
   4.535 +        }
   4.536 +      },
   4.537 +      'armeabi:hard' : {
   4.538 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'],
   4.539 +        'vfp3:on': {
   4.540 +          'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
   4.541 +        },
   4.542 +        'simulator:none': {
   4.543 +          'CCFLAGS':     ['-mfloat-abi=hard'],
   4.544 +        }
   4.545 +      }
   4.546 +    },
   4.547 +    'arch:ia32': {
   4.548 +      'CCFLAGS':      ['-m32'],
   4.549 +      'LINKFLAGS':    ['-m32']
   4.550 +    },
   4.551 +    'arch:x64': {
   4.552 +      'CCFLAGS':      ['-m64'],
   4.553 +      'LINKFLAGS':    ['-m64']
   4.554 +    },
   4.555 +    'arch:mips': {
   4.556 +      'CPPDEFINES':   ['V8_TARGET_ARCH_MIPS'],
   4.557 +      'mips_arch_variant:mips32r2': {
   4.558 +        'CPPDEFINES':    ['_MIPS_ARCH_MIPS32R2']
   4.559 +      },
   4.560 +      'mips_arch_variant:loongson': {
   4.561 +        'CPPDEFINES':    ['_MIPS_ARCH_LOONGSON']
   4.562 +      },
   4.563 +      'simulator:none': {
   4.564 +        'CCFLAGS':      ['-EL'],
   4.565 +        'LINKFLAGS':    ['-EL'],
   4.566 +        'mips_arch_variant:mips32r2': {
   4.567 +          'CCFLAGS':      ['-mips32r2', '-Wa,-mips32r2']
   4.568 +        },
   4.569 +        'mips_arch_variant:mips32r1': {
   4.570 +          'CCFLAGS':      ['-mips32', '-Wa,-mips32']
   4.571 +        },
   4.572 +        'mips_arch_variant:loongson': {
   4.573 +          'CCFLAGS':      ['-march=mips3', '-Wa,-march=mips3']
   4.574 +        },
   4.575 +        'library:static': {
   4.576 +          'LINKFLAGS':    ['-static', '-static-libgcc']
   4.577 +        },
   4.578 +        'mipsabi:softfloat': {
   4.579 +          'CCFLAGS':      ['-msoft-float'],
   4.580 +          'LINKFLAGS':    ['-msoft-float']
   4.581 +        },
   4.582 +        'mipsabi:hardfloat': {
   4.583 +          'CCFLAGS':      ['-mhard-float'],
   4.584 +          'LINKFLAGS':    ['-mhard-float'],
   4.585 +          'fpu:on': {
   4.586 +            'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS']
   4.587 +          }
   4.588 +        }
   4.589 +      }
   4.590 +    },
   4.591 +    'simulator:arm': {
   4.592 +      'CCFLAGS':      ['-m32'],
   4.593 +      'LINKFLAGS':    ['-m32']
   4.594 +    },
   4.595 +    'simulator:mips': {
   4.596 +      'CCFLAGS':      ['-m32'],
   4.597 +      'LINKFLAGS':    ['-m32']
   4.598 +    },
   4.599 +    'mode:release': {
   4.600 +      'CCFLAGS':      ['-O2']
   4.601 +    },
   4.602 +    'mode:debug': {
   4.603 +      'CCFLAGS':      ['-g', '-O0'],
   4.604 +      'CPPDEFINES':   ['DEBUG']
   4.605 +    },
   4.606 +    'compress_startup_data:bz2': {
   4.607 +      'CPPDEFINES':   ['COMPRESS_STARTUP_DATA_BZ2'],
   4.608 +      'os:linux': {
   4.609 +        'LIBS':       ['bz2']
   4.610 +      }
   4.611 +    },
   4.612 +  },
   4.613 +  'msvc': {
   4.614 +    'all': {
   4.615 +      'LIBS': ['winmm', 'ws2_32']
   4.616 +    },
   4.617 +    'verbose:off': {
   4.618 +      'CCFLAGS': ['/nologo'],
   4.619 +      'LINKFLAGS': ['/NOLOGO']
   4.620 +    },
   4.621 +    'verbose:on': {
   4.622 +      'LINKFLAGS': ['/VERBOSE']
   4.623 +    },
   4.624 +    'prof:on': {
   4.625 +      'LINKFLAGS': ['/MAP']
   4.626 +    },
   4.627 +    'mode:release': {
   4.628 +      'CCFLAGS':   ['/O2'],
   4.629 +      'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
   4.630 +      'msvcrt:static': {
   4.631 +        'CCFLAGS': ['/MT']
   4.632 +      },
   4.633 +      'msvcrt:shared': {
   4.634 +        'CCFLAGS': ['/MD']
   4.635 +      },
   4.636 +      'msvcltcg:on': {
   4.637 +        'CCFLAGS':      ['/GL'],
   4.638 +        'pgo:off': {
   4.639 +          'LINKFLAGS':    ['/LTCG'],
   4.640 +        },
   4.641 +      },
   4.642 +      'pgo:instrument': {
   4.643 +        'LINKFLAGS':    ['/LTCG:PGI']
   4.644 +      },
   4.645 +      'pgo:optimize': {
   4.646 +        'LINKFLAGS':    ['/LTCG:PGO']
   4.647 +      }
   4.648 +    },
   4.649 +    'arch:ia32': {
   4.650 +      'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
   4.651 +      'LINKFLAGS': ['/MACHINE:X86']
   4.652 +    },
   4.653 +    'arch:x64': {
   4.654 +      'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
   4.655 +      'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152']
   4.656 +    },
   4.657 +    'mode:debug': {
   4.658 +      'CCFLAGS':    ['/Od'],
   4.659 +      'LINKFLAGS':  ['/DEBUG'],
   4.660 +      'CPPDEFINES': ['DEBUG'],
   4.661 +      'msvcrt:static': {
   4.662 +        'CCFLAGS':  ['/MTd']
   4.663 +      },
   4.664 +      'msvcrt:shared': {
   4.665 +        'CCFLAGS':  ['/MDd']
   4.666 +      }
   4.667 +    }
   4.668 +  }
   4.669 +}
   4.670 +
   4.671 +
   4.672 +PREPARSER_FLAGS = {
   4.673 +  'all': {
   4.674 +    'CPPPATH': [join(root_dir, 'include'), src_dir],
   4.675 +    'library:shared': {
   4.676 +      'CPPDEFINES': ['USING_V8_SHARED']
   4.677 +    },
   4.678 +  },
   4.679 +  'gcc': {
   4.680 +    'all': {
   4.681 +      'LIBPATH':      ['.'],
   4.682 +      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS'],
   4.683 +      'CXXFLAGS':     ['-fno-rtti', '-fno-exceptions'],
   4.684 +      'LINKFLAGS':    ['$CCFLAGS'],
   4.685 +    },
   4.686 +    'os:win32': {
   4.687 +      'LIBS':         ['winmm', 'ws2_32']
   4.688 +    },
   4.689 +    'arch:arm': {
   4.690 +      'LINKFLAGS':   ARM_LINK_FLAGS,
   4.691 +      'armeabi:soft' : {
   4.692 +        'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
   4.693 +        'simulator:none': {
   4.694 +          'CCFLAGS':     ['-mfloat-abi=soft'],
   4.695 +        }
   4.696 +      },
   4.697 +      'armeabi:softfp' : {
   4.698 +        'simulator:none': {
   4.699 +          'CCFLAGS':     ['-mfloat-abi=softfp'],
   4.700 +        }
   4.701 +      },
   4.702 +      'armeabi:hard' : {
   4.703 +        'simulator:none': {
   4.704 +          'CCFLAGS':     ['-mfloat-abi=hard'],
   4.705 +        }
   4.706 +      }
   4.707 +    },
   4.708 +    'arch:ia32': {
   4.709 +      'CCFLAGS':      ['-m32'],
   4.710 +      'LINKFLAGS':    ['-m32']
   4.711 +    },
   4.712 +    'arch:x64': {
   4.713 +      'CCFLAGS':      ['-m64'],
   4.714 +      'LINKFLAGS':    ['-m64']
   4.715 +    },
   4.716 +    'arch:mips': {
   4.717 +      'CPPDEFINES':   ['V8_TARGET_ARCH_MIPS'],
   4.718 +      'mips_arch_variant:mips32r2': {
   4.719 +        'CPPDEFINES':    ['_MIPS_ARCH_MIPS32R2']
   4.720 +      },
   4.721 +      'mips_arch_variant:loongson': {
   4.722 +        'CPPDEFINES':    ['_MIPS_ARCH_LOONGSON']
   4.723 +      },
   4.724 +      'simulator:none': {
   4.725 +        'CCFLAGS':      ['-EL'],
   4.726 +        'LINKFLAGS':    ['-EL'],
   4.727 +        'mips_arch_variant:mips32r2': {
   4.728 +          'CCFLAGS':      ['-mips32r2', '-Wa,-mips32r2']
   4.729 +        },
   4.730 +        'mips_arch_variant:mips32r1': {
   4.731 +          'CCFLAGS':      ['-mips32', '-Wa,-mips32']
   4.732 +        },
   4.733 +        'mips_arch_variant:loongson': {
   4.734 +          'CCFLAGS':      ['-march=mips3', '-Wa,-march=mips3']
   4.735 +        },
   4.736 +        'library:static': {
   4.737 +          'LINKFLAGS':    ['-static', '-static-libgcc']
   4.738 +        },
   4.739 +        'mipsabi:softfloat': {
   4.740 +          'CCFLAGS':      ['-msoft-float'],
   4.741 +          'LINKFLAGS':    ['-msoft-float']
   4.742 +        },
   4.743 +        'mipsabi:hardfloat': {
   4.744 +          'CCFLAGS':      ['-mhard-float'],
   4.745 +          'LINKFLAGS':    ['-mhard-float']
   4.746 +        }
   4.747 +      }
   4.748 +    },
   4.749 +    'simulator:arm': {
   4.750 +      'CCFLAGS':      ['-m32'],
   4.751 +      'LINKFLAGS':    ['-m32']
   4.752 +    },
   4.753 +    'simulator:mips': {
   4.754 +      'CCFLAGS':      ['-m32'],
   4.755 +      'LINKFLAGS':    ['-m32'],
   4.756 +      'mipsabi:softfloat': {
   4.757 +        'CPPDEFINES':    ['__mips_soft_float=1'],
   4.758 +      },
   4.759 +      'mipsabi:hardfloat': {
   4.760 +        'CPPDEFINES':    ['__mips_hard_float=1'],
   4.761 +      }
   4.762 +    },
   4.763 +    'mode:release': {
   4.764 +      'CCFLAGS':      ['-O2']
   4.765 +    },
   4.766 +    'mode:debug': {
   4.767 +      'CCFLAGS':      ['-g', '-O0'],
   4.768 +      'CPPDEFINES':   ['DEBUG']
   4.769 +    },
   4.770 +    'os:freebsd': {
   4.771 +      'LIBPATH' : ['/usr/local/lib'],
   4.772 +    },
   4.773 +  },
   4.774 +  'msvc': {
   4.775 +    'all': {
   4.776 +      'LIBS': ['winmm', 'ws2_32']
   4.777 +    },
   4.778 +    'verbose:off': {
   4.779 +      'CCFLAGS': ['/nologo'],
   4.780 +      'LINKFLAGS': ['/NOLOGO']
   4.781 +    },
   4.782 +    'verbose:on': {
   4.783 +      'LINKFLAGS': ['/VERBOSE']
   4.784 +    },
   4.785 +    'prof:on': {
   4.786 +      'LINKFLAGS': ['/MAP']
   4.787 +    },
   4.788 +    'mode:release': {
   4.789 +      'CCFLAGS':   ['/O2'],
   4.790 +      'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
   4.791 +      'msvcrt:static': {
   4.792 +        'CCFLAGS': ['/MT']
   4.793 +      },
   4.794 +      'msvcrt:shared': {
   4.795 +        'CCFLAGS': ['/MD']
   4.796 +      },
   4.797 +      'msvcltcg:on': {
   4.798 +        'CCFLAGS':      ['/GL'],
   4.799 +        'pgo:off': {
   4.800 +          'LINKFLAGS':    ['/LTCG'],
   4.801 +        },
   4.802 +      },
   4.803 +      'pgo:instrument': {
   4.804 +        'LINKFLAGS':    ['/LTCG:PGI']
   4.805 +      },
   4.806 +      'pgo:optimize': {
   4.807 +        'LINKFLAGS':    ['/LTCG:PGO']
   4.808 +      }
   4.809 +    },
   4.810 +    'arch:ia32': {
   4.811 +      'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
   4.812 +      'LINKFLAGS': ['/MACHINE:X86']
   4.813 +    },
   4.814 +    'arch:x64': {
   4.815 +      'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
   4.816 +      'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152']
   4.817 +    },
   4.818 +    'mode:debug': {
   4.819 +      'CCFLAGS':    ['/Od'],
   4.820 +      'LINKFLAGS':  ['/DEBUG'],
   4.821 +      'CPPDEFINES': ['DEBUG'],
   4.822 +      'msvcrt:static': {
   4.823 +        'CCFLAGS':  ['/MTd']
   4.824 +      },
   4.825 +      'msvcrt:shared': {
   4.826 +        'CCFLAGS':  ['/MDd']
   4.827 +      }
   4.828 +    }
   4.829 +  }
   4.830 +}
   4.831 +
   4.832 +
   4.833 +D8_FLAGS = {
   4.834 +  'all': {
   4.835 +    'library:shared': {
   4.836 +      'CPPDEFINES': ['V8_SHARED'],
   4.837 +      'LIBS': ['v8'],
   4.838 +      'LIBPATH': ['.']
   4.839 +    },
   4.840 +  },
   4.841 +  'gcc': {
   4.842 +    'all': {
   4.843 +      'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
   4.844 +      'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
   4.845 +      'LINKFLAGS': ['$CCFLAGS'],
   4.846 +    },
   4.847 +    'console:readline': {
   4.848 +      'LIBS': ['readline']
   4.849 +    },
   4.850 +    'os:linux': {
   4.851 +      'LIBS': ['pthread'],
   4.852 +    },
   4.853 +    'os:macos': {
   4.854 +      'LIBS': ['pthread'],
   4.855 +    },
   4.856 +    'os:freebsd': {
   4.857 +      'LIBS': ['pthread'],
   4.858 +    },
   4.859 +    'os:solaris': {
   4.860 +      'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
   4.861 +      'LINKFLAGS': ['-mt']
   4.862 +    },
   4.863 +    'os:openbsd': {
   4.864 +      'LIBS': ['pthread'],
   4.865 +    },
   4.866 +    'os:win32': {
   4.867 +      'LIBS': ['winmm', 'ws2_32'],
   4.868 +    },
   4.869 +    'os:netbsd': {
   4.870 +      'LIBS': ['pthread'],
   4.871 +    },
   4.872 +    'arch:arm': {
   4.873 +      'LINKFLAGS':   ARM_LINK_FLAGS
   4.874 +    },
   4.875 +    'compress_startup_data:bz2': {
   4.876 +      'CPPDEFINES':   ['COMPRESS_STARTUP_DATA_BZ2'],
   4.877 +      'os:linux': {
   4.878 +        'LIBS': ['bz2']
   4.879 +      }
   4.880 +    }
   4.881 +  },
   4.882 +  'msvc': {
   4.883 +    'all': {
   4.884 +      'LIBS': ['winmm', 'ws2_32']
   4.885 +    },
   4.886 +    'verbose:off': {
   4.887 +      'CCFLAGS': ['/nologo'],
   4.888 +      'LINKFLAGS': ['/NOLOGO']
   4.889 +    },
   4.890 +    'verbose:on': {
   4.891 +      'LINKFLAGS': ['/VERBOSE']
   4.892 +    },
   4.893 +    'prof:on': {
   4.894 +      'LINKFLAGS': ['/MAP']
   4.895 +    },
   4.896 +    'mode:release': {
   4.897 +      'CCFLAGS':   ['/O2'],
   4.898 +      'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'],
   4.899 +      'msvcrt:static': {
   4.900 +        'CCFLAGS': ['/MT']
   4.901 +      },
   4.902 +      'msvcrt:shared': {
   4.903 +        'CCFLAGS': ['/MD']
   4.904 +      },
   4.905 +      'msvcltcg:on': {
   4.906 +        'CCFLAGS':      ['/GL'],
   4.907 +        'pgo:off': {
   4.908 +          'LINKFLAGS':    ['/LTCG'],
   4.909 +        },
   4.910 +      },
   4.911 +      'pgo:instrument': {
   4.912 +        'LINKFLAGS':    ['/LTCG:PGI']
   4.913 +      },
   4.914 +      'pgo:optimize': {
   4.915 +        'LINKFLAGS':    ['/LTCG:PGO']
   4.916 +      }
   4.917 +    },
   4.918 +    'arch:ia32': {
   4.919 +      'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'],
   4.920 +      'LINKFLAGS': ['/MACHINE:X86']
   4.921 +    },
   4.922 +    'arch:x64': {
   4.923 +      'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'],
   4.924 +      'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152']
   4.925 +    },
   4.926 +    'mode:debug': {
   4.927 +      'CCFLAGS':    ['/Od'],
   4.928 +      'LINKFLAGS':  ['/DEBUG'],
   4.929 +      'CPPDEFINES': ['DEBUG'],
   4.930 +      'msvcrt:static': {
   4.931 +        'CCFLAGS':  ['/MTd']
   4.932 +      },
   4.933 +      'msvcrt:shared': {
   4.934 +        'CCFLAGS':  ['/MDd']
   4.935 +      }
   4.936 +    }
   4.937 +  }
   4.938 +}
   4.939 +
   4.940 +
   4.941 +SUFFIXES = {
   4.942 +  'release': '',
   4.943 +  'debug': '_g'
   4.944 +}
   4.945 +
   4.946 +
   4.947 +def Abort(message):
   4.948 +  print message
   4.949 +  sys.exit(1)
   4.950 +
   4.951 +
   4.952 +def GuessOS(env):
   4.953 +  return utils.GuessOS()
   4.954 +
   4.955 +
   4.956 +def GuessArch(env):
   4.957 +  return utils.GuessArchitecture()
   4.958 +
   4.959 +
   4.960 +def GuessToolchain(env):
   4.961 +  tools = env['TOOLS']
   4.962 +  if 'gcc' in tools:
   4.963 +    return 'gcc'
   4.964 +  elif 'msvc' in tools:
   4.965 +    return 'msvc'
   4.966 +  else:
   4.967 +    return None
   4.968 +
   4.969 +
   4.970 +def GuessVisibility(env):
   4.971 +  os = env['os']
   4.972 +  toolchain = env['toolchain'];
   4.973 +  if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc':
   4.974 +    # MinGW / Cygwin can't do it.
   4.975 +    return 'default'
   4.976 +  elif os == 'solaris':
   4.977 +    return 'default'
   4.978 +  else:
   4.979 +    return 'hidden'
   4.980 +
   4.981 +
   4.982 +def GuessStrictAliasing(env):
   4.983 +  # There seems to be a problem with gcc 4.5.x.
   4.984 +  # See http://code.google.com/p/v8/issues/detail?id=884
   4.985 +  # It can be worked around by disabling strict aliasing.
   4.986 +  toolchain = env['toolchain'];
   4.987 +  if toolchain == 'gcc':
   4.988 +    env = Environment(tools=['gcc'])
   4.989 +    # The gcc version should be available in env['CCVERSION'],
   4.990 +    # but when scons detects msvc this value is not set.
   4.991 +    version = subprocess.Popen([env['CC'], '-dumpversion'],
   4.992 +        stdout=subprocess.PIPE).communicate()[0]
   4.993 +    if version.find('4.5') == 0:
   4.994 +      return 'off'
   4.995 +  return 'default'
   4.996 +
   4.997 +
   4.998 +PLATFORM_OPTIONS = {
   4.999 +  'arch': {
  4.1000 +    'values': ['arm', 'ia32', 'x64', 'mips'],
  4.1001 +    'guess': GuessArch,
  4.1002 +    'help': 'the architecture to build for'
  4.1003 +  },
  4.1004 +  'os': {
  4.1005 +    'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin', 'netbsd'],
  4.1006 +    'guess': GuessOS,
  4.1007 +    'help': 'the os to build for'
  4.1008 +  },
  4.1009 +  'toolchain': {
  4.1010 +    'values': ['gcc', 'msvc'],
  4.1011 +    'guess': GuessToolchain,
  4.1012 +    'help': 'the toolchain to use'
  4.1013 +  }
  4.1014 +}
  4.1015 +
  4.1016 +SIMPLE_OPTIONS = {
  4.1017 +  'regexp': {
  4.1018 +    'values': ['native', 'interpreted'],
  4.1019 +    'default': 'native',
  4.1020 +    'help': 'Whether to use native or interpreted regexp implementation'
  4.1021 +  },
  4.1022 +  'snapshot': {
  4.1023 +    'values': ['on', 'off', 'nobuild'],
  4.1024 +    'default': 'off',
  4.1025 +    'help': 'build using snapshots for faster start-up'
  4.1026 +  },
  4.1027 +  'prof': {
  4.1028 +    'values': ['on', 'off'],
  4.1029 +    'default': 'off',
  4.1030 +    'help': 'enable profiling of build target'
  4.1031 +  },
  4.1032 +  'gdbjit': {
  4.1033 +    'values': ['on', 'off'],
  4.1034 +    'default': 'off',
  4.1035 +    'help': 'enable GDB JIT interface'
  4.1036 +  },
  4.1037 +  'library': {
  4.1038 +    'values': ['static', 'shared'],
  4.1039 +    'default': 'static',
  4.1040 +    'help': 'the type of library to produce'
  4.1041 +  },
  4.1042 +  'objectprint': {
  4.1043 +    'values': ['on', 'off'],
  4.1044 +    'default': 'off',
  4.1045 +    'help': 'enable object printing'
  4.1046 +  },
  4.1047 +  'profilingsupport': {
  4.1048 +    'values': ['on', 'off'],
  4.1049 +    'default': 'on',
  4.1050 +    'help': 'enable profiling of JavaScript code'
  4.1051 +  },
  4.1052 +  'debuggersupport': {
  4.1053 +    'values': ['on', 'off'],
  4.1054 +    'default': 'on',
  4.1055 +    'help': 'enable debugging of JavaScript code'
  4.1056 +  },
  4.1057 +  'inspector': {
  4.1058 +    'values': ['on', 'off'],
  4.1059 +    'default': 'off',
  4.1060 +    'help': 'enable inspector features'
  4.1061 +  },
  4.1062 +  'liveobjectlist': {
  4.1063 +    'values': ['on', 'off'],
  4.1064 +    'default': 'off',
  4.1065 +    'help': 'enable live object list features in the debugger'
  4.1066 +  },
  4.1067 +  'soname': {
  4.1068 +    'values': ['on', 'off'],
  4.1069 +    'default': 'off',
  4.1070 +    'help': 'turn on setting soname for Linux shared library'
  4.1071 +  },
  4.1072 +  'msvcrt': {
  4.1073 +    'values': ['static', 'shared'],
  4.1074 +    'default': 'static',
  4.1075 +    'help': 'the type of Microsoft Visual C++ runtime library to use'
  4.1076 +  },
  4.1077 +  'msvcltcg': {
  4.1078 +    'values': ['on', 'off'],
  4.1079 +    'default': 'on',
  4.1080 +    'help': 'use Microsoft Visual C++ link-time code generation'
  4.1081 +  },
  4.1082 +  'simulator': {
  4.1083 +    'values': ['arm', 'mips', 'none'],
  4.1084 +    'default': 'none',
  4.1085 +    'help': 'build with simulator'
  4.1086 +  },
  4.1087 +  'unalignedaccesses': {
  4.1088 +    'values': ['default', 'on', 'off'],
  4.1089 +    'default': 'default',
  4.1090 +    'help': 'set whether the ARM target supports unaligned accesses'
  4.1091 +  },
  4.1092 +  'disassembler': {
  4.1093 +    'values': ['on', 'off'],
  4.1094 +    'default': 'off',
  4.1095 +    'help': 'enable the disassembler to inspect generated code'
  4.1096 +  },
  4.1097 +  'fasttls': {
  4.1098 +    'values': ['on', 'off'],
  4.1099 +    'default': 'on',
  4.1100 +    'help': 'enable fast thread local storage support '
  4.1101 +            '(if available on the current architecture/platform)'
  4.1102 +  },
  4.1103 +  'sourcesignatures': {
  4.1104 +    'values': ['MD5', 'timestamp'],
  4.1105 +    'default': 'MD5',
  4.1106 +    'help': 'set how the build system detects file changes'
  4.1107 +  },
  4.1108 +  'console': {
  4.1109 +    'values': ['dumb', 'readline'],
  4.1110 +    'default': 'dumb',
  4.1111 +    'help': 'the console to use for the d8 shell'
  4.1112 +  },
  4.1113 +  'verbose': {
  4.1114 +    'values': ['on', 'off'],
  4.1115 +    'default': 'off',
  4.1116 +    'help': 'more output from compiler and linker'
  4.1117 +  },
  4.1118 +  'visibility': {
  4.1119 +    'values': ['default', 'hidden'],
  4.1120 +    'guess': GuessVisibility,
  4.1121 +    'help': 'shared library symbol visibility'
  4.1122 +  },
  4.1123 +  'strictaliasing': {
  4.1124 +    'values': ['default', 'off'],
  4.1125 +    'guess': GuessStrictAliasing,
  4.1126 +    'help': 'assume strict aliasing while optimizing'
  4.1127 +  },
  4.1128 +  'pgo': {
  4.1129 +    'values': ['off', 'instrument', 'optimize'],
  4.1130 +    'default': 'off',
  4.1131 +    'help': 'select profile guided optimization variant',
  4.1132 +  },
  4.1133 +  'armeabi': {
  4.1134 +    'values': ['hard', 'softfp', 'soft'],
  4.1135 +    'default': 'softfp',
  4.1136 +    'help': 'generate calling conventiont according to selected ARM EABI variant'
  4.1137 +  },
  4.1138 +  'mipsabi': {
  4.1139 +    'values': ['hardfloat', 'softfloat', 'none'],
  4.1140 +    'default': 'hardfloat',
  4.1141 +    'help': 'generate calling conventiont according to selected mips ABI'
  4.1142 +  },
  4.1143 +  'mips_arch_variant': {
  4.1144 +    'values': ['mips32r2', 'mips32r1', 'loongson'],
  4.1145 +    'default': 'mips32r2',
  4.1146 +    'help': 'mips variant'
  4.1147 +  },
  4.1148 +  'compress_startup_data': {
  4.1149 +    'values': ['off', 'bz2'],
  4.1150 +    'default': 'off',
  4.1151 +    'help': 'compress startup data (snapshot) [Linux only]'
  4.1152 +  },
  4.1153 +  'vfp3': {
  4.1154 +    'values': ['on', 'off'],
  4.1155 +    'default': 'on',
  4.1156 +    'help': 'use vfp3 instructions when building the snapshot [Arm only]'
  4.1157 +  },
  4.1158 +  'fpu': {
  4.1159 +    'values': ['on', 'off'],
  4.1160 +    'default': 'on',
  4.1161 +    'help': 'use fpu instructions when building the snapshot [MIPS only]'
  4.1162 +  },
  4.1163 +  'I_know_I_should_build_with_GYP': {
  4.1164 +    'values': ['yes', 'no'],
  4.1165 +    'default': 'no',
  4.1166 +    'help': 'grace period: temporarily override SCons deprecation'
  4.1167 +  }
  4.1168 +
  4.1169 +}
  4.1170 +
  4.1171 +ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS)
  4.1172 +
  4.1173 +
  4.1174 +def AddOptions(options, result):
  4.1175 +  guess_env = Environment(options=result)
  4.1176 +  for (name, option) in options.iteritems():
  4.1177 +    if 'guess' in option:
  4.1178 +      # Option has a guess function
  4.1179 +      guess = option.get('guess')
  4.1180 +      default = guess(guess_env)
  4.1181 +    else:
  4.1182 +      # Option has a fixed default
  4.1183 +      default = option.get('default')
  4.1184 +    help = '%s (%s)' % (option.get('help'), ", ".join(option['values']))
  4.1185 +    result.Add(name, help, default)
  4.1186 +
  4.1187 +
  4.1188 +def GetOptions():
  4.1189 +  result = Options()
  4.1190 +  result.Add('mode', 'compilation mode (debug, release)', 'release')
  4.1191 +  result.Add('sample', 'build sample (shell, process, lineprocessor)', '')
  4.1192 +  result.Add('cache', 'directory to use for scons build cache', '')
  4.1193 +  result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '')
  4.1194 +  result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '')
  4.1195 +  AddOptions(PLATFORM_OPTIONS, result)
  4.1196 +  AddOptions(SIMPLE_OPTIONS, result)
  4.1197 +  return result
  4.1198 +
  4.1199 +
  4.1200 +def GetTools(opts):
  4.1201 +  env = Environment(options=opts)
  4.1202 +  os = env['os']
  4.1203 +  toolchain = env['toolchain']
  4.1204 +  if os == 'win32' and toolchain == 'gcc':
  4.1205 +    return ['mingw']
  4.1206 +  elif os == 'win32' and toolchain == 'msvc':
  4.1207 +    return ['msvc', 'mslink', 'mslib', 'msvs']
  4.1208 +  else:
  4.1209 +    return ['default']
  4.1210 +
  4.1211 +
  4.1212 +def GetVersionComponents():
  4.1213 +  MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)")
  4.1214 +  MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)")
  4.1215 +  BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)")
  4.1216 +  PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)")
  4.1217 +
  4.1218 +  patterns = [MAJOR_VERSION_PATTERN,
  4.1219 +              MINOR_VERSION_PATTERN,
  4.1220 +              BUILD_NUMBER_PATTERN,
  4.1221 +              PATCH_LEVEL_PATTERN]
  4.1222 +
  4.1223 +  source = open(join(root_dir, 'src', 'version.cc')).read()
  4.1224 +  version_components = []
  4.1225 +  for pattern in patterns:
  4.1226 +    match = pattern.search(source)
  4.1227 +    if match:
  4.1228 +      version_components.append(match.group(1).strip())
  4.1229 +    else:
  4.1230 +      version_components.append('0')
  4.1231 +
  4.1232 +  return version_components
  4.1233 +
  4.1234 +
  4.1235 +def GetVersion():
  4.1236 +  version_components = GetVersionComponents()
  4.1237 +
  4.1238 +  if version_components[len(version_components) - 1] == '0':
  4.1239 +    version_components.pop()
  4.1240 +  return '.'.join(version_components)
  4.1241 +
  4.1242 +
  4.1243 +def GetSpecificSONAME():
  4.1244 +  SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"")
  4.1245 +
  4.1246 +  source = open(join(root_dir, 'src', 'version.cc')).read()
  4.1247 +  match = SONAME_PATTERN.search(source)
  4.1248 +
  4.1249 +  if match:
  4.1250 +    return match.group(1).strip()
  4.1251 +  else:
  4.1252 +    return ''
  4.1253 +
  4.1254 +
  4.1255 +def SplitList(str):
  4.1256 +  return [ s for s in str.split(",") if len(s) > 0 ]
  4.1257 +
  4.1258 +
  4.1259 +def IsLegal(env, option, values):
  4.1260 +  str = env[option]
  4.1261 +  for s in SplitList(str):
  4.1262 +    if not s in values:
  4.1263 +      Abort("Illegal value for option %s '%s'." % (option, s))
  4.1264 +      return False
  4.1265 +  return True
  4.1266 +
  4.1267 +
  4.1268 +def WarnAboutDeprecation():
  4.1269 +  print """
  4.1270 +    #####################################################################
  4.1271 +    #                                                                   #
  4.1272 +    #  LAST WARNING: Building V8 with SCons is deprecated.              #
  4.1273 +    #                                                                   #
  4.1274 +    #  This only works because you have overridden the kill switch.     #
  4.1275 +    #                                                                   #
  4.1276 +    #              MIGRATE TO THE GYP-BASED BUILD NOW!                  #
  4.1277 +    #                                                                   #
  4.1278 +    #  Instructions: http://code.google.com/p/v8/wiki/BuildingWithGYP.  #
  4.1279 +    #                                                                   #
  4.1280 +    #####################################################################
  4.1281 +  """
  4.1282 +
  4.1283 +
  4.1284 +def VerifyOptions(env):
  4.1285 +  if env['I_know_I_should_build_with_GYP'] != 'yes':
  4.1286 +    Abort("Building V8 with SCons is no longer supported. Please use GYP "
  4.1287 +          "instead; you can find instructions are at "
  4.1288 +          "http://code.google.com/p/v8/wiki/BuildingWithGYP.\n\n"
  4.1289 +          "Quitting.\n\n"
  4.1290 +          "For a limited grace period, you can specify "
  4.1291 +          "\"I_know_I_should_build_with_GYP=yes\" to override.")
  4.1292 +  else:
  4.1293 +    WarnAboutDeprecation()
  4.1294 +    import atexit
  4.1295 +    atexit.register(WarnAboutDeprecation)
  4.1296 +
  4.1297 +  if not IsLegal(env, 'mode', ['debug', 'release']):
  4.1298 +    return False
  4.1299 +  if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]):
  4.1300 +    return False
  4.1301 +  if not IsLegal(env, 'regexp', ["native", "interpreted"]):
  4.1302 +    return False
  4.1303 +  if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on':
  4.1304 +    Abort("Profiling on windows only supported for static library.")
  4.1305 +  if env['gdbjit'] == 'on' and ((env['os'] != 'linux' and env['os'] != 'macos') or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')):
  4.1306 +    Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64) Linux/OSX target.")
  4.1307 +  if env['os'] == 'win32' and env['soname'] == 'on':
  4.1308 +    Abort("Shared Object soname not applicable for Windows.")
  4.1309 +  if env['soname'] == 'on' and env['library'] == 'static':
  4.1310 +    Abort("Shared Object soname not applicable for static library.")
  4.1311 +  if env['os'] != 'win32' and env['pgo'] != 'off':
  4.1312 +    Abort("Profile guided optimization only supported on Windows.")
  4.1313 +  if env['cache'] and not os.path.isdir(env['cache']):
  4.1314 +    Abort("The specified cache directory does not exist.")
  4.1315 +  if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS):
  4.1316 +    print env['arch']
  4.1317 +    print env['simulator']
  4.1318 +    Abort("Option unalignedaccesses only supported for the ARM architecture.")
  4.1319 +  if env['os'] != 'linux' and env['compress_startup_data'] != 'off':
  4.1320 +    Abort("Startup data compression is only available on Linux")
  4.1321 +  for (name, option) in ALL_OPTIONS.iteritems():
  4.1322 +    if (not name in env):
  4.1323 +      message = ("A value for option %s must be specified (%s)." %
  4.1324 +          (name, ", ".join(option['values'])))
  4.1325 +      Abort(message)
  4.1326 +    if not env[name] in option['values']:
  4.1327 +      message = ("Unknown %s value '%s'.  Possible values are (%s)." %
  4.1328 +          (name, env[name], ", ".join(option['values'])))
  4.1329 +      Abort(message)
  4.1330 +
  4.1331 +
  4.1332 +class BuildContext(object):
  4.1333 +
  4.1334 +  def __init__(self, options, env_overrides, samples):
  4.1335 +    self.library_targets = []
  4.1336 +    self.mksnapshot_targets = []
  4.1337 +    self.cctest_targets = []
  4.1338 +    self.sample_targets = []
  4.1339 +    self.d8_targets = []
  4.1340 +    self.options = options
  4.1341 +    self.env_overrides = env_overrides
  4.1342 +    self.samples = samples
  4.1343 +    self.preparser_targets = []
  4.1344 +    self.use_snapshot = (options['snapshot'] != 'off')
  4.1345 +    self.build_snapshot = (options['snapshot'] == 'on')
  4.1346 +    self.flags = None
  4.1347 +
  4.1348 +  def AddRelevantFlags(self, initial, flags):
  4.1349 +    result = initial.copy()
  4.1350 +    toolchain = self.options['toolchain']
  4.1351 +    if toolchain in flags:
  4.1352 +      self.AppendFlags(result, flags[toolchain].get('all'))
  4.1353 +      for option in sorted(self.options.keys()):
  4.1354 +        value = self.options[option]
  4.1355 +        self.AppendFlags(result, flags[toolchain].get(option + ':' + value))
  4.1356 +    self.AppendFlags(result, flags.get('all'))
  4.1357 +    return result
  4.1358 +
  4.1359 +  def AddRelevantSubFlags(self, options, flags):
  4.1360 +    self.AppendFlags(options, flags.get('all'))
  4.1361 +    for option in sorted(self.options.keys()):
  4.1362 +      value = self.options[option]
  4.1363 +      self.AppendFlags(options, flags.get(option + ':' + value))
  4.1364 +
  4.1365 +  def GetRelevantSources(self, source):
  4.1366 +    result = []
  4.1367 +    result += source.get('all', [])
  4.1368 +    for (name, value) in self.options.iteritems():
  4.1369 +      source_value = source.get(name + ':' + value, [])
  4.1370 +      if type(source_value) == dict:
  4.1371 +        result += self.GetRelevantSources(source_value)
  4.1372 +      else:
  4.1373 +        result += source_value
  4.1374 +    return sorted(result)
  4.1375 +
  4.1376 +  def AppendFlags(self, options, added):
  4.1377 +    if not added:
  4.1378 +      return
  4.1379 +    for (key, value) in added.iteritems():
  4.1380 +      if key.find(':') != -1:
  4.1381 +        self.AddRelevantSubFlags(options, { key: value })
  4.1382 +      else:
  4.1383 +        if not key in options:
  4.1384 +          options[key] = value
  4.1385 +        else:
  4.1386 +          prefix = options[key]
  4.1387 +          if isinstance(prefix, StringTypes): prefix = prefix.split()
  4.1388 +          options[key] = prefix + value
  4.1389 +
  4.1390 +  def ConfigureObject(self, env, input, **kw):
  4.1391 +    if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')):
  4.1392 +      kw['CPPPATH'] += env['CPPPATH']
  4.1393 +    if self.options['library'] == 'static':
  4.1394 +      return env.StaticObject(input, **kw)
  4.1395 +    else:
  4.1396 +      return env.SharedObject(input, **kw)
  4.1397 +
  4.1398 +  def ApplyEnvOverrides(self, env):
  4.1399 +    if not self.env_overrides:
  4.1400 +      return
  4.1401 +    if type(env['ENV']) == DictType:
  4.1402 +      env['ENV'].update(**self.env_overrides)
  4.1403 +    else:
  4.1404 +      env['ENV'] = self.env_overrides
  4.1405 +
  4.1406 +
  4.1407 +def PostprocessOptions(options, os):
  4.1408 +  # Adjust architecture if the simulator option has been set
  4.1409 +  if (options['simulator'] != 'none') and (options['arch'] != options['simulator']):
  4.1410 +    if 'arch' in ARGUMENTS:
  4.1411 +      # Print a warning if arch has explicitly been set
  4.1412 +      print "Warning: forcing architecture to match simulator (%s)" % options['simulator']
  4.1413 +    options['arch'] = options['simulator']
  4.1414 +  if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'):
  4.1415 +    # Print a warning if profiling is enabled without profiling support
  4.1416 +    print "Warning: forcing profilingsupport on when prof is on"
  4.1417 +    options['profilingsupport'] = 'on'
  4.1418 +  if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off':
  4.1419 +    if 'msvcltcg' in ARGUMENTS:
  4.1420 +      print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo']
  4.1421 +    options['msvcltcg'] = 'on'
  4.1422 +  if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options['simulator'] != 'mips'):
  4.1423 +    options['mipsabi'] = 'none'
  4.1424 +  if options['liveobjectlist'] == 'on':
  4.1425 +    if (options['debuggersupport'] != 'on') or (options['mode'] == 'release'):
  4.1426 +      # Print a warning that liveobjectlist will implicitly enable the debugger
  4.1427 +      print "Warning: forcing debuggersupport on for liveobjectlist"
  4.1428 +    options['debuggersupport'] = 'on'
  4.1429 +    options['inspector'] = 'on'
  4.1430 +    options['objectprint'] = 'on'
  4.1431 +
  4.1432 +
  4.1433 +def ParseEnvOverrides(arg, imports):
  4.1434 +  # The environment overrides are in the format NAME0:value0,NAME1:value1,...
  4.1435 +  # The environment imports are in the format NAME0,NAME1,...
  4.1436 +  overrides = {}
  4.1437 +  for var in imports.split(','):
  4.1438 +    if var in os.environ:
  4.1439 +      overrides[var] = os.environ[var]
  4.1440 +  for override in arg.split(','):
  4.1441 +    pos = override.find(':')
  4.1442 +    if pos == -1:
  4.1443 +      continue
  4.1444 +    overrides[override[:pos].strip()] = override[pos+1:].strip()
  4.1445 +  return overrides
  4.1446 +
  4.1447 +
  4.1448 +def BuildSpecific(env, mode, env_overrides, tools):
  4.1449 +  options = {'mode': mode}
  4.1450 +  for option in ALL_OPTIONS:
  4.1451 +    options[option] = env[option]
  4.1452 +  PostprocessOptions(options, env['os'])
  4.1453 +
  4.1454 +  context = BuildContext(options, env_overrides, samples=SplitList(env['sample']))
  4.1455 +
  4.1456 +  # Remove variables which can't be imported from the user's external
  4.1457 +  # environment into a construction environment.
  4.1458 +  user_environ = os.environ.copy()
  4.1459 +  try:
  4.1460 +    del user_environ['ENV']
  4.1461 +  except KeyError:
  4.1462 +    pass
  4.1463 +
  4.1464 +  library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS)
  4.1465 +  v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS)
  4.1466 +  mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS)
  4.1467 +  dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS)
  4.1468 +  cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS)
  4.1469 +  sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS)
  4.1470 +  preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS)
  4.1471 +  d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS)
  4.1472 +
  4.1473 +  context.flags = {
  4.1474 +    'v8': v8_flags,
  4.1475 +    'mksnapshot': mksnapshot_flags,
  4.1476 +    'dtoa': dtoa_flags,
  4.1477 +    'cctest': cctest_flags,
  4.1478 +    'sample': sample_flags,
  4.1479 +    'd8': d8_flags,
  4.1480 +    'preparser': preparser_flags
  4.1481 +  }
  4.1482 +
  4.1483 +  # Generate library base name.
  4.1484 +  target_id = mode
  4.1485 +  suffix = SUFFIXES[target_id]
  4.1486 +  library_name = 'v8' + suffix
  4.1487 +  preparser_library_name = 'v8preparser' + suffix
  4.1488 +  version = GetVersion()
  4.1489 +  if context.options['soname'] == 'on':
  4.1490 +    # When building shared object with SONAME version the library name.
  4.1491 +    library_name += '-' + version
  4.1492 +
  4.1493 +  # Generate library SONAME if required by the build.
  4.1494 +  if context.options['soname'] == 'on':
  4.1495 +    soname = GetSpecificSONAME()
  4.1496 +    if soname == '':
  4.1497 +      soname = 'lib' + library_name + '.so'
  4.1498 +    env['SONAME'] = soname
  4.1499 +
  4.1500 +  # Build the object files by invoking SCons recursively.
  4.1501 +  d8_env = Environment(tools=tools)
  4.1502 +  d8_env.Replace(**context.flags['d8'])
  4.1503 +  (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript(
  4.1504 +    join('src', 'SConscript'),
  4.1505 +    build_dir=join('obj', target_id),
  4.1506 +    exports='context tools d8_env',
  4.1507 +    duplicate=False
  4.1508 +  )
  4.1509 +
  4.1510 +  context.mksnapshot_targets.append(mksnapshot)
  4.1511 +
  4.1512 +  # Link the object files into a library.
  4.1513 +  env.Replace(**context.flags['v8'])
  4.1514 +
  4.1515 +  context.ApplyEnvOverrides(env)
  4.1516 +  if context.options['library'] == 'static':
  4.1517 +    library = env.StaticLibrary(library_name, object_files)
  4.1518 +    preparser_library = env.StaticLibrary(preparser_library_name,
  4.1519 +                                          preparser_files)
  4.1520 +  else:
  4.1521 +    # There seems to be a glitch in the way scons decides where to put
  4.1522 +    # PDB files when compiling using MSVC so we specify it manually.
  4.1523 +    # This should not affect any other platforms.
  4.1524 +    pdb_name = library_name + '.dll.pdb'
  4.1525 +    library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
  4.1526 +    preparser_pdb_name = preparser_library_name + '.dll.pdb';
  4.1527 +    preparser_soname = 'lib' + preparser_library_name + '.so';
  4.1528 +    preparser_library = env.SharedLibrary(preparser_library_name,
  4.1529 +                                          preparser_files,
  4.1530 +                                          PDB=preparser_pdb_name,
  4.1531 +                                          SONAME=preparser_soname)
  4.1532 +  context.library_targets.append(library)
  4.1533 +  context.library_targets.append(preparser_library)
  4.1534 +
  4.1535 +  context.ApplyEnvOverrides(d8_env)
  4.1536 +  if context.options['library'] == 'static':
  4.1537 +    shell = d8_env.Program('d8' + suffix, object_files + shell_files)
  4.1538 +  else:
  4.1539 +    shell = d8_env.Program('d8' + suffix, shell_files)
  4.1540 +    d8_env.Depends(shell, library)
  4.1541 +  context.d8_targets.append(shell)
  4.1542 +
  4.1543 +  for sample in context.samples:
  4.1544 +    sample_env = Environment(tools=tools)
  4.1545 +    sample_env.Replace(**context.flags['sample'])
  4.1546 +    sample_env.Prepend(LIBS=[library_name])
  4.1547 +    context.ApplyEnvOverrides(sample_env)
  4.1548 +    sample_object = sample_env.SConscript(
  4.1549 +      join('samples', 'SConscript'),
  4.1550 +      build_dir=join('obj', 'sample', sample, target_id),
  4.1551 +      exports='sample context tools',
  4.1552 +      duplicate=False
  4.1553 +    )
  4.1554 +    sample_name = sample + suffix
  4.1555 +    sample_program = sample_env.Program(sample_name, sample_object)
  4.1556 +    sample_env.Depends(sample_program, library)
  4.1557 +    context.sample_targets.append(sample_program)
  4.1558 +
  4.1559 +  cctest_env = env.Copy()
  4.1560 +  cctest_env.Prepend(LIBS=[library_name])
  4.1561 +  cctest_program = cctest_env.SConscript(
  4.1562 +    join('test', 'cctest', 'SConscript'),
  4.1563 +    build_dir=join('obj', 'test', target_id),
  4.1564 +    exports='context object_files tools',
  4.1565 +    duplicate=False
  4.1566 +  )
  4.1567 +  context.cctest_targets.append(cctest_program)
  4.1568 +
  4.1569 +  preparser_env = env.Copy()
  4.1570 +  preparser_env.Replace(**context.flags['preparser'])
  4.1571 +  preparser_env.Prepend(LIBS=[preparser_library_name])
  4.1572 +  context.ApplyEnvOverrides(preparser_env)
  4.1573 +  preparser_object = preparser_env.SConscript(
  4.1574 +    join('preparser', 'SConscript'),
  4.1575 +    build_dir=join('obj', 'preparser', target_id),
  4.1576 +    exports='context tools',
  4.1577 +    duplicate=False
  4.1578 +  )
  4.1579 +  preparser_name = join('obj', 'preparser', target_id, 'preparser')
  4.1580 +  preparser_program = preparser_env.Program(preparser_name, preparser_object);
  4.1581 +  preparser_env.Depends(preparser_program, preparser_library)
  4.1582 +  context.preparser_targets.append(preparser_program)
  4.1583 +
  4.1584 +  return context
  4.1585 +
  4.1586 +
  4.1587 +def Build():
  4.1588 +  opts = GetOptions()
  4.1589 +  tools = GetTools(opts)
  4.1590 +  env = Environment(options=opts, tools=tools)
  4.1591 +
  4.1592 +  Help(opts.GenerateHelpText(env))
  4.1593 +  VerifyOptions(env)
  4.1594 +  env_overrides = ParseEnvOverrides(env['env'], env['importenv'])
  4.1595 +
  4.1596 +  SourceSignatures(env['sourcesignatures'])
  4.1597 +
  4.1598 +  libraries = []
  4.1599 +  mksnapshots = []
  4.1600 +  cctests = []
  4.1601 +  samples = []
  4.1602 +  preparsers = []
  4.1603 +  d8s = []
  4.1604 +  modes = SplitList(env['mode'])
  4.1605 +  for mode in modes:
  4.1606 +    context = BuildSpecific(env.Copy(), mode, env_overrides, tools)
  4.1607 +    libraries += context.library_targets
  4.1608 +    mksnapshots += context.mksnapshot_targets
  4.1609 +    cctests += context.cctest_targets
  4.1610 +    samples += context.sample_targets
  4.1611 +    preparsers += context.preparser_targets
  4.1612 +    d8s += context.d8_targets
  4.1613 +
  4.1614 +  env.Alias('library', libraries)
  4.1615 +  env.Alias('mksnapshot', mksnapshots)
  4.1616 +  env.Alias('cctests', cctests)
  4.1617 +  env.Alias('sample', samples)
  4.1618 +  env.Alias('d8', d8s)
  4.1619 +  env.Alias('preparser', preparsers)
  4.1620 +
  4.1621 +  if env['sample']:
  4.1622 +    env.Default('sample')
  4.1623 +  else:
  4.1624 +    env.Default('library')
  4.1625 +
  4.1626 +  if env['cache']:
  4.1627 +    CacheDir(env['cache'])
  4.1628 +
  4.1629 +# We disable deprecation warnings because we need to be able to use
  4.1630 +# env.Copy without getting warnings for compatibility with older
  4.1631 +# version of scons.  Also, there's a bug in some revisions that
  4.1632 +# doesn't allow this flag to be set, so we swallow any exceptions.
  4.1633 +# Lovely.
  4.1634 +try:
  4.1635 +  SetOption('warn', 'no-deprecated')
  4.1636 +except:
  4.1637 +  pass
  4.1638 +
  4.1639 +Build()
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/node/stuff/SConstruct.patch	Thu Apr 24 18:16:37 2014 +0200
     5.3 @@ -0,0 +1,13 @@
     5.4 +--- deps/v8/SConstruct
     5.5 ++++ deps/v8/SConstruct
     5.6 +@@ -80,8 +80,8 @@
     5.7 +   },
     5.8 +   'gcc': {
     5.9 +     'all': {
    5.10 +-      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS'],
    5.11 +-      'CXXFLAGS':     ['-fno-rtti', '-fno-exceptions'],
    5.12 ++      'CCFLAGS':      ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv6'],
    5.13 ++      'CXXFLAGS':     ['-fno-rtti', '-fno-exceptions', '-march=armv6'],
    5.14 +     },
    5.15 +     'visibility:hidden': {
    5.16 +       # Use visibility=default to disable this.