From f55f478523af85550bed29b8680c21458db82286 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 4 Aug 2011 12:36:24 -0700 Subject: [PATCH] add deps/v8/build ??? --- deps/v8/build/README.txt | 66 ++++++++++++ deps/v8/build/all.gyp | 24 +++++ deps/v8/build/armu.gypi | 36 +++++++ deps/v8/build/common.gypi | 183 +++++++++++++++++++++++++++++++++ deps/v8/build/gyp_v8 | 173 +++++++++++++++++++++++++++++++ deps/v8/build/v8-features.gypi | 125 ++++++++++++++++++++++ 6 files changed, 607 insertions(+) create mode 100644 deps/v8/build/README.txt create mode 100644 deps/v8/build/all.gyp create mode 100644 deps/v8/build/armu.gypi create mode 100644 deps/v8/build/common.gypi create mode 100755 deps/v8/build/gyp_v8 create mode 100644 deps/v8/build/v8-features.gypi diff --git a/deps/v8/build/README.txt b/deps/v8/build/README.txt new file mode 100644 index 0000000000..c74b52051a --- /dev/null +++ b/deps/v8/build/README.txt @@ -0,0 +1,66 @@ +This directory contains the V8 GYP files used to generate actual project files +for different build systems. + +This is currently work in progress but this is expected to replace the SCons +based build system. + +To use this a checkout of GYP is needed inside this directory. From the root of +the V8 project do the following: + +$ svn co http://gyp.googlecode.com/svn/trunk build/gyp + +Note for the command lines below that Debug is the default configuration, +so specifying that on the command lines is not required. + + +To generate Makefiles on Linux: +------------------------------- + +$ build/gyp_v8 + +This will build makefiles for ia32, x64 and the ARM simulator with names +Makefile-ia32, Makefile-x64 and Makefile-armu respectively. + +To build and run for ia32 in debug and release version do: + +$ make -f Makefile-ia32 +$ out/Debug/shell +$ make -f Makefile-ia32 BUILDTYPE=Release +$ out/Release/shell + +Change the makefile to build and run for the other architectures. + + +To generate Xcode project files on Mac OS: +------------------------------------------ + +$ build/gyp_v8 + +This will make an Xcode project for the ia32 architecture. To build and run do: + +$ xcodebuild -project build/all.xcodeproj +$ samples/build/Debug/shell +$ xcodebuild -project build/all.xcodeproj -configuration Release +$ samples/build/Release/shell + + +To generate Visual Studio solution and project files on Windows: +---------------------------------------------------------------- + +On Windows an additional third party component is required. This is cygwin in +the same version as is used by the Chromium project. This can be checked out +from the Chromium repository. From the root of the V8 project do the following: + +> svn co http://src.chromium.org/svn/trunk/deps/third_party/cygwin@66844 third_party/cygwin + +To run GYP Python is required and it is reccomended to use the same version as +is used by the Chromium project. This can also be checked out from the Chromium +repository. From the root of the V8 project do the following: + +> svn co http://src.chromium.org/svn/trunk/tools/third_party/python_26@70627 third_party/python_26 + +Now generate Visual Studio solution and project files for the ia32 architecture: + +> third_party\python_26\python build/gyp_v8 + +Now open build\All.sln in Visual Studio. diff --git a/deps/v8/build/all.gyp b/deps/v8/build/all.gyp new file mode 100644 index 0000000000..38287e3628 --- /dev/null +++ b/deps/v8/build/all.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'All', + 'type': 'none', + 'dependencies': [ + '../samples/samples.gyp:*', + '../src/d8.gyp:d8', + ], + 'conditions': [ + [ 'component!="shared_library"', { + 'dependencies': [ + '../test/cctest/cctest.gyp:*', + ], + }] + ], + } + ] +} + diff --git a/deps/v8/build/armu.gypi b/deps/v8/build/armu.gypi new file mode 100644 index 0000000000..3f874c00f3 --- /dev/null +++ b/deps/v8/build/armu.gypi @@ -0,0 +1,36 @@ +# Copyright 2011 the V8 project authors. All rights reserved. +# 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. + +{ + 'variables': { + 'target_arch': 'ia32', + 'v8_target_arch': 'arm', + 'armv7': 1, + 'arm_neon': 0, + 'arm_fpu': 'vfpv3', + } +} diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi new file mode 100644 index 0000000000..702049581c --- /dev/null +++ b/deps/v8/build/common.gypi @@ -0,0 +1,183 @@ +# Copyright 2010 the V8 project authors. All rights reserved. +# 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. + +{ + 'variables': { + 'library%': 'static_library', + 'component%': 'static_library', + 'visibility%': 'hidden', + 'variables': { + 'conditions': [ + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + # This handles the Linux platforms we generally deal with. Anything + # else gets passed through, which probably won't work very well; such + # hosts should pass an explicit target_arch to gyp. + 'host_arch%': + ' 2: + specified_includes.add(os.path.realpath(arg[2:])) + + result = [] + def AddInclude(path): + if os.path.realpath(path) not in specified_includes: + result.append(path) + + # Always include common.gypi & features_override.gypi + AddInclude(os.path.join(script_dir, 'common.gypi')) + + # Optionally add supplemental .gypi files if present. + supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) + for supplement in supplements: + AddInclude(supplement) + + return result + + +def run_gyp(args): + rc = gyp.main(args) + if rc != 0: + print 'Error running GYP' + sys.exit(rc) + + +if __name__ == '__main__': + args = sys.argv[1:] + + if 'SKIP_V8_GYP_ENV' not in os.environ: + # Update the environment based on v8.gyp_env + gyp_env_path = os.path.join(os.path.dirname(v8_root), 'v8.gyp_env') + apply_gyp_environment(gyp_env_path) + + # This could give false positives since it doesn't actually do real option + # parsing. Oh well. + gyp_file_specified = False + for arg in args: + if arg.endswith('.gyp'): + gyp_file_specified = True + break + + # If we didn't get a file, check an env var, and then fall back to + # assuming 'all.gyp' from the same directory as the script. + if not gyp_file_specified: + gyp_file = os.environ.get('V8_GYP_FILE') + if gyp_file: + # Note that V8_GYP_FILE values can't have backslashes as + # path separators even on Windows due to the use of shlex.split(). + args.extend(shlex.split(gyp_file)) + else: + args.append(os.path.join(script_dir, 'all.gyp')) + + args.extend(['-I' + i for i in additional_include_files(args)]) + + # There shouldn't be a circular dependency relationship between .gyp files + args.append('--no-circular-check') + + # Set the GYP DEPTH variable to the root of the V8 project. + args.append('--depth=' + v8_root) + + # If V8_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check + # to enfore syntax checking. + syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK') + if syntax_check and int(syntax_check): + args.append('--check') + + print 'Updating projects from gyp files...' + sys.stdout.flush() + + # Generate for the architectures supported on the given platform. + gyp_args = list(args) + gyp_args.append('-Dtarget_arch=ia32') + if utils.GuessOS() == 'linux': + gyp_args.append('-S-ia32') + run_gyp(gyp_args) + + if utils.GuessOS() == 'linux': + gyp_args = list(args) + gyp_args.append('-Dtarget_arch=x64') + gyp_args.append('-S-x64') + run_gyp(gyp_args) + + gyp_args = list(args) + gyp_args.append('-I' + v8_root + '/build/armu.gypi') + gyp_args.append('-S-armu') + run_gyp(gyp_args) diff --git a/deps/v8/build/v8-features.gypi b/deps/v8/build/v8-features.gypi new file mode 100644 index 0000000000..40374523ad --- /dev/null +++ b/deps/v8/build/v8-features.gypi @@ -0,0 +1,125 @@ +# Copyright 2011 the V8 project authors. All rights reserved. +# 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. + +# TODO(sgjesse): This is currently copied from v8.gyp, should probably +# be refactored. +{ + 'variables': { + 'use_system_v8%': 0, + 'msvs_use_common_release': 0, + 'gcc_version%': 'unknown', + 'v8_compress_startup_data%': 'off', + 'v8_target_arch%': '<(target_arch)', + + # Setting 'v8_can_use_unaligned_accesses' to 'true' will allow the code + # generated by V8 to do unaligned memory access, and setting it to 'false' + # will ensure that the generated code will always do aligned memory + # accesses. The default value of 'default' will try to determine the correct + # setting. Note that for Intel architectures (ia32 and x64) unaligned memory + # access is allowed for all CPUs. + 'v8_can_use_unaligned_accesses%': 'default', + + # Setting 'v8_can_use_vfp_instructions' to 'true' will enable use of ARM VFP + # instructions in the V8 generated code. VFP instructions will be enabled + # both for the snapshot and for the ARM target. Leaving the default value + # of 'false' will avoid VFP instructions in the snapshot and use CPU feature + # probing when running on the target. + 'v8_can_use_vfp_instructions%': 'false', + + # Setting v8_use_arm_eabi_hardfloat to true will turn on V8 support for ARM + # EABI calling convention where double arguments are passed in VFP + # registers. Note that the GCC flag '-mfloat-abi=hard' should be used as + # well when compiling for the ARM target. + 'v8_use_arm_eabi_hardfloat%': 'false', + + 'v8_use_snapshot%': 'true', + 'host_os%': '<(OS)', + 'v8_use_liveobjectlist%': 'false', + }, + 'target_defaults': { + 'conditions': [ + ['OS!="mac"', { + 'conditions': [ + ['v8_target_arch=="arm"', { + 'defines': [ + 'V8_TARGET_ARCH_ARM', + ], + 'conditions': [ + [ 'v8_can_use_unaligned_accesses=="true"', { + 'defines': [ + 'CAN_USE_UNALIGNED_ACCESSES=1', + ], + }], + [ 'v8_can_use_unaligned_accesses=="false"', { + 'defines': [ + 'CAN_USE_UNALIGNED_ACCESSES=0', + ], + }], + [ 'v8_can_use_vfp_instructions=="true"', { + 'defines': [ + 'CAN_USE_VFP_INSTRUCTIONS', + ], + }], + [ 'v8_use_arm_eabi_hardfloat=="true"', { + 'defines': [ + 'USE_EABI_HARDFLOAT=1', + 'CAN_USE_VFP_INSTRUCTIONS', + ], + }], + ], + }], + ['v8_target_arch=="ia32"', { + 'defines': [ + 'V8_TARGET_ARCH_IA32', + ], + }], + ['v8_target_arch=="mips"', { + 'defines': [ + 'V8_TARGET_ARCH_MIPS', + ], + }], + ['v8_target_arch=="x64"', { + 'defines': [ + 'V8_TARGET_ARCH_X64', + ], + }], + ], + }], + ], + 'configurations': { + 'Debug': { + 'defines': [ + 'DEBUG', + '_DEBUG', + 'ENABLE_DISASSEMBLER', + 'V8_ENABLE_CHECKS', + 'OBJECT_PRINT', + ], + } + } + } +}