From f5ebcfed30678c0af52f597224d2df6ce5a14512 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 13:47:23 +0300 Subject: [PATCH 001/117] Bump v8 version to 3.27.23 --- lib/libv8/version.rb | 2 +- vendor/v8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 3e348b6e..f09ccf5a 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "3.16.14.3" + VERSION = "3.27.23.0" end diff --git a/vendor/v8 b/vendor/v8 index 7ce3fe10..ba3dd761 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit 7ce3fe106a37826dc23189a78dcb9000a1b3fa06 +Subproject commit ba3dd7611d984abde24c51051e95ff00f63edfca From b5a43944218450c600cc5f80f6ad9a37e5e37654 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 14:19:43 +0300 Subject: [PATCH 002/117] Remove unnecessary files from the gem --- libv8.gemspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libv8.gemspec b/libv8.gemspec index 4d000449..8ebd9921 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- $:.unshift File.expand_path("../lib", __FILE__) require "libv8/version" @@ -18,7 +17,7 @@ Gem::Specification.new do |s| s.files = `git ls-files`.split("\n") s.files += Dir.chdir("vendor/v8") do - `git ls-files`.split("\n").reject {|f| f =~ /^out/}.map {|f| "vendor/v8/#{f}"} + `git ls-files`.split("\n").reject {|f| f =~ /^out|^test|^benchmarks/}.map {|f| "vendor/v8/#{f}"} end s.files += Dir['vendor/v8/build/**/*'] s.files += Dir.chdir("vendor/gyp") do From c0c27e2bcde4aa1752ec7b689928e6cef0ea69ec Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 14:45:08 +0300 Subject: [PATCH 003/117] Bring patchset up to speed with 3.27.23 --- patches/arm/do-not-imply-vfp3-and-armv7.patch | 28 ------------------- patches/clang/no-unused-private-field.patch | 28 ------------------- ...n-types-and-unused-function-warnings.patch | 28 ------------------- patches/disable-building-tests.patch | 24 ++++++++-------- .../gcc48-wno-unused-local-typedefs.patch | 28 ------------------- 5 files changed, 12 insertions(+), 124 deletions(-) delete mode 100644 patches/arm/do-not-imply-vfp3-and-armv7.patch delete mode 100644 patches/clang/no-unused-private-field.patch delete mode 100644 patches/clang33/silence-nested-anon-types-and-unused-function-warnings.patch delete mode 100644 patches/gcc48/gcc48-wno-unused-local-typedefs.patch diff --git a/patches/arm/do-not-imply-vfp3-and-armv7.patch b/patches/arm/do-not-imply-vfp3-and-armv7.patch deleted file mode 100644 index 1030df9d..00000000 --- a/patches/arm/do-not-imply-vfp3-and-armv7.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/build/common.gypi b/build/common.gypi -index 3a59639..594abe4 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -173,7 +173,6 @@ - [ 'v8_use_arm_eabi_hardfloat=="true"', { - 'defines': [ - 'USE_EABI_HARDFLOAT=1', -- 'CAN_USE_VFP2_INSTRUCTIONS', - ], - 'target_conditions': [ - ['_toolset=="target"', { -diff --git a/build/standalone.gypi b/build/standalone.gypi -index 125c5bf..9900c5b 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -77,9 +77,9 @@ - }], - ], - # Default ARM variable settings. -- 'armv7%': 1, -+ 'armv7%': 0, - 'arm_neon%': 0, -- 'arm_fpu%': 'vfpv3', -+ 'arm_fpu%': 'vfp', - }, - 'target_defaults': { - 'default_configuration': 'Debug', diff --git a/patches/clang/no-unused-private-field.patch b/patches/clang/no-unused-private-field.patch deleted file mode 100644 index cf844323..00000000 --- a/patches/clang/no-unused-private-field.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/build/common.gypi b/build/common.gypi -index 3a59639..14bf0f9 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -376,7 +376,8 @@ - }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', -- '-Wnon-virtual-dtor', '-Woverloaded-virtual' ], -+ '-Wnon-virtual-dtor', '-Woverloaded-virtual', -+ '-Wno-unused-private-field' ], - }], - ['OS=="linux" and v8_enable_backtrace==1', { - # Support for backtrace_symbols. -diff --git a/build/standalone.gypi b/build/standalone.gypi -index 125c5bf..c8d9b4f 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -98,7 +98,8 @@ - 'target_defaults': { - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', - '-Wnon-virtual-dtor', '-pthread', '-fno-rtti', -- '-fno-exceptions', '-pedantic' ], -+ '-fno-exceptions', '-pedantic', -+ '-Wno-unused-private-field' ], - 'ldflags': [ '-pthread', ], - 'conditions': [ - [ 'OS=="linux"', { diff --git a/patches/clang33/silence-nested-anon-types-and-unused-function-warnings.patch b/patches/clang33/silence-nested-anon-types-and-unused-function-warnings.patch deleted file mode 100644 index b3957515..00000000 --- a/patches/clang33/silence-nested-anon-types-and-unused-function-warnings.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/build/common.gypi b/build/common.gypi -index 14bf0f9..301109a 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -377,7 +377,8 @@ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', - '-Wnon-virtual-dtor', '-Woverloaded-virtual', -- '-Wno-unused-private-field' ], -+ '-Wno-unused-private-field', '-Wno-nested-anon-types', -+ '-Wno-unused-function' ], - }], - ['OS=="linux" and v8_enable_backtrace==1', { - # Support for backtrace_symbols. -diff --git a/build/standalone.gypi b/build/standalone.gypi -index c8d9b4f..ddd1693 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -99,7 +99,8 @@ - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', - '-Wnon-virtual-dtor', '-pthread', '-fno-rtti', - '-fno-exceptions', '-pedantic', -- '-Wno-unused-private-field' ], -+ '-Wno-unused-private-field', '-Wno-nested-anon-types', -+ '-Wno-unused-function' ], - 'ldflags': [ '-pthread', ], - 'conditions': [ - [ 'OS=="linux"', { diff --git a/patches/disable-building-tests.patch b/patches/disable-building-tests.patch index a9f25552..cb53540d 100644 --- a/patches/disable-building-tests.patch +++ b/patches/disable-building-tests.patch @@ -1,25 +1,25 @@ diff --git a/Makefile b/Makefile -index 0cdae4b..2bf8aa5 100644 +index f49be61..89f0d47 100644 --- a/Makefile +++ b/Makefile -@@ -153,7 +153,7 @@ ANDROID_ARCHES = android_ia32 android_arm +@@ -227,7 +227,7 @@ NACL_ARCHES = nacl_ia32 nacl_x64 # List of files that trigger Makefile regeneration: - GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ - preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ + GYPFILES = build/all.gyp build/features.gypi build/standalone.gypi \ + build/toolchain.gypi samples/samples.gyp src/d8.gyp \ - test/cctest/cctest.gyp tools/gyp/v8.gyp + tools/gyp/v8.gyp - - # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". - BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) + + # If vtunejit=on, the v8vtune.gyp will be appended. + ifeq ($(vtunejit), on) diff --git a/build/all.gyp b/build/all.gyp -index 4b2fe52..9885678 100644 +index 3860379..176b60f 100644 --- a/build/all.gyp +++ b/build/all.gyp -@@ -11,7 +11,6 @@ - '../preparser/preparser.gyp:*', +@@ -10,7 +10,6 @@ + 'dependencies': [ '../samples/samples.gyp:*', '../src/d8.gyp:d8', - '../test/cctest/cctest.gyp:*', ], - } - ] + 'conditions': [ + ['component!="shared_library"', { diff --git a/patches/gcc48/gcc48-wno-unused-local-typedefs.patch b/patches/gcc48/gcc48-wno-unused-local-typedefs.patch deleted file mode 100644 index d45276da..00000000 --- a/patches/gcc48/gcc48-wno-unused-local-typedefs.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/build/common.gypi b/build/common.gypi -index 3a59639..365178a 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -376,7 +376,8 @@ - }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', -- '-Wnon-virtual-dtor', '-Woverloaded-virtual' ], -+ '-Wnon-virtual-dtor', '-Woverloaded-virtual', -+ '-Wno-unused-local-typedefs' ], - }], - ['OS=="linux" and v8_enable_backtrace==1', { - # Support for backtrace_symbols. -diff --git a/build/standalone.gypi b/build/standalone.gypi -index 125c5bf..32eaf85 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -98,7 +98,8 @@ - 'target_defaults': { - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', - '-Wnon-virtual-dtor', '-pthread', '-fno-rtti', -- '-fno-exceptions', '-pedantic' ], -+ '-fno-exceptions', '-pedantic', -+ '-Wno-unused-local-typedefs' ], - 'ldflags': [ '-pthread', ], - 'conditions': [ - [ 'OS=="linux"', { From 9eee9157a23007a64288557afd6260b83cfb454a Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 22:58:21 +0300 Subject: [PATCH 004/117] Add submodule dependencies and update v8 Add submodules for icu and Chrome's build tools and bump the v8 version to 3.27.23.1 --- .gitmodules | 6 ++++++ vendor/buildtools | 1 + vendor/icu46 | 1 + vendor/v8 | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 160000 vendor/buildtools create mode 160000 vendor/icu46 diff --git a/.gitmodules b/.gitmodules index 6d546b77..ab0c9ebd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,9 @@ [submodule "vendor/gyp"] path = vendor/gyp url = https://git.chromium.org/git/external/gyp.git +[submodule "vendor/icu46"] + path = vendor/icu46 + url = https://git.chromium.org/git/chromium/third_party/icu46.git +[submodule "vendor/buildtools"] + path = vendor/buildtools + url = https://chromium.googlesource.com/chromium/buildtools.git diff --git a/vendor/buildtools b/vendor/buildtools new file mode 160000 index 00000000..5d89977c --- /dev/null +++ b/vendor/buildtools @@ -0,0 +1 @@ +Subproject commit 5d89977ce55240995d1596fe420b818468f5ec37 diff --git a/vendor/icu46 b/vendor/icu46 new file mode 160000 index 00000000..44fc849c --- /dev/null +++ b/vendor/icu46 @@ -0,0 +1 @@ +Subproject commit 44fc849c472ba8bf2c0f97c8e9546a99f114c182 diff --git a/vendor/v8 b/vendor/v8 index ba3dd761..6697ebe5 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit ba3dd7611d984abde24c51051e95ff00f63edfca +Subproject commit 6697ebe51869512b3218451ab03540744a110b5d From 4ec06f82efc790421e0ad6ce0d45088d3249b1bd Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 23:54:32 +0300 Subject: [PATCH 005/117] Link v8 dependency dirs to submodule directories --- patches/link-dependencies.patch | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/link-dependencies.patch diff --git a/patches/link-dependencies.patch b/patches/link-dependencies.patch new file mode 100644 index 00000000..09c01e5c --- /dev/null +++ b/patches/link-dependencies.patch @@ -0,0 +1,22 @@ +diff --git a/Makefile b/Makefile +index f49be61..ad551e6 100644 +--- a/Makefile ++++ b/Makefile +@@ -463,13 +463,7 @@ gtags.clean: + # Dependencies. + # Remember to keep these in sync with the DEPS file. + dependencies: +- svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ +- --revision 1831 +- svn checkout --force \ +- https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \ +- third_party/icu --revision 258359 +- ( test -d buildtools || \ +- git clone https://chromium.googlesource.com/chromium/buildtools.git; \ +- cd buildtools; \ +- git fetch origin; \ +- git checkout 5d89977ce55240995d1596fe420b818468f5ec37 ) ++ ( test -h build/gyp || ln -s ../../gyp build/gyp ) ++ ( test -d third_party || mkdir third_party ) ++ ( test -h third_party/icu || ln -s ../../icu46 third_party/icu ) ++ ( test -h buildtools || ln -s ../buildtools ) From 62c010ac18e37d50bb9dfb5e5b9a7566ef83a752 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 23:55:23 +0300 Subject: [PATCH 006/117] Simplify checkout and patch processes --- ext/libv8/builder.rb | 12 +++--------- ext/libv8/patcher.rb | 35 ++--------------------------------- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 1ed8728a..63072108 100755 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -2,14 +2,12 @@ require File.expand_path '../compiler', __FILE__ require File.expand_path '../arch', __FILE__ require File.expand_path '../make', __FILE__ -require File.expand_path '../checkout', __FILE__ require File.expand_path '../patcher', __FILE__ module Libv8 class Builder include Libv8::Arch include Libv8::Make - include Libv8::Checkout include Libv8::Patcher def initialize @@ -42,12 +40,11 @@ def make_flags(*flags) end def build_libv8! - Dir.chdir(V8_Source) do + Dir.chdir('vendor/v8') do fail 'No compilers available' if @compiler.nil? - checkout! setup_python! + patch!(*patch_directories_for(@compiler)) setup_build_deps! - patch! *patch_directories_for(@compiler) print_build_info puts `env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}` end @@ -69,10 +66,7 @@ def setup_python! end def setup_build_deps! - # This uses the Git mirror of the svn repository used by - # "make dependencies", instead of calling that make target - `rm -rf build/gyp` - `ln -fs #{GYP_Source} build/gyp` + `make dependencies` end private diff --git a/ext/libv8/patcher.rb b/ext/libv8/patcher.rb index 001eed07..d258b8f7 100644 --- a/ext/libv8/patcher.rb +++ b/ext/libv8/patcher.rb @@ -4,44 +4,13 @@ module Patcher module_function - def patch_directories_for(compiler) - patch_directories = [] - - case - when compiler.target =~ /arm/ - patch_directories << 'arm' - end - - case compiler - when Compiler::GCC - patch_directories << 'gcc48' if compiler.version >= '4.8' - when Compiler::Clang - patch_directories << 'clang' - patch_directories << 'clang33' if compiler.version >= '3.3' - end - - patch_directories - end - - def patch_directories(*additional_directories) - absolute_paths = [PATCH_DIRECTORY] - - additional_directories.each do |directory| - absolute_paths << File.join(PATCH_DIRECTORY, directory) - end - - absolute_paths.uniq - end - def patches(*additional_directories) - patch_directories(*additional_directories).map do |directory| - Dir.glob(File.join directory, '*.patch') - end.flatten.sort + Dir.glob(File.join 'patches', '*.patch') end def patch!(*additional_directories) File.open(".applied_patches", File::RDWR|File::CREAT) do |f| - available_patches = patches *additional_directories + available_patches = patches applied_patches = f.readlines.map(&:chomp) (available_patches - applied_patches).each do |patch| From 1a4c478271b7fc4154e2347daf5622c65ed0a998 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 23:56:06 +0300 Subject: [PATCH 007/117] GCC 4.9 is a supported compiler --- ext/libv8/compiler/gcc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/compiler/gcc.rb b/ext/libv8/compiler/gcc.rb index e2cb041e..937321bc 100644 --- a/ext/libv8/compiler/gcc.rb +++ b/ext/libv8/compiler/gcc.rb @@ -8,7 +8,7 @@ def name end def compatible? - version > '4.3' and version < '4.9' + version > '4.3' and version < '5' end end end From f7e706e680aa79059f0df8e4756f62a33a2d367c Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 10 Jun 2014 23:56:25 +0300 Subject: [PATCH 008/117] Silence warnings --- ext/libv8/compiler.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index ee18bcb9..c6b0f765 100755 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -15,11 +15,11 @@ module Compiler module_function def system_compilers - available_compilers *Compiler::KNOWN_COMPILERS + available_compilers(*Compiler::KNOWN_COMPILERS) end def available_compilers(*compiler_names) - compiler_paths = compiler_names.map { |name| find name }.reject &:nil? + compiler_names.map { |name| find name }.reject(&:nil?) end def find(name) From 3c143f8b5bd7d6c1a2c950501c243f6d33f84ec7 Mon Sep 17 00:00:00 2001 From: ignisf Date: Wed, 11 Jun 2014 00:29:14 +0300 Subject: [PATCH 009/117] Specify the correct directory for the patches --- ext/libv8/builder.rb | 2 +- ext/libv8/patcher.rb | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 63072108..9989467f 100755 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -43,7 +43,7 @@ def build_libv8! Dir.chdir('vendor/v8') do fail 'No compilers available' if @compiler.nil? setup_python! - patch!(*patch_directories_for(@compiler)) + patch! setup_build_deps! print_build_info puts `env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}` diff --git a/ext/libv8/patcher.rb b/ext/libv8/patcher.rb index d258b8f7..66dc8459 100644 --- a/ext/libv8/patcher.rb +++ b/ext/libv8/patcher.rb @@ -4,18 +4,15 @@ module Patcher module_function - def patches(*additional_directories) - Dir.glob(File.join 'patches', '*.patch') - end - - def patch!(*additional_directories) + def patch! File.open(".applied_patches", File::RDWR|File::CREAT) do |f| - available_patches = patches + available_patches = Dir.glob(File.join(PATCH_DIRECTORY, '*.patch')) applied_patches = f.readlines.map(&:chomp) (available_patches - applied_patches).each do |patch| `patch -p1 -N < #{patch}` f.puts patch + puts "Applying #{patch}" end end end From 7622b9d54e47631b36df856ffc4baf1a2b4a78b9 Mon Sep 17 00:00:00 2001 From: ignisf Date: Wed, 11 Jun 2014 00:29:32 +0300 Subject: [PATCH 010/117] Route build warnings to stdout --- ext/libv8/builder.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 9989467f..a738ca79 100755 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -46,7 +46,8 @@ def build_libv8! patch! setup_build_deps! print_build_info - puts `env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}` + puts 'Beginning compilation. This will take some time.' + puts `env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags} 2>&1` end return $?.exitstatus end From 44b4e40efc41f238acdf622e5d3e34b2113a047f Mon Sep 17 00:00:00 2001 From: ignisf Date: Wed, 11 Jun 2014 00:37:17 +0300 Subject: [PATCH 011/117] Update Travis configuration Add REE, Ruby 2.1.2 and Rubinius 2 --- .travis.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e056ee9e..69fbcf94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,16 @@ rvm: - 2.0.0 - - 2.1.0 + - 2.1.2 - 1.9.3 - - rbx-2.1.1 - - rbx-2.2.1 + - rbx-2 + - ree +matrix: + allow_failures: + - rvm: ree notifications: recipients: - cowboyd@thefrontside.net - bordjukov@gmail.com before_install: - sudo apt-get update - - sudo apt-get install git-svn \ No newline at end of file + - sudo apt-get install git-svn From 3cc23404af308ab2a7666948562862b3267209de Mon Sep 17 00:00:00 2001 From: ignisf Date: Wed, 11 Jun 2014 11:37:24 +0300 Subject: [PATCH 012/117] Bump v8 to 3.27.24 --- lib/libv8/version.rb | 2 +- vendor/v8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index f09ccf5a..0ccf5c0d 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "3.27.23.0" + VERSION = "3.27.24.0" end diff --git a/vendor/v8 b/vendor/v8 index 6697ebe5..3e283f44 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit 6697ebe51869512b3218451ab03540744a110b5d +Subproject commit 3e283f444dfd2ffd4550f7c726888f427ec0a0ab From 108c3c7f267d120c4274144ff4e51cc58b4580bb Mon Sep 17 00:00:00 2001 From: ignisf Date: Wed, 11 Jun 2014 11:36:03 +0300 Subject: [PATCH 013/117] Remove git-svn from Travis configuration --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 69fbcf94..921e11ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,4 @@ notifications: - cowboyd@thefrontside.net - bordjukov@gmail.com before_install: - - sudo apt-get update - - sudo apt-get install git-svn + - sudo apt-get update \ No newline at end of file From 68fca9a7bf42b5f2cdbfbe4d820bc926ba6211df Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 12:06:53 +0300 Subject: [PATCH 014/117] Add new submodules to the clean task --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 91c7a0ee..ec3fa411 100644 --- a/Rakefile +++ b/Rakefile @@ -73,8 +73,8 @@ desc "clean up artifacts of the build" task :clean do sh "rm -rf pkg" sh "git clean -df" - sh "cd #{V8_Source} && git checkout -f && git clean -dxf" - sh "cd #{GYP_Source} && git checkout -f && git clean -dxf" + sh "git submodule foreach git reset --hard" + sh "git submodule foreach git clean -df" end desc "build a binary on heroku (you must have vulcan configured for this)" From 8170ba38d7ccc039c70f3d580fbf2795217de0f1 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 12:11:08 +0300 Subject: [PATCH 015/117] Bump v8 to 3.27.28 --- lib/libv8/version.rb | 2 +- vendor/v8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 0ccf5c0d..88b689dc 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "3.27.24.0" + VERSION = "3.27.28.0" end diff --git a/vendor/v8 b/vendor/v8 index 3e283f44..be6486f6 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit 3e283f444dfd2ffd4550f7c726888f427ec0a0ab +Subproject commit be6486f6d475c58b2f61607bdb7b54efc505281e From 62522777fdad9f371bc7e2fef02cdf60579de168 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 12:26:44 +0300 Subject: [PATCH 016/117] Simplify Rakefile --- Rakefile | 63 +++++++++++++-------------------------------------- libv8.gemspec | 2 -- 2 files changed, 16 insertions(+), 49 deletions(-) diff --git a/Rakefile b/Rakefile index ec3fa411..589d0529 100644 --- a/Rakefile +++ b/Rakefile @@ -1,23 +1,20 @@ require 'bundler/setup' -Bundler::GemHelper.install_tasks -class Bundler::GemHelper - def clean? - sh_with_code('git diff --exit-code --ignore-submodules')[1] == 0 - end -end - require 'rspec/core/rake_task' + +Bundler::GemHelper.install_tasks RSpec::Core::RakeTask.new(:spec) -require File.expand_path '../ext/libv8/make.rb', __FILE__ -require File.expand_path '../ext/libv8/checkout.rb', __FILE__ -include Libv8::Make -include Libv8::Checkout +module Helpers + module_function + def get_binary_gemspec(platform = RUBY_PLATFORM) + gemspec = eval(File.read('libv8.gemspec')) + gemspec.platform = Gem::Platform.new(platform) + gemspec + end -desc "setup the vendored v8 source to correspond to the libv8 gem version" -task :checkout do - sh "git submodule update --init" - checkout! + def binary_gem_name + File.basename get_binary_gemspec.cache_file + end end desc "compile v8 via the ruby extension mechanism" @@ -25,30 +22,9 @@ task :compile do sh "ruby ext/libv8/extconf.rb" end -desc "manually invoke the GYP compile. Useful for seeing debug output" -task :manual_compile do - require File.expand_path '../ext/libv8/arch.rb', __FILE__ - include Libv8::Arch - Dir.chdir(V8_Source) do - sh %Q{#{make} -j2 #{libv8_arch}.release ARFLAGS.target=crs} - end -end - -def get_binary_gemspec(platform = RUBY_PLATFORM) - gemspec = eval(File.read('libv8.gemspec')) - gemspec.platform = Gem::Platform.new(platform) - gemspec -end - -begin - binary_gem_name = File.basename get_binary_gemspec.cache_file -rescue - binary_gem_name = '' -end - -desc "build a binary gem #{binary_gem_name}" +desc "build a binary gem #{Helpers.binary_gem_name}" task :binary => :compile do - gemspec = get_binary_gemspec + gemspec = Helpers.get_binary_gemspec gemspec.extensions.clear # We don't need most things for the binary gemspec.files = [] @@ -77,12 +53,5 @@ task :clean do sh "git submodule foreach git clean -df" end -desc "build a binary on heroku (you must have vulcan configured for this)" -task :vulcan => directory("tmp/vulcan") do - Dir.chdir('tmp/vulcan') do - sh "vulcan build -v -c 'LANG=en_US.UTF-8 export BIN=/`pwd`/bin && export GEM=$BIN/gem && curl https://s3.amazonaws.com/heroku-buildpack-ruby/ruby-1.9.3.tgz > ruby-1.9.3.tgz && tar xf ruby-1.9.3.tgz && cd /tmp && $GEM fetch libv8 --platform=ruby --version=#{Libv8::VERSION} && $GEM unpack libv8*.gem && $GEM install bundler -n $BIN --no-ri --no-rdoc && cd libv8-#{Libv8::VERSION} && $BIN/bundle && $BIN/bundle exec rake binary' -p /tmp/libv8-#{Libv8::VERSION}" - end -end - -task :default => [:checkout, :compile, :spec] -task :build => [:clean, :checkout] +task :default => [:compile, :spec] +task :build => [:clean] diff --git a/libv8.gemspec b/libv8.gemspec index 8ebd9921..74ca21b1 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -14,7 +14,6 @@ Gem::Specification.new do |s| s.rubyforge_project = "libv8" - s.files = `git ls-files`.split("\n") s.files += Dir.chdir("vendor/v8") do `git ls-files`.split("\n").reject {|f| f =~ /^out|^test|^benchmarks/}.map {|f| "vendor/v8/#{f}"} @@ -32,5 +31,4 @@ Gem::Specification.new do |s| s.add_development_dependency "rspec" s.add_development_dependency "rspec-spies" s.add_development_dependency "rubysl", "~> 2.0" if RUBY_ENGINE == "rbx" - s.add_development_dependency "vulcan" end From d198236e9439299f885792fba951fae3ce61e5c4 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 12:49:19 +0300 Subject: [PATCH 017/117] Attempt to work around 10 minute Travis build limit --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 921e11ff..6bb7fc0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +language: ruby rvm: - 2.0.0 - 2.1.2 @@ -7,9 +8,10 @@ rvm: matrix: allow_failures: - rvm: ree +script: + - travis_wait bundle exec rake notifications: recipients: - cowboyd@thefrontside.net - bordjukov@gmail.com -before_install: - - sudo apt-get update \ No newline at end of file +cache: bundler \ No newline at end of file From 1ba8077c7868a020ad2c76e7845de3428a996300 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 13:15:22 +0300 Subject: [PATCH 018/117] Remove unused checkout logic --- ext/libv8/builder.rb | 0 ext/libv8/checkout.rb | 48 ------------------------------------------- ext/libv8/compiler.rb | 0 3 files changed, 48 deletions(-) mode change 100755 => 100644 ext/libv8/builder.rb delete mode 100644 ext/libv8/checkout.rb mode change 100755 => 100644 ext/libv8/compiler.rb diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb old mode 100755 new mode 100644 diff --git a/ext/libv8/checkout.rb b/ext/libv8/checkout.rb deleted file mode 100644 index 71a53086..00000000 --- a/ext/libv8/checkout.rb +++ /dev/null @@ -1,48 +0,0 @@ -require File.expand_path '../../../lib/libv8/version.rb', __FILE__ - -module Libv8 - module Checkout - module_function - - GYP_SVN = 'http://gyp.googlecode.com/svn' - V8_Source = File.expand_path '../../../vendor/v8', __FILE__ - GYP_Source = File.expand_path '../../../vendor/gyp', __FILE__ - - def checkout! - # When compiling from a source gem, it's not a git repository anymore and - # we assume the right code is already checked out. - return unless git?(V8_Source) - - Dir.chdir(V8_Source) do - `git fetch` - `git checkout #{Libv8::VERSION.gsub(/\.\d+$/,'')} -f` - `rm -f .applied_patches` - end - - return unless git?(GYP_Source) - - check_git_svn! - - Dir.chdir(GYP_Source) do - mkf = File.readlines(File.join(V8_Source, 'Makefile')) - idx = mkf.index {|l| l =~ /#{GYP_SVN}/} + 1 - rev = /--revision (\d+)/.match(mkf[idx])[1] - `git fetch` - # --git-dir is needed for older versions of git and git-svn - `git --git-dir=../../.git/modules/vendor/gyp/ svn init #{GYP_SVN} -Ttrunk` - `git config --replace-all svn-remote.svn.fetch trunk:refs/remotes/origin/master` - `git checkout $(git --git-dir=../../.git/modules/vendor/gyp/ svn find-rev r#{rev} | tail -n 1) -f` - end - end - - def git?(dir) - File.exists?(File.join(dir, '.git')) - end - - def check_git_svn! - unless system 'git help svn 2>&1 > /dev/null' - fail "git-svn not installed!\nPlease install git-svn." - end - end - end -end diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb old mode 100755 new mode 100644 From 0e9aa5293adab7aca6ba38707656b262b5364245 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 13:32:45 +0300 Subject: [PATCH 019/117] Cosmetic changes to the Rakefile --- Rakefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 589d0529..8e310d2f 100644 --- a/Rakefile +++ b/Rakefile @@ -6,14 +6,14 @@ RSpec::Core::RakeTask.new(:spec) module Helpers module_function - def get_binary_gemspec(platform = RUBY_PLATFORM) + def binary_gemspec(platform = RUBY_PLATFORM) gemspec = eval(File.read('libv8.gemspec')) gemspec.platform = Gem::Platform.new(platform) gemspec end def binary_gem_name - File.basename get_binary_gemspec.cache_file + File.basename binary_gemspec.cache_file end end @@ -24,24 +24,29 @@ end desc "build a binary gem #{Helpers.binary_gem_name}" task :binary => :compile do - gemspec = Helpers.get_binary_gemspec + gemspec = Helpers.binary_gemspec gemspec.extensions.clear + # We don't need most things for the binary gemspec.files = [] gemspec.files += ['lib/libv8.rb', 'lib/libv8/version.rb'] gemspec.files += ['ext/libv8/arch.rb', 'ext/libv8/location.rb', 'ext/libv8/paths.rb'] gemspec.files += ['ext/libv8/.location.yml'] + # V8 gemspec.files += Dir['vendor/v8/include/*'] gemspec.files += Dir['vendor/v8/out/**/*.a'] + FileUtils.chmod 'a+r', gemspec.files FileUtils.mkdir_p 'pkg' + package = if Gem::VERSION < '2.0.0' Gem::Builder.new(gemspec).build else require 'rubygems/package' Gem::Package.build(gemspec) end + FileUtils.mv(package, 'pkg') end From 3034f80c51d175024cc5e6131b6cd3bda2068fb3 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sat, 14 Jun 2014 13:40:42 +0300 Subject: [PATCH 020/117] Run bundle install concurrently on Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6bb7fc0c..a49643cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ rvm: matrix: allow_failures: - rvm: ree +bundler_args: -j4 script: - travis_wait bundle exec rake notifications: From 80a8dc04f3a640d741d8c7de402d9ac731af435a Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 11:58:20 +0300 Subject: [PATCH 021/117] Refactor the compiler detection module --- ext/libv8/compiler.rb | 39 ++++++++++++++++++-------- spec/compiler_spec.rb | 64 +++++++++++++++++++++++++++++++++++++++++++ spec/spec_helper.rb | 38 +++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 spec/compiler_spec.rb diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index c6b0f765..fd9bfb88 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -19,24 +19,39 @@ def system_compilers end def available_compilers(*compiler_names) - compiler_names.map { |name| find name }.reject(&:nil?) + available = compiler_names.select { |compiler_name| available? compiler_name } + available.map { |compiler_name| type_of(compiler_name).new compiler_name } end - def find(name) - return nil if name.empty? - path, _, status = Open3.capture3 "which #{name}" - path.chomp! - determine_type(path).new(path) if status.success? - end - - def determine_type(compiler_path) - compiler_version = Open3.capture3("#{compiler_path} -v")[0..1].join - - case compiler_version + def type_of(compiler_name) + case version_string_of(compiler_name) when /\bclang\b/i then Clang when /^gcc/i then GCC else GenericCompiler end end + + def version_string_of(compiler_name) + command_result = execute_command "#{compiler_name} -v 2>&1" + + unless command_result.status.success? + raise "Could not get version string of compiler #{compiler_name}" + end + + command_result.output + end + + def available?(command) + execute_command("which #{command} 2>&1").status.success? + end + + def execute_command(command) + output = `#{command}` + status = $? + ExecutionResult.new output, status + end + + class ExecutionResult < Struct.new(:output, :status) + end end end diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb new file mode 100644 index 00000000..36ecffaa --- /dev/null +++ b/spec/compiler_spec.rb @@ -0,0 +1,64 @@ +$:.unshift File.expand_path '../../ext/libv8', __FILE__ + +require 'spec_helper' +require 'compiler' + +RSpec.configure do |c| + c.include CompilerHelpers +end + +module Libv8 + describe Compiler do + describe '::type_of' do + it 'returns a GCC class for GCC 4.9.0' do + stub_as_available 'c++', :gcc, '4.9.0' + Compiler.available_compilers('c++').first.should be_a Compiler::GCC + end + + it 'returns a Clang class for Clang 3.4.1' do + stub_as_available 'c++', :clang, '3.4.1' + Compiler.available_compilers('c++').first.should be_a Compiler::Clang + end + end + + describe '::available_compilers' do + it 'returns instances of the available compilers' do + stub_as_available 'c++', :clang, '3.4.1' + stub_as_unavailable 'g++' + stub_as_available 'clang++', :clang, '3.4.1' + + available_compilers = Compiler.available_compilers 'c++', 'g++', 'clang++' + available_compilers.map(&:class).should have(2).items + available_compilers.all? { |compiler| compiler.should be_a Compiler::Clang } + end + end + + describe '::version_string_of' do + context 'when calling the compiler command succedes' do + it 'returns the version string of the compiler' do + stub_as_available 'c++', :clang, '3.4.1' + Compiler.version_string_of('c++').should eq version_output_of(:clang, '3.4.1') + end + end + + context 'when calling the compiler command fails' do + it 'raises an exception' do + stub_as_unavailable 'c++' + expect { Compiler.version_string_of('c++') }.to raise_exception + end + end + end + + describe '::available?' do + it 'returns true when the command is available' do + stub_as_available 'c++', :clang, '3.4.1' + Compiler::available?('c++').should be_true + end + + it 'returns false when the command cannot be found ' do + stub_as_unavailable 'c++' + Compiler::available?('c++').should be_false + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9e6d775c..986cc5a4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,3 +2,41 @@ require 'rspec' require 'rspec-spies' require 'libv8' + +module CompilerHelpers + VERSION_OUTPUTS = { + :gcc => { + "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n} + }, + :clang => { + "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n} + } + } + + def version_output_of(name, version) + VERSION_OUTPUTS[name][version] + end + + def success_status + double success?: true + end + + def failure_status + double success?: false + end + + def stub_shell_command(command, output, status) + allow(Libv8::Compiler).to receive(:execute_command).with(command) do + double output: output, status: status + end + end + + def stub_as_available(command, name, version) + stub_shell_command "which #{command} 2>&1", '', success_status + stub_shell_command "#{command} -v 2>&1", version_output_of(name, version), success_status + end + + def stub_as_unavailable(command) + stub_shell_command "which #{command} 2>&1", '', failure_status + end +end From 4a0b861fb3c76f52f43c09becd18e27a72b65951 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 13:19:13 +0300 Subject: [PATCH 022/117] Add specs for the compiler classes --- ext/libv8/compiler/clang.rb | 2 +- ext/libv8/compiler/gcc.rb | 2 +- ext/libv8/compiler/generic_compiler.rb | 14 +++---- spec/compiler/clang_spec.rb | 46 +++++++++++++++++++++ spec/compiler/gcc_spec.rb | 43 ++++++++++++++++++++ spec/compiler/generic_compiler_spec.rb | 56 ++++++++++++++++++++++++++ spec/spec_helper.rb | 6 ++- 7 files changed, 159 insertions(+), 10 deletions(-) create mode 100644 spec/compiler/clang_spec.rb create mode 100644 spec/compiler/gcc_spec.rb create mode 100644 spec/compiler/generic_compiler_spec.rb diff --git a/ext/libv8/compiler/clang.rb b/ext/libv8/compiler/clang.rb index da84878f..c482bce8 100644 --- a/ext/libv8/compiler/clang.rb +++ b/ext/libv8/compiler/clang.rb @@ -8,7 +8,7 @@ def name end def compatible? - version >= '3.1' + version >= '3.1' unless version.nil? end end end diff --git a/ext/libv8/compiler/gcc.rb b/ext/libv8/compiler/gcc.rb index 937321bc..649ac038 100644 --- a/ext/libv8/compiler/gcc.rb +++ b/ext/libv8/compiler/gcc.rb @@ -8,7 +8,7 @@ def name end def compatible? - version > '4.3' and version < '5' + version > '4.3' unless version.nil? end end end diff --git a/ext/libv8/compiler/generic_compiler.rb b/ext/libv8/compiler/generic_compiler.rb index f47bf9b5..72895319 100644 --- a/ext/libv8/compiler/generic_compiler.rb +++ b/ext/libv8/compiler/generic_compiler.rb @@ -4,25 +4,25 @@ class GenericCompiler VERSION_REGEXP = /(\d+\.\d+(\.\d+)*)/ TARGET_REGEXP = /Target: ([a-z0-9\-_.]*)/ - def initialize(path) - @path = path + def initialize(command) + @command = command end def name - File.basename @path + File.basename @command end def to_s - @path + @command end def version - call('-v')[0..1].join =~ VERSION_REGEXP + call('-v').output =~ VERSION_REGEXP $1 end def target - call('-v')[0..1].join =~ TARGET_REGEXP + call('-v').output =~ TARGET_REGEXP $1 end @@ -31,7 +31,7 @@ def compatible? end def call(*arguments) - Open3.capture3 arguments.unshift(@path).join(' ') + Compiler::execute_command arguments.unshift(@command).push('2>&1').join(' ') end end end diff --git a/spec/compiler/clang_spec.rb b/spec/compiler/clang_spec.rb new file mode 100644 index 00000000..ab3757bc --- /dev/null +++ b/spec/compiler/clang_spec.rb @@ -0,0 +1,46 @@ +$:.unshift File.expand_path '../../../ext/libv8', __FILE__ + +require 'spec_helper' +require 'compiler' + +RSpec.configure do |c| + c.include CompilerHelpers +end + +module Libv8::Compiler + describe Clang do + subject { Clang.new 'c++' } + + describe '#name' do + it 'returns clang' do + subject.name.should eq 'clang' + end + end + + describe '#version' do + it 'returns the version of the compiler' do + stub_as_available 'c++', :clang, '3.4.1' + subject.version.should eq '3.4.1' + end + end + + describe '#compatible?' do + context 'when clang\'s version is >= 3.1' do + it 'returns true' do + stub_as_available 'c++', :clang, '3.4.1' + subject.compatible?.should be_true + + stub_as_available 'c++', :clang, '3.10.0' + subject.compatible?.should be_true + end + end + + context 'when clang\'s version is < 3.1' do + it 'returns false' do + stub_as_available 'c++', :clang, '3.0.0' + subject.compatible?.should be_false + end + end + end + end +end diff --git a/spec/compiler/gcc_spec.rb b/spec/compiler/gcc_spec.rb new file mode 100644 index 00000000..59f15182 --- /dev/null +++ b/spec/compiler/gcc_spec.rb @@ -0,0 +1,43 @@ +$:.unshift File.expand_path '../../../ext/libv8', __FILE__ + +require 'spec_helper' +require 'compiler' + +RSpec.configure do |c| + c.include CompilerHelpers +end + +module Libv8::Compiler + describe GCC do + subject { GCC.new 'c++' } + + describe '#name' do + it 'returns GCC' do + subject.name.should eq 'GCC' + end + end + + describe '#version' do + it 'returns the version of the compiler' do + stub_as_available 'c++', :gcc, '4.9.0' + subject.version.should eq '4.9.0' + end + end + + describe '#compatible?' do + context 'when GCC\'s version is >= 4.3' do + it 'returns true' do + stub_as_available 'c++', :gcc, '4.9.0' + subject.compatible?.should be_true + end + end + + context 'when GCC\'s version is < 4.3' do + it 'returns false' do + stub_as_available 'c++', :gcc, '4.2.1-freebsd' + subject.compatible?.should be_false + end + end + end + end +end diff --git a/spec/compiler/generic_compiler_spec.rb b/spec/compiler/generic_compiler_spec.rb new file mode 100644 index 00000000..d2146872 --- /dev/null +++ b/spec/compiler/generic_compiler_spec.rb @@ -0,0 +1,56 @@ +$:.unshift File.expand_path '../../../ext/libv8', __FILE__ + +require 'spec_helper' +require 'compiler' + +RSpec.configure do |c| + c.include CompilerHelpers +end + +module Libv8::Compiler + describe GenericCompiler do + subject { GenericCompiler.new 'c++' } + + describe '#name' do + it 'returns just the base name of the command' do + GenericCompiler.new('/usr/sbin/c++').name.should eq 'c++' + end + end + + describe '#to_s' do + it 'should be the command used to call the compiler' do + subject.to_s.should eq 'c++' + end + end + + describe '#version' do + it 'returns the version of the compiler' do + stub_as_available 'c++', :clang, '3.4.1' + subject.version.should eq '3.4.1' + end + + it 'returns nil when determining the version fails' do + stub_as_unavailable 'c++' + subject.version.should be_nil + end + end + + describe '#target' do + it 'returns the target of the compiler' do + stub_as_available 'c++', :clang, '3.4.1' + subject.target.should eq 'x86_64-unknown-linux-gnu' + end + + it 'returns nil when determining the target fails' do + stub_as_unavailable 'c++' + subject.target.should be_nil + end + end + + describe '#compatible?' do + it 'returns false' do + GenericCompiler.new('c++').compatible?.should be_false + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 986cc5a4..9e6e51c1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,10 +6,13 @@ module CompilerHelpers VERSION_OUTPUTS = { :gcc => { + "4.2.1-freebsd" => %Q{Using built-in specs.\nTarget: i386-undermydesk-freebsd\nConfigured with: FreeBSD/i386 system compiler\nThread model: posix\ngcc version 4.2.1 20070831 patched [FreeBSD]\n}, "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n} }, :clang => { - "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n} + "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n}, + "3.10.0" => %Q{clang version 3.10.0 (tags/RELEASE_310/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n}, + "3.0.0" => %Q{clang version 3.0.0 (tags/RELEASE_30/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n} } } @@ -38,5 +41,6 @@ def stub_as_available(command, name, version) def stub_as_unavailable(command) stub_shell_command "which #{command} 2>&1", '', failure_status + stub_shell_command(/^#{command}/, '', failure_status) end end From ac4ea1209f605d35c4f27baa13421f5e6f41affa Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 13:29:53 +0300 Subject: [PATCH 023/117] Extract the CompilerHelpers module to spec/support --- spec/compiler/clang_spec.rb | 6 ---- spec/compiler/gcc_spec.rb | 6 ---- spec/compiler/generic_compiler_spec.rb | 6 ---- spec/compiler_spec.rb | 6 ---- spec/spec_helper.rb | 44 ++----------------------- spec/support/compiler_helpers.rb | 45 ++++++++++++++++++++++++++ 6 files changed, 47 insertions(+), 66 deletions(-) create mode 100644 spec/support/compiler_helpers.rb diff --git a/spec/compiler/clang_spec.rb b/spec/compiler/clang_spec.rb index ab3757bc..78aca837 100644 --- a/spec/compiler/clang_spec.rb +++ b/spec/compiler/clang_spec.rb @@ -1,12 +1,6 @@ -$:.unshift File.expand_path '../../../ext/libv8', __FILE__ - require 'spec_helper' require 'compiler' -RSpec.configure do |c| - c.include CompilerHelpers -end - module Libv8::Compiler describe Clang do subject { Clang.new 'c++' } diff --git a/spec/compiler/gcc_spec.rb b/spec/compiler/gcc_spec.rb index 59f15182..689f53bf 100644 --- a/spec/compiler/gcc_spec.rb +++ b/spec/compiler/gcc_spec.rb @@ -1,12 +1,6 @@ -$:.unshift File.expand_path '../../../ext/libv8', __FILE__ - require 'spec_helper' require 'compiler' -RSpec.configure do |c| - c.include CompilerHelpers -end - module Libv8::Compiler describe GCC do subject { GCC.new 'c++' } diff --git a/spec/compiler/generic_compiler_spec.rb b/spec/compiler/generic_compiler_spec.rb index d2146872..9f64937c 100644 --- a/spec/compiler/generic_compiler_spec.rb +++ b/spec/compiler/generic_compiler_spec.rb @@ -1,12 +1,6 @@ -$:.unshift File.expand_path '../../../ext/libv8', __FILE__ - require 'spec_helper' require 'compiler' -RSpec.configure do |c| - c.include CompilerHelpers -end - module Libv8::Compiler describe GenericCompiler do subject { GenericCompiler.new 'c++' } diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb index 36ecffaa..e0a58f16 100644 --- a/spec/compiler_spec.rb +++ b/spec/compiler_spec.rb @@ -1,12 +1,6 @@ -$:.unshift File.expand_path '../../ext/libv8', __FILE__ - require 'spec_helper' require 'compiler' -RSpec.configure do |c| - c.include CompilerHelpers -end - module Libv8 describe Compiler do describe '::type_of' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9e6e51c1..c1f87182 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,46 +1,6 @@ +$:.unshift File.expand_path '../../ext/libv8', __FILE__ $:.unshift File.expand_path '../../lib', __FILE__ require 'rspec' require 'rspec-spies' require 'libv8' - -module CompilerHelpers - VERSION_OUTPUTS = { - :gcc => { - "4.2.1-freebsd" => %Q{Using built-in specs.\nTarget: i386-undermydesk-freebsd\nConfigured with: FreeBSD/i386 system compiler\nThread model: posix\ngcc version 4.2.1 20070831 patched [FreeBSD]\n}, - "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n} - }, - :clang => { - "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n}, - "3.10.0" => %Q{clang version 3.10.0 (tags/RELEASE_310/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n}, - "3.0.0" => %Q{clang version 3.0.0 (tags/RELEASE_30/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n} - } - } - - def version_output_of(name, version) - VERSION_OUTPUTS[name][version] - end - - def success_status - double success?: true - end - - def failure_status - double success?: false - end - - def stub_shell_command(command, output, status) - allow(Libv8::Compiler).to receive(:execute_command).with(command) do - double output: output, status: status - end - end - - def stub_as_available(command, name, version) - stub_shell_command "which #{command} 2>&1", '', success_status - stub_shell_command "#{command} -v 2>&1", version_output_of(name, version), success_status - end - - def stub_as_unavailable(command) - stub_shell_command "which #{command} 2>&1", '', failure_status - stub_shell_command(/^#{command}/, '', failure_status) - end -end +require File.expand_path '../support/compiler_helpers', __FILE__ diff --git a/spec/support/compiler_helpers.rb b/spec/support/compiler_helpers.rb new file mode 100644 index 00000000..a581722f --- /dev/null +++ b/spec/support/compiler_helpers.rb @@ -0,0 +1,45 @@ +module CompilerHelpers + VERSION_OUTPUTS = { + :gcc => { + "4.2.1-freebsd" => %Q{Using built-in specs.\nTarget: i386-undermydesk-freebsd\nConfigured with: FreeBSD/i386 system compiler\nThread model: posix\ngcc version 4.2.1 20070831 patched [FreeBSD]\n}, + "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n} + }, + :clang => { + "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n}, + "3.10.0" => %Q{clang version 3.10.0 (tags/RELEASE_310/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n}, + "3.0.0" => %Q{clang version 3.0.0 (tags/RELEASE_30/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n} + } + } + + def version_output_of(name, version) + VERSION_OUTPUTS[name][version] + end + + def success_status + double success?: true + end + + def failure_status + double success?: false + end + + def stub_shell_command(command, output, status) + allow(Libv8::Compiler).to receive(:execute_command).with(command) do + double output: output, status: status + end + end + + def stub_as_available(command, name, version) + stub_shell_command "which #{command} 2>&1", '', success_status + stub_shell_command "#{command} -v 2>&1", version_output_of(name, version), success_status + end + + def stub_as_unavailable(command) + stub_shell_command "which #{command} 2>&1", '', failure_status + stub_shell_command(/^#{command}/, '', failure_status) + end +end + +RSpec.configure do |c| + c.include CompilerHelpers +end From 1a9cbd5936de73ec4c3d115e3d72591a62cc77b6 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 13:40:57 +0300 Subject: [PATCH 024/117] The RSpec spies syntax is now available by default --- .rspec | 1 + libv8.gemspec | 1 - spec/spec_helper.rb | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..49d5710b --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--format documentation diff --git a/libv8.gemspec b/libv8.gemspec index 74ca21b1..f4fbd2c8 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -29,6 +29,5 @@ Gem::Specification.new do |s| s.add_development_dependency "rake" s.add_development_dependency "rake-compiler" s.add_development_dependency "rspec" - s.add_development_dependency "rspec-spies" s.add_development_dependency "rubysl", "~> 2.0" if RUBY_ENGINE == "rbx" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c1f87182..9dec079f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,5 @@ $:.unshift File.expand_path '../../ext/libv8', __FILE__ $:.unshift File.expand_path '../../lib', __FILE__ require 'rspec' -require 'rspec-spies' require 'libv8' require File.expand_path '../support/compiler_helpers', __FILE__ From 3a842d9721318220cb5c2675402180b2cae8199f Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 13:43:20 +0300 Subject: [PATCH 025/117] For now we're still using RSpec 2.14 --- libv8.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libv8.gemspec b/libv8.gemspec index f4fbd2c8..dddca50f 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -28,6 +28,6 @@ Gem::Specification.new do |s| s.add_development_dependency "rake" s.add_development_dependency "rake-compiler" - s.add_development_dependency "rspec" + s.add_development_dependency "rspec", "~> 2.14.1" s.add_development_dependency "rubysl", "~> 2.0" if RUBY_ENGINE == "rbx" end From a1314e57f1d3800474ff4a9d5209c2cc9ccbae7f Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 13:46:33 +0300 Subject: [PATCH 026/117] Do not use new hash literal syntax --- spec/support/compiler_helpers.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/support/compiler_helpers.rb b/spec/support/compiler_helpers.rb index a581722f..6903df81 100644 --- a/spec/support/compiler_helpers.rb +++ b/spec/support/compiler_helpers.rb @@ -16,16 +16,16 @@ def version_output_of(name, version) end def success_status - double success?: true + double :success? => true end def failure_status - double success?: false + double :success? => false end def stub_shell_command(command, output, status) allow(Libv8::Compiler).to receive(:execute_command).with(command) do - double output: output, status: status + double :output => output, :status => status end end From c226b41832441c228c63c54f80d4614f61fe956e Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 13:59:53 +0300 Subject: [PATCH 027/117] Escape command before interpolating in Regexp --- spec/support/compiler_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/compiler_helpers.rb b/spec/support/compiler_helpers.rb index 6903df81..d74bf0b2 100644 --- a/spec/support/compiler_helpers.rb +++ b/spec/support/compiler_helpers.rb @@ -36,7 +36,7 @@ def stub_as_available(command, name, version) def stub_as_unavailable(command) stub_shell_command "which #{command} 2>&1", '', failure_status - stub_shell_command(/^#{command}/, '', failure_status) + stub_shell_command(/^#{Regexp.escape(command)}/, '', failure_status) end end From ead7283aedf1f459281afa349c0562fad330d14c Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 14:42:37 +0300 Subject: [PATCH 028/117] Fix a bug in compiler version parsing --- ext/libv8/compiler/clang.rb | 8 +++++++- ext/libv8/compiler/gcc.rb | 8 +++++++- ext/libv8/compiler/generic_compiler.rb | 18 ++++++++++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ext/libv8/compiler/clang.rb b/ext/libv8/compiler/clang.rb index c482bce8..8e988157 100644 --- a/ext/libv8/compiler/clang.rb +++ b/ext/libv8/compiler/clang.rb @@ -1,7 +1,7 @@ module Libv8 module Compiler class Clang < GenericCompiler - VERSION_REGEXP = /clang version (\d+\.\d+(\.\d+)*) \(/i + CLANG_VERSION_REGEXP = /clang version (\d+\.\d+(\.\d+)*) \(/i def name 'clang' @@ -10,6 +10,12 @@ def name def compatible? version >= '3.1' unless version.nil? end + + private + + def version_regexp + CLANG_VERSION_REGEXP + end end end end diff --git a/ext/libv8/compiler/gcc.rb b/ext/libv8/compiler/gcc.rb index 649ac038..f40cc84d 100644 --- a/ext/libv8/compiler/gcc.rb +++ b/ext/libv8/compiler/gcc.rb @@ -1,7 +1,7 @@ module Libv8 module Compiler class GCC < GenericCompiler - VERSION_REGEXP = /gcc version (\d+\.\d+(\.\d+)*)/i + GCC_VERSION_REGEXP = /gcc version (\d+\.\d+(\.\d+)*)/i def name 'GCC' @@ -10,6 +10,12 @@ def name def compatible? version > '4.3' unless version.nil? end + + private + + def version_regexp + GCC_VERSION_REGEXP + end end end end diff --git a/ext/libv8/compiler/generic_compiler.rb b/ext/libv8/compiler/generic_compiler.rb index 72895319..3031bf12 100644 --- a/ext/libv8/compiler/generic_compiler.rb +++ b/ext/libv8/compiler/generic_compiler.rb @@ -1,8 +1,8 @@ module Libv8 module Compiler class GenericCompiler - VERSION_REGEXP = /(\d+\.\d+(\.\d+)*)/ - TARGET_REGEXP = /Target: ([a-z0-9\-_.]*)/ + GENERIC_VERSION_REGEXP = /(\d+\.\d+(\.\d+)*)/ + GENERIC_TARGET_REGEXP = /Target: ([a-z0-9\-_.]*)/ def initialize(command) @command = command @@ -17,12 +17,12 @@ def to_s end def version - call('-v').output =~ VERSION_REGEXP + call('-v').output =~ version_regexp $1 end def target - call('-v').output =~ TARGET_REGEXP + call('-v').output =~ target_regexp $1 end @@ -33,6 +33,16 @@ def compatible? def call(*arguments) Compiler::execute_command arguments.unshift(@command).push('2>&1').join(' ') end + + private + + def version_regexp + GENERIC_VERSION_REGEXP + end + + def target_regexp + GENERIC_TARGET_REGEXP + end end end end From 7b185f47c22e57e9a087c900c5a8f4a927917158 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 14:42:56 +0300 Subject: [PATCH 029/117] Add Apple LLVM compiler --- ext/libv8/compiler.rb | 2 ++ ext/libv8/compiler/apple_llvm.rb | 21 +++++++++++++++++++++ spec/compiler/apple_llvm_spec.rb | 30 ++++++++++++++++++++++++++++++ spec/compiler_spec.rb | 5 +++++ spec/support/compiler_helpers.rb | 3 +++ 5 files changed, 61 insertions(+) create mode 100644 ext/libv8/compiler/apple_llvm.rb create mode 100644 spec/compiler/apple_llvm_spec.rb diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index fd9bfb88..a1f6df40 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -3,6 +3,7 @@ require File.expand_path '../compiler/generic_compiler', __FILE__ require File.expand_path '../compiler/gcc', __FILE__ require File.expand_path '../compiler/clang', __FILE__ +require File.expand_path '../compiler/apple_llvm', __FILE__ module Libv8 module Compiler @@ -25,6 +26,7 @@ def available_compilers(*compiler_names) def type_of(compiler_name) case version_string_of(compiler_name) + when /\bApple LLVM\b/ then AppleLLVM when /\bclang\b/i then Clang when /^gcc/i then GCC else GenericCompiler diff --git a/ext/libv8/compiler/apple_llvm.rb b/ext/libv8/compiler/apple_llvm.rb new file mode 100644 index 00000000..0dcb2998 --- /dev/null +++ b/ext/libv8/compiler/apple_llvm.rb @@ -0,0 +1,21 @@ +module Libv8 + module Compiler + class AppleLLVM < Clang + LLVM_VERSION_REGEXP = /Apple LLVM version (\d+\.\d+(\.\d+)*) \(/i + + def name + 'Apple LLVM' + end + + def compatible? + version >= '4.3' unless version.nil? + end + + private + + def version_regexp + LLVM_VERSION_REGEXP + end + end + end +end diff --git a/spec/compiler/apple_llvm_spec.rb b/spec/compiler/apple_llvm_spec.rb new file mode 100644 index 00000000..26de32f2 --- /dev/null +++ b/spec/compiler/apple_llvm_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' +require 'compiler' + +module Libv8::Compiler + describe AppleLLVM do + subject { AppleLLVM.new 'c++' } + + describe '#name' do + it 'returns Apple LLVM' do + subject.name.should eq 'Apple LLVM' + end + end + + describe '#version' do + it 'returns the version of the compiler' do + stub_as_available 'c++', :apple_llvm, '5.1' + subject.version.should eq '5.1' + end + end + + describe '#compatible?' do + context 'when Apple LLVM\'s version is >= 4.3' do + it 'returns true' do + stub_as_available 'c++', :apple_llvm, '5.1' + subject.compatible?.should be_true + end + end + end + end +end diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb index e0a58f16..1549012d 100644 --- a/spec/compiler_spec.rb +++ b/spec/compiler_spec.rb @@ -13,6 +13,11 @@ module Libv8 stub_as_available 'c++', :clang, '3.4.1' Compiler.available_compilers('c++').first.should be_a Compiler::Clang end + + it 'recognises Apple\'s LLVM' do + stub_as_available 'c++', :apple_llvm, '5.1' + Compiler.available_compilers('c++').first.should be_a Compiler::AppleLLVM + end end describe '::available_compilers' do diff --git a/spec/support/compiler_helpers.rb b/spec/support/compiler_helpers.rb index d74bf0b2..58bc66af 100644 --- a/spec/support/compiler_helpers.rb +++ b/spec/support/compiler_helpers.rb @@ -8,6 +8,9 @@ module CompilerHelpers "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n}, "3.10.0" => %Q{clang version 3.10.0 (tags/RELEASE_310/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n}, "3.0.0" => %Q{clang version 3.0.0 (tags/RELEASE_30/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n} + }, + :apple_llvm => { + '5.1' => %Q{Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1\nApple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)\nTarget: x86_64-apple-darwin14.0.0\nThread model: posix\n} } } From f142f28254ea79bb46cf5ca86de8db9b15adb8fd Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 14:50:17 +0300 Subject: [PATCH 030/117] Change spec wording --- spec/compiler_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb index 1549012d..bb09bdae 100644 --- a/spec/compiler_spec.rb +++ b/spec/compiler_spec.rb @@ -4,17 +4,17 @@ module Libv8 describe Compiler do describe '::type_of' do - it 'returns a GCC class for GCC 4.9.0' do + it 'recognises correctly GCC' do stub_as_available 'c++', :gcc, '4.9.0' Compiler.available_compilers('c++').first.should be_a Compiler::GCC end - it 'returns a Clang class for Clang 3.4.1' do + it 'recognises correctly Clang' do stub_as_available 'c++', :clang, '3.4.1' Compiler.available_compilers('c++').first.should be_a Compiler::Clang end - it 'recognises Apple\'s LLVM' do + it 'recognises correctly Apple\'s LLVM' do stub_as_available 'c++', :apple_llvm, '5.1' Compiler.available_compilers('c++').first.should be_a Compiler::AppleLLVM end From 659ccdc8ad8372f1331fd3c76b98589d0de50a0e Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 15:00:32 +0300 Subject: [PATCH 031/117] Dry up version and target parsing --- ext/libv8/compiler/generic_compiler.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ext/libv8/compiler/generic_compiler.rb b/ext/libv8/compiler/generic_compiler.rb index 3031bf12..7588ff93 100644 --- a/ext/libv8/compiler/generic_compiler.rb +++ b/ext/libv8/compiler/generic_compiler.rb @@ -17,12 +17,12 @@ def to_s end def version - call('-v').output =~ version_regexp + version_string =~ version_regexp $1 end def target - call('-v').output =~ target_regexp + version_string =~ target_regexp $1 end @@ -31,11 +31,19 @@ def compatible? end def call(*arguments) - Compiler::execute_command arguments.unshift(@command).push('2>&1').join(' ') + Compiler::execute_command arguments.unshift(@command).join(' ') end private + def version_string + begin + Compiler::version_string_of @command + rescue StandardError + nil + end + end + def version_regexp GENERIC_VERSION_REGEXP end From e50ad5fb9546452a2dda5c0f497a50ef563b7d8c Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 15:16:35 +0300 Subject: [PATCH 032/117] Add more version string specific tests --- ext/libv8/compiler.rb | 6 +----- spec/compiler/clang_spec.rb | 10 ---------- spec/compiler_spec.rb | 6 ++++++ spec/support/compiler_helpers.rb | 3 +-- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index a1f6df40..55fc7c22 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -15,10 +15,6 @@ module Compiler module_function - def system_compilers - available_compilers(*Compiler::KNOWN_COMPILERS) - end - def available_compilers(*compiler_names) available = compiler_names.select { |compiler_name| available? compiler_name } available.map { |compiler_name| type_of(compiler_name).new compiler_name } @@ -26,7 +22,7 @@ def available_compilers(*compiler_names) def type_of(compiler_name) case version_string_of(compiler_name) - when /\bApple LLVM\b/ then AppleLLVM + when /^Apple LLVM\b/ then AppleLLVM when /\bclang\b/i then Clang when /^gcc/i then GCC else GenericCompiler diff --git a/spec/compiler/clang_spec.rb b/spec/compiler/clang_spec.rb index 78aca837..47e89188 100644 --- a/spec/compiler/clang_spec.rb +++ b/spec/compiler/clang_spec.rb @@ -23,16 +23,6 @@ module Libv8::Compiler it 'returns true' do stub_as_available 'c++', :clang, '3.4.1' subject.compatible?.should be_true - - stub_as_available 'c++', :clang, '3.10.0' - subject.compatible?.should be_true - end - end - - context 'when clang\'s version is < 3.1' do - it 'returns false' do - stub_as_available 'c++', :clang, '3.0.0' - subject.compatible?.should be_false end end end diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb index bb09bdae..aca39915 100644 --- a/spec/compiler_spec.rb +++ b/spec/compiler_spec.rb @@ -7,11 +7,17 @@ module Libv8 it 'recognises correctly GCC' do stub_as_available 'c++', :gcc, '4.9.0' Compiler.available_compilers('c++').first.should be_a Compiler::GCC + + stub_as_available 'g++', :gcc, '4.2.1-freebsd' + Compiler.available_compilers('g++').first.should be_a Compiler::GCC end it 'recognises correctly Clang' do stub_as_available 'c++', :clang, '3.4.1' Compiler.available_compilers('c++').first.should be_a Compiler::Clang + + stub_as_available 'freebsd-clang++', :clang, '3.3-freebsd' + Compiler.available_compilers('freebsd-clang++').first.should be_a Compiler::Clang end it 'recognises correctly Apple\'s LLVM' do diff --git a/spec/support/compiler_helpers.rb b/spec/support/compiler_helpers.rb index 58bc66af..93af6cc5 100644 --- a/spec/support/compiler_helpers.rb +++ b/spec/support/compiler_helpers.rb @@ -5,9 +5,8 @@ module CompilerHelpers "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n} }, :clang => { + "3.3-freebsd" => %Q{FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610\nTarget: i386-unknown-freebsd9.2\nThread model: posix}, "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n}, - "3.10.0" => %Q{clang version 3.10.0 (tags/RELEASE_310/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n}, - "3.0.0" => %Q{clang version 3.0.0 (tags/RELEASE_30/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n} }, :apple_llvm => { '5.1' => %Q{Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1\nApple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)\nTarget: x86_64-apple-darwin14.0.0\nThread model: posix\n} From 82450f972af169d0cbe8280fa7ac84039fd75585 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 16:09:24 +0300 Subject: [PATCH 033/117] Check if clang can be used on Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a49643cd..3e9dd8f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: ruby rvm: - 2.0.0 - 2.1.2 + - 2.1.2-clang - 1.9.3 - rbx-2 - ree From ed46ceb050c0ac20e50b9e6c61bbce671584bf8b Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 16:18:24 +0300 Subject: [PATCH 034/117] Prefer the compiler Ruby was compiled with --- ext/libv8/compiler.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index 55fc7c22..5e033a87 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -8,10 +8,11 @@ module Libv8 module Compiler KNOWN_COMPILERS = [ + ::MakeMakefile::CONFIG['CXX'], 'c++', 'g++48', 'g++46', 'g++44', 'g++', 'clang++', - ] + ].uniq module_function From a7f92a02ed56dc55f4c8139d51c55a17bf8a9eba Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 16:37:40 +0300 Subject: [PATCH 035/117] Enable clang CI testing --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3e9dd8f8..0a9dab31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,12 @@ language: ruby rvm: - 2.0.0 - 2.1.2 - - 2.1.2-clang - 1.9.3 - rbx-2 - ree +env: + - CXX=g++ + - CXX=clang++ matrix: allow_failures: - rvm: ree From 1762e38cf9cd3a191d7af331924da55c96046651 Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 17:36:17 +0300 Subject: [PATCH 036/117] Use RbConfig to determine default compiler --- ext/libv8/builder.rb | 2 +- ext/libv8/compiler.rb | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index a738ca79..c7f171ae 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -75,7 +75,7 @@ def setup_build_deps! def choose_compiler compiler_names = if with_config('cxx') then [with_config('cxx')] elsif ENV['CXX'] then [ENV['CXX']] - else Compiler::KNOWN_COMPILERS + else Compiler::well_known_compilers end available_compilers = Compiler.available_compilers(*compiler_names) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index 5e033a87..0b2dd094 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -1,5 +1,4 @@ -require 'mkmf' -require 'open3' +require 'rbconfig' require File.expand_path '../compiler/generic_compiler', __FILE__ require File.expand_path '../compiler/gcc', __FILE__ require File.expand_path '../compiler/clang', __FILE__ @@ -7,15 +6,26 @@ module Libv8 module Compiler - KNOWN_COMPILERS = [ - ::MakeMakefile::CONFIG['CXX'], - 'c++', - 'g++48', 'g++46', 'g++44', 'g++', - 'clang++', - ].uniq - module_function + def well_known_compilers + compilers = [] + + # The command Ruby was compiled with + compilers << RbConfig::CONFIG['CXX'] + + # The default system compiler + compilers << 'c++' + + # FreeBSD GCC command names + compilers += ['g++48', 'g++46', 'g++44'] + + # Default compiler names + compilers << ['g++', 'clang++'] + + compilers.uniq + end + def available_compilers(*compiler_names) available = compiler_names.select { |compiler_name| available? compiler_name } available.map { |compiler_name| type_of(compiler_name).new compiler_name } From 00faaf04b075c58677353e117fe6702dffee8089 Mon Sep 17 00:00:00 2001 From: ignisf Date: Mon, 16 Jun 2014 02:54:38 +0300 Subject: [PATCH 037/117] Fix build failure when make is bmake --- ext/libv8/builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index c7f171ae..a079afd3 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -67,7 +67,7 @@ def setup_python! end def setup_build_deps! - `make dependencies` + `#{make} dependencies` end private From 7d4d4a261990dd0490d2cee110c0ea70780c3b4f Mon Sep 17 00:00:00 2001 From: ignisf Date: Mon, 16 Jun 2014 11:21:49 +0300 Subject: [PATCH 038/117] Work around build failure on FreeBSD --- ...ve-variable-name-conflict-on-freebsd.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 patches/resolve-variable-name-conflict-on-freebsd.patch diff --git a/patches/resolve-variable-name-conflict-on-freebsd.patch b/patches/resolve-variable-name-conflict-on-freebsd.patch new file mode 100644 index 00000000..4ed9da9a --- /dev/null +++ b/patches/resolve-variable-name-conflict-on-freebsd.patch @@ -0,0 +1,30 @@ +diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc +index a1a0739..f21e254 100644 +--- a/src/platform-freebsd.cc ++++ b/src/platform-freebsd.cc +@@ -121,10 +121,10 @@ static unsigned StringToLong(char* buffer) { + + + std::vector OS::GetSharedLibraryAddresses() { +- std::vector result; ++ std::vector result2; + static const int MAP_LENGTH = 1024; + int fd = open("/proc/self/maps", O_RDONLY); +- if (fd < 0) return result; ++ if (fd < 0) return result2; + while (true) { + char addr_buffer[11]; + addr_buffer[0] = '0'; +@@ -155,10 +155,10 @@ std::vector OS::GetSharedLibraryAddresses() { + // There may be no filename in this line. Skip to next. + if (start_of_path == NULL) continue; + buffer[bytes_read] = 0; +- result.push_back(SharedLibraryAddress(start_of_path, start, end)); ++ result2.push_back(SharedLibraryAddress(start_of_path, start, end)); + } + close(fd); +- return result; ++ return result2; + } + + From 6b09a3f7daa1610469adb1984a3b0811052eb46a Mon Sep 17 00:00:00 2001 From: ignisf Date: Mon, 16 Jun 2014 11:23:47 +0300 Subject: [PATCH 039/117] Bump v8 to version 3.27.29 --- lib/libv8/version.rb | 2 +- vendor/v8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 88b689dc..be9ba9ab 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "3.27.28.0" + VERSION = "3.27.29.0" end diff --git a/vendor/v8 b/vendor/v8 index be6486f6..55960d6d 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit be6486f6d475c58b2f61607bdb7b54efc505281e +Subproject commit 55960d6d2443c5cde3b63b174cfa5289606b4566 From e90425c3df9ac1c7c18986fbd3665943e07af135 Mon Sep 17 00:00:00 2001 From: ignisf Date: Mon, 16 Jun 2014 22:24:54 +0300 Subject: [PATCH 040/117] Use absolute path to chdir to vendor/v8 --- ext/libv8/builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index a079afd3..4f97ad21 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -40,7 +40,7 @@ def make_flags(*flags) end def build_libv8! - Dir.chdir('vendor/v8') do + Dir.chdir(File.expand_path('../../../vendor/v8', __FILE__)) do fail 'No compilers available' if @compiler.nil? setup_python! patch! From 9b518bee32114205973774514550246e1fc8164f Mon Sep 17 00:00:00 2001 From: ignisf Date: Mon, 16 Jun 2014 22:49:06 +0300 Subject: [PATCH 041/117] Enumerate files in submodules automatically --- libv8.gemspec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libv8.gemspec b/libv8.gemspec index dddca50f..6fd143e9 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -15,12 +15,12 @@ Gem::Specification.new do |s| s.rubyforge_project = "libv8" s.files = `git ls-files`.split("\n") - s.files += Dir.chdir("vendor/v8") do - `git ls-files`.split("\n").reject {|f| f =~ /^out|^test|^benchmarks/}.map {|f| "vendor/v8/#{f}"} - end - s.files += Dir['vendor/v8/build/**/*'] - s.files += Dir.chdir("vendor/gyp") do - `git ls-files`.split("\n").map {|f| "vendor/gyp/#{f}"} + + submodules = `git submodule --quiet foreach 'echo $path'`.split("\n").map(&:chomp) + submodules.each do |submodule| + s.files += Dir.chdir(submodule) do + `git ls-files`.split("\n").reject {|f| f =~ /^out|^test|^benchmarks/}.map {|f| "#{submodule}/#{f}"} + end end s.extensions = ["ext/libv8/extconf.rb"] From 8bfad685365e02f3b5164d919914649247c08499 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 00:26:45 +0300 Subject: [PATCH 042/117] Remove dependency on the standard library for rbx --- libv8.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/libv8.gemspec b/libv8.gemspec index 6fd143e9..d50c2a9e 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -29,5 +29,4 @@ Gem::Specification.new do |s| s.add_development_dependency "rake" s.add_development_dependency "rake-compiler" s.add_development_dependency "rspec", "~> 2.14.1" - s.add_development_dependency "rubysl", "~> 2.0" if RUBY_ENGINE == "rbx" end From 31ef4906e4c44d2142d65100fe63eab3d6003a29 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 00:29:00 +0300 Subject: [PATCH 043/117] Add ruby 1.8.7 to Travis configuration --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0a9dab31..80f833c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: ruby rvm: + - 1.8.7 + - 1.9.3 - 2.0.0 - 2.1.2 - - 1.9.3 - rbx-2 - ree env: @@ -11,6 +12,7 @@ env: matrix: allow_failures: - rvm: ree + - rvm: 1.8.7 bundler_args: -j4 script: - travis_wait bundle exec rake From 475af565237991dbc97d98dd568da3a222787492 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 01:23:00 +0300 Subject: [PATCH 044/117] Test building gems and installing them --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 80f833c6..2399faee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,8 @@ matrix: - rvm: 1.8.7 bundler_args: -j4 script: - - travis_wait bundle exec rake + - bundle exec rake spec build binary + - gem install pkg/*.gem notifications: recipients: - cowboyd@thefrontside.net From bececed6bd1db39b7c228e0ab850542ba9fccab7 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 02:31:57 +0300 Subject: [PATCH 045/117] Display output during v8 compilation instead of after --- ext/libv8/builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 4f97ad21..95049112 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -47,7 +47,7 @@ def build_libv8! setup_build_deps! print_build_info puts 'Beginning compilation. This will take some time.' - puts `env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags} 2>&1` + system "env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}" end return $?.exitstatus end From 8cdb5e8b70067763744c0efc0f15887cd76f55bb Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 02:38:41 +0300 Subject: [PATCH 046/117] Do not clean the main tree before building --- Rakefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 8e310d2f..de137619 100644 --- a/Rakefile +++ b/Rakefile @@ -50,13 +50,16 @@ task :binary => :compile do FileUtils.mv(package, 'pkg') end +task :clean_submodules do + sh "git submodule --quiet foreach git reset --hard" + sh "git submodule --quiet foreach git clean -df" +end + desc "clean up artifacts of the build" -task :clean do +task :clean => [:clean_submodules] do sh "rm -rf pkg" sh "git clean -df" - sh "git submodule foreach git reset --hard" - sh "git submodule foreach git clean -df" end task :default => [:compile, :spec] -task :build => [:clean] +task :build => [:clean_submodules] From b1cae55257c3925772be840bee9079085be488a2 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 03:06:07 +0300 Subject: [PATCH 047/117] Add travis_wait for the gem install command gem install will not output data until it's finished with the compilation. This causes Travis timeouts. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2399faee..2055a0b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: bundler_args: -j4 script: - bundle exec rake spec build binary - - gem install pkg/*.gem + - travis_wait gem install pkg/*.gem notifications: recipients: - cowboyd@thefrontside.net From 9cd69472267b3815b59274aac10743c25576cabe Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 11:09:39 +0300 Subject: [PATCH 048/117] Ruby 1.8.7's FileUtils.chmod does not like strings --- .travis.yml | 2 +- Rakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2055a0b1..7bc80283 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ matrix: - rvm: 1.8.7 bundler_args: -j4 script: - - bundle exec rake spec build binary + - bundle exec rake spec build binary --trace - travis_wait gem install pkg/*.gem notifications: recipients: diff --git a/Rakefile b/Rakefile index de137619..45943f00 100644 --- a/Rakefile +++ b/Rakefile @@ -37,7 +37,7 @@ task :binary => :compile do gemspec.files += Dir['vendor/v8/include/*'] gemspec.files += Dir['vendor/v8/out/**/*.a'] - FileUtils.chmod 'a+r', gemspec.files + FileUtils.chmod 0644, gemspec.files FileUtils.mkdir_p 'pkg' package = if Gem::VERSION < '2.0.0' From d0f1e3f70c5e092a6eae2ee5ca593d89181e53ad Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 12:47:30 +0300 Subject: [PATCH 049/117] Tone down the Travis build matrix --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7bc80283..c393db46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,13 @@ rvm: - 2.1.2 - rbx-2 - ree -env: - - CXX=g++ - - CXX=clang++ matrix: allow_failures: - rvm: ree - rvm: 1.8.7 + include: + - rvm: 2.1.2-clang + env: CXX=clang++ bundler_args: -j4 script: - bundle exec rake spec build binary --trace From 63dbf4f7c07b344f47e3158e7aa74c8051583294 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 12:51:18 +0300 Subject: [PATCH 050/117] Bump v8 version to 3.27.33 --- lib/libv8/version.rb | 2 +- vendor/v8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index be9ba9ab..38f5f15b 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "3.27.29.0" + VERSION = "3.27.33.0" end diff --git a/vendor/v8 b/vendor/v8 index 55960d6d..1d34d0ae 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit 55960d6d2443c5cde3b63b174cfa5289606b4566 +Subproject commit 1d34d0ae82dd018e86e7d6184e4026657d19755a From 3cbf1c3517ebd4aa447723713ee8ab2f542e14e9 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 13:16:50 +0300 Subject: [PATCH 051/117] Reimplement architecture detection --- .travis.yml | 1 + ext/libv8/arch.rb | 40 +++++++--------------------------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index c393db46..1543dc00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ matrix: include: - rvm: 2.1.2-clang env: CXX=clang++ + fast_finish: true bundler_args: -j4 script: - bundle exec rake spec build binary --trace diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index 17ac37ca..3eb92485 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -1,42 +1,16 @@ require 'rbconfig' +require 'rubygems' module Libv8 module Arch module_function - - def x86_64_from_build_cpu - RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64' - end - - def x86_64_from_byte_length - ['foo'].pack('p').size == 8 - end - - def x86_64_from_arch_flag - RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/ - end - - def rubinius? - Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == "rbx" - end - - # TODO fix false positive on 64-bit ARM - def x64? - if rubinius? - x86_64_from_build_cpu || x86_64_from_arch_flag - else - x86_64_from_byte_length - end - end - - def arm? - RbConfig::MAKEFILE_CONFIG['build_cpu'] =~ /^arm/ - end - def libv8_arch - if arm? then "arm" - elsif x64? then "x64" - else "ia32" + case Gem::Platform.local.cpu + when /^arm/ then 'arm' + when /^mips/ then 'mips' + when /^amd64|^x86_64/ then 'x64' + when /^i[3456]86/ then 'ia32' + else raise "Unsupported target: #{target}" end end end From 8e6bd00c358e57520b8c94a781147b705a0ce2fc Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 13:30:30 +0300 Subject: [PATCH 052/117] Add experimental arm64 support --- ext/libv8/arch.rb | 9 +++++---- patches/fPIC-for-static.patch | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index 3eb92485..c3af30f5 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -6,10 +6,11 @@ module Arch module_function def libv8_arch case Gem::Platform.local.cpu - when /^arm/ then 'arm' - when /^mips/ then 'mips' - when /^amd64|^x86_64/ then 'x64' - when /^i[3456]86/ then 'ia32' + when /^armv8|^aarch64/ then 'arm64' + when /^arm/ then 'arm' + when /^mips/ then 'mips' + when /^amd64|^x86_64/ then 'x64' + when /^i[3456]86/ then 'ia32' else raise "Unsupported target: #{target}" end end diff --git a/patches/fPIC-for-static.patch b/patches/fPIC-for-static.patch index 00117d64..39564772 100644 --- a/patches/fPIC-for-static.patch +++ b/patches/fPIC-for-static.patch @@ -1,13 +1,13 @@ diff --git a/build/standalone.gypi b/build/standalone.gypi -index 125c5bf..71641a3 100644 +index 7670e5b..230518c 100644 --- a/build/standalone.gypi +++ b/build/standalone.gypi -@@ -107,7 +107,7 @@ +@@ -205,7 +205,7 @@ [ 'visibility=="hidden" and v8_enable_backtrace==0', { 'cflags': [ '-fvisibility=hidden' ], }], - [ 'component=="shared_library"', { -+ [ 'component=="shared_library" or component=="static_library" and v8_target_arch=="x64"', { ++ [ 'component=="shared_library" or component=="static_library" and (v8_target_arch=="x64" or v8_target_arch=="arm64")', { 'cflags': [ '-fPIC', ], }], ], From ea9f3b15bfcc920d8a99e232b0b37a7ef68296b5 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 14:46:11 +0300 Subject: [PATCH 053/117] Reorder Travis builds --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1543dc00..db282d8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: ruby rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 - 2.1.2 + - 2.0.0 + - 1.9.3 - rbx-2 - ree + - 1.8.7 matrix: allow_failures: - rvm: ree From 0bd9435f5b1be9a515ea3ae27c2c120abd73c831 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 14:46:26 +0300 Subject: [PATCH 054/117] Get rid of RUBY_PLATFORM in the Rakefile --- Rakefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 45943f00..7b4d4a67 100644 --- a/Rakefile +++ b/Rakefile @@ -6,14 +6,14 @@ RSpec::Core::RakeTask.new(:spec) module Helpers module_function - def binary_gemspec(platform = RUBY_PLATFORM) + def binary_gemspec(platform = Gem::Platform.local) gemspec = eval(File.read('libv8.gemspec')) - gemspec.platform = Gem::Platform.new(platform) + gemspec.platform = platform gemspec end - def binary_gem_name - File.basename binary_gemspec.cache_file + def binary_gem_name(platform = Gem::Platform.local) + File.basename binary_gemspec(platform).cache_file end end From 2107fd7d8b7f8d5fc2236c9f9de184684339c595 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 14:59:05 +0300 Subject: [PATCH 055/117] Rely on v8 to determine which ARM features are present --- ext/libv8/builder.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 95049112..21b84f74 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -22,12 +22,9 @@ def make_flags(*flags) # http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.4' - # Avoid compilation failures on the Raspberry Pi. - flags << "vfp2=off vfp3=off" if @compiler.target.include? "arm" - - # FIXME: Determine when to activate this instead of leaving it on by - # default. - flags << "hardfp=on" if @compiler.target.include? "arm" + # Check which ARM features are available according to the compiler + # XXX: Needs testing + flags << "armtest=on" if @compiler.target.include? "arm" # Fix Malformed archive issue caused by GYP creating thin archives by # default. From e2fd504f6c06b582016c1805a9cb23502e23c20e Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 15:01:48 +0300 Subject: [PATCH 056/117] Pass clang=1 option to make when using clang --- ext/libv8/builder.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 21b84f74..26a5789e 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -30,6 +30,9 @@ def make_flags(*flags) # default. flags << "ARFLAGS.target=crs" + # Pass clang=1 to GYP as noted in wiki + # https://code.google.com/p/v8/wiki/BuildingWithGYP#Clang_+_make + flags << 'GYP_DEFINES="clang=1"' if @compiler.is_a? Compiler::Clang # Solaris / Smart OS requires additional -G flag to use with -fPIC flags << "CFLAGS=-G" if @compiler.target =~ /solaris/ From a22a2f888004769cd0d2511f65279de6df60a952 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 15:02:09 +0300 Subject: [PATCH 057/117] Disable building i18n (icu) --- ext/libv8/builder.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 26a5789e..84b39400 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -33,6 +33,10 @@ def make_flags(*flags) # Pass clang=1 to GYP as noted in wiki # https://code.google.com/p/v8/wiki/BuildingWithGYP#Clang_+_make flags << 'GYP_DEFINES="clang=1"' if @compiler.is_a? Compiler::Clang + + # Disable i18n + flags << 'i18nsupport=off' + # Solaris / Smart OS requires additional -G flag to use with -fPIC flags << "CFLAGS=-G" if @compiler.target =~ /solaris/ From 485fb8d315ce875fb4d23035d00631a63bc1dc30 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 15:14:20 +0300 Subject: [PATCH 058/117] Remove the icu46 submodule --- .gitmodules | 3 --- patches/link-dependencies.patch | 6 ++---- vendor/icu46 | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 160000 vendor/icu46 diff --git a/.gitmodules b/.gitmodules index ab0c9ebd..87fce46b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "vendor/gyp"] path = vendor/gyp url = https://git.chromium.org/git/external/gyp.git -[submodule "vendor/icu46"] - path = vendor/icu46 - url = https://git.chromium.org/git/chromium/third_party/icu46.git [submodule "vendor/buildtools"] path = vendor/buildtools url = https://chromium.googlesource.com/chromium/buildtools.git diff --git a/patches/link-dependencies.patch b/patches/link-dependencies.patch index 09c01e5c..b2c5b238 100644 --- a/patches/link-dependencies.patch +++ b/patches/link-dependencies.patch @@ -1,8 +1,8 @@ diff --git a/Makefile b/Makefile -index f49be61..ad551e6 100644 +index f49be61..0626d02 100644 --- a/Makefile +++ b/Makefile -@@ -463,13 +463,7 @@ gtags.clean: +@@ -463,13 +463,5 @@ gtags.clean: # Dependencies. # Remember to keep these in sync with the DEPS file. dependencies: @@ -17,6 +17,4 @@ index f49be61..ad551e6 100644 - git fetch origin; \ - git checkout 5d89977ce55240995d1596fe420b818468f5ec37 ) + ( test -h build/gyp || ln -s ../../gyp build/gyp ) -+ ( test -d third_party || mkdir third_party ) -+ ( test -h third_party/icu || ln -s ../../icu46 third_party/icu ) + ( test -h buildtools || ln -s ../buildtools ) diff --git a/vendor/icu46 b/vendor/icu46 deleted file mode 160000 index 44fc849c..00000000 --- a/vendor/icu46 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 44fc849c472ba8bf2c0f97c8e9546a99f114c182 From 8b2de7428bde87a9aed9599a89ca3efdfd040285 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 15:16:02 +0300 Subject: [PATCH 059/117] Clean even files in .gitignore --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 7b4d4a67..cb121096 100644 --- a/Rakefile +++ b/Rakefile @@ -52,13 +52,13 @@ end task :clean_submodules do sh "git submodule --quiet foreach git reset --hard" - sh "git submodule --quiet foreach git clean -df" + sh "git submodule --quiet foreach git clean -dxf" end desc "clean up artifacts of the build" task :clean => [:clean_submodules] do sh "rm -rf pkg" - sh "git clean -df" + sh "git clean -dxf" end task :default => [:compile, :spec] From 466b8720141a970d7a9e0616c190dfd6bc61800f Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 15:31:30 +0300 Subject: [PATCH 060/117] Silence warnings --- libv8.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libv8.gemspec b/libv8.gemspec index d50c2a9e..c7dcb5a9 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |s| s.extensions = ["ext/libv8/extconf.rb"] s.require_paths = ["lib", "ext"] - s.add_development_dependency "rake" - s.add_development_dependency "rake-compiler" - s.add_development_dependency "rspec", "~> 2.14.1" + s.add_development_dependency 'rake', '~> 10' + s.add_development_dependency 'rake-compiler', '~> 0' + s.add_development_dependency 'rspec', '~> 2.14', '< 2.14.99' end From 3168c51d4a55226bd5ddccfe9a8ca0647d2dea56 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 16:01:04 +0300 Subject: [PATCH 061/117] Styling changes --- Rakefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index cb121096..1639d28b 100644 --- a/Rakefile +++ b/Rakefile @@ -2,12 +2,12 @@ require 'bundler/setup' require 'rspec/core/rake_task' Bundler::GemHelper.install_tasks -RSpec::Core::RakeTask.new(:spec) +RSpec::Core::RakeTask.new :spec module Helpers module_function def binary_gemspec(platform = Gem::Platform.local) - gemspec = eval(File.read('libv8.gemspec')) + gemspec = eval(File.read 'libv8.gemspec') gemspec.platform = platform gemspec end @@ -44,10 +44,10 @@ task :binary => :compile do Gem::Builder.new(gemspec).build else require 'rubygems/package' - Gem::Package.build(gemspec) + Gem::Package.build gemspec end - FileUtils.mv(package, 'pkg') + FileUtils.mv package, 'pkg' end task :clean_submodules do From 459e5d836da934c8b61b397f328f514560e79694 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 16:01:10 +0300 Subject: [PATCH 062/117] Fix a bug when compiling on an unsupported platform --- ext/libv8/arch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index c3af30f5..74cbcd73 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -11,7 +11,7 @@ def libv8_arch when /^mips/ then 'mips' when /^amd64|^x86_64/ then 'x64' when /^i[3456]86/ then 'ia32' - else raise "Unsupported target: #{target}" + else raise "Unsupported target: #{Gem::Platform.local.cpu}" end end end From 5d10dc6fcf51911eb4c612c24b561b62dc468fae Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 16:03:14 +0300 Subject: [PATCH 063/117] Gem::Platform.local.cpu is x86 on 32-bit FreeBSD --- ext/libv8/arch.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index 74cbcd73..40e272fa 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -6,11 +6,11 @@ module Arch module_function def libv8_arch case Gem::Platform.local.cpu - when /^armv8|^aarch64/ then 'arm64' - when /^arm/ then 'arm' - when /^mips/ then 'mips' - when /^amd64|^x86_64/ then 'x64' - when /^i[3456]86/ then 'ia32' + when /^armv8|^aarch64/ then 'arm64' + when /^arm/ then 'arm' + when /^mips/ then 'mips' + when /^amd64|^x86_64/ then 'x64' + when /^i[3456]86|^x86$/ then 'ia32' else raise "Unsupported target: #{Gem::Platform.local.cpu}" end end From c0609973ff4fb2c08e5fc3332226493f294297f1 Mon Sep 17 00:00:00 2001 From: ignisf Date: Tue, 17 Jun 2014 16:16:34 +0300 Subject: [PATCH 064/117] Include only tested architectures in Arch::libv_arch --- ext/libv8/arch.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index 40e272fa..0a08f82a 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -6,12 +6,12 @@ module Arch module_function def libv8_arch case Gem::Platform.local.cpu - when /^armv8|^aarch64/ then 'arm64' - when /^arm/ then 'arm' - when /^mips/ then 'mips' - when /^amd64|^x86_64/ then 'x64' - when /^i[3456]86|^x86$/ then 'ia32' - else raise "Unsupported target: #{Gem::Platform.local.cpu}" + when /^arm$/ then 'arm' + when /^x86$/ then 'ia32' + when /^x86_64$/ then 'x64' + else + warn "Unsupported target: #{Gem::Platform.local.cpu}" + Gem::Platform.local.cpu end end end From 8d97b7a2903e64ad5c8b83660e1fd67faf572f02 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 12:50:52 -0500 Subject: [PATCH 065/117] Update to the libv8 4.5.* build process --- .gitmodules | 12 +++----- ext/libv8/builder.rb | 5 ++-- ext/libv8/patcher.rb | 2 +- lib/libv8/version.rb | 2 +- patches/disable-building-tests.patch | 26 ++++++++-------- patches/link-dependencies.patch | 20 ------------- ...ve-variable-name-conflict-on-freebsd.patch | 30 ------------------- vendor/.gclient | 11 +++++++ vendor/.gclient_entries | 12 ++++++++ vendor/buildtools | 1 - vendor/depot_tools | 1 + vendor/gyp | 1 - vendor/v8 | 2 +- 13 files changed, 48 insertions(+), 77 deletions(-) delete mode 100644 patches/link-dependencies.patch delete mode 100644 patches/resolve-variable-name-conflict-on-freebsd.patch create mode 100644 vendor/.gclient create mode 100644 vendor/.gclient_entries delete mode 160000 vendor/buildtools create mode 160000 vendor/depot_tools delete mode 160000 vendor/gyp diff --git a/.gitmodules b/.gitmodules index 501611da..65c228ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,10 +1,6 @@ [submodule "vendor/v8"] path = vendor/v8 - url = https://github.com/v8/v8.git -[submodule "vendor/gyp"] - path = vendor/gyp - url = https://git.chromium.org/git/external/gyp.git -[submodule "vendor/buildtools"] - path = vendor/buildtools - url = https://chromium.googlesource.com/chromium/buildtools.git - + url = https://chromium.googlesource.com/v8/v8.git +[submodule "vendor/depot_tools"] + path = vendor/depot_tools + url = https://chromium.googlesource.com/chromium/tools/depot_tools.git diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 528401ee..6534f686 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -54,8 +54,8 @@ def build_libv8! Dir.chdir(File.expand_path('../../../vendor/v8', __FILE__)) do fail 'No compilers available' if @compiler.nil? setup_python! - patch! setup_build_deps! + patch! print_build_info puts 'Beginning compilation. This will take some time.' system "env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}" @@ -78,7 +78,8 @@ def setup_python! end def setup_build_deps! - `#{make} dependencies` + gclient = File.expand_path('../../../vendor/depot_tools/gclient', __FILE__) + `#{gclient} sync` end private diff --git a/ext/libv8/patcher.rb b/ext/libv8/patcher.rb index d365e42b..ff085584 100644 --- a/ext/libv8/patcher.rb +++ b/ext/libv8/patcher.rb @@ -11,7 +11,7 @@ def patch! (available_patches - applied_patches).each do |patch| `patch -p1 -N < #{patch}` - fail 'failed to apply patch' unless $?.success? + fail "failed to apply patch #{patch}" unless $?.success? f.puts patch puts "Applying #{patch}" end diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 38f5f15b..eeafa02a 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "3.27.33.0" + VERSION = "4.5.95.0" end diff --git a/patches/disable-building-tests.patch b/patches/disable-building-tests.patch index cb53540d..1854a9b7 100644 --- a/patches/disable-building-tests.patch +++ b/patches/disable-building-tests.patch @@ -1,25 +1,27 @@ diff --git a/Makefile b/Makefile -index f49be61..89f0d47 100644 +index 9761265..80169b2 100644 --- a/Makefile +++ b/Makefile -@@ -227,7 +227,7 @@ NACL_ARCHES = nacl_ia32 nacl_x64 - # List of files that trigger Makefile regeneration: - GYPFILES = build/all.gyp build/features.gypi build/standalone.gypi \ - build/toolchain.gypi samples/samples.gyp src/d8.gyp \ -- test/cctest/cctest.gyp tools/gyp/v8.gyp -+ tools/gyp/v8.gyp - - # If vtunejit=on, the v8vtune.gyp will be appended. - ifeq ($(vtunejit), on) +@@ -248,8 +248,6 @@ NACL_ARCHES = nacl_ia32 nacl_x64 + GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \ + build/shim_headers.gypi build/features.gypi build/standalone.gypi \ + build/toolchain.gypi build/all.gyp build/mac/asan.gyp \ +- test/cctest/cctest.gyp \ +- test/unittests/unittests.gyp tools/gyp/v8.gyp \ + tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \ + buildtools/third_party/libc++abi/libc++abi.gyp \ + buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \ diff --git a/build/all.gyp b/build/all.gyp -index 3860379..176b60f 100644 +index 4aeb507..1ff2c7a 100644 --- a/build/all.gyp +++ b/build/all.gyp -@@ -10,7 +10,6 @@ +@@ -10,8 +10,6 @@ 'dependencies': [ '../samples/samples.gyp:*', '../src/d8.gyp:d8', - '../test/cctest/cctest.gyp:*', +- '../test/unittests/unittests.gyp:*', ], 'conditions': [ ['component!="shared_library"', { + diff --git a/patches/link-dependencies.patch b/patches/link-dependencies.patch deleted file mode 100644 index b2c5b238..00000000 --- a/patches/link-dependencies.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/Makefile b/Makefile -index f49be61..0626d02 100644 ---- a/Makefile -+++ b/Makefile -@@ -463,13 +463,5 @@ gtags.clean: - # Dependencies. - # Remember to keep these in sync with the DEPS file. - dependencies: -- svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ -- --revision 1831 -- svn checkout --force \ -- https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \ -- third_party/icu --revision 258359 -- ( test -d buildtools || \ -- git clone https://chromium.googlesource.com/chromium/buildtools.git; \ -- cd buildtools; \ -- git fetch origin; \ -- git checkout 5d89977ce55240995d1596fe420b818468f5ec37 ) -+ ( test -h build/gyp || ln -s ../../gyp build/gyp ) -+ ( test -h buildtools || ln -s ../buildtools ) diff --git a/patches/resolve-variable-name-conflict-on-freebsd.patch b/patches/resolve-variable-name-conflict-on-freebsd.patch deleted file mode 100644 index 4ed9da9a..00000000 --- a/patches/resolve-variable-name-conflict-on-freebsd.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc -index a1a0739..f21e254 100644 ---- a/src/platform-freebsd.cc -+++ b/src/platform-freebsd.cc -@@ -121,10 +121,10 @@ static unsigned StringToLong(char* buffer) { - - - std::vector OS::GetSharedLibraryAddresses() { -- std::vector result; -+ std::vector result2; - static const int MAP_LENGTH = 1024; - int fd = open("/proc/self/maps", O_RDONLY); -- if (fd < 0) return result; -+ if (fd < 0) return result2; - while (true) { - char addr_buffer[11]; - addr_buffer[0] = '0'; -@@ -155,10 +155,10 @@ std::vector OS::GetSharedLibraryAddresses() { - // There may be no filename in this line. Skip to next. - if (start_of_path == NULL) continue; - buffer[bytes_read] = 0; -- result.push_back(SharedLibraryAddress(start_of_path, start, end)); -+ result2.push_back(SharedLibraryAddress(start_of_path, start, end)); - } - close(fd); -- return result; -+ return result2; - } - - diff --git a/vendor/.gclient b/vendor/.gclient new file mode 100644 index 00000000..67e6f82d --- /dev/null +++ b/vendor/.gclient @@ -0,0 +1,11 @@ +solutions = [ + { "name" : "v8", + "url" : "https://chromium.googlesource.com/v8/v8.git", + "deps_file" : "DEPS", + "managed" : True, + "custom_deps" : { + }, + "safesync_url": "", + }, +] +cache_dir = None diff --git a/vendor/.gclient_entries b/vendor/.gclient_entries new file mode 100644 index 00000000..e4f122c0 --- /dev/null +++ b/vendor/.gclient_entries @@ -0,0 +1,12 @@ +entries = { + 'v8': 'https://chromium.googlesource.com/v8/v8.git', + 'v8/build/gyp': 'https://chromium.googlesource.com/external/gyp.git@5122240c5e5c4d8da12c543d82b03d6089eb77c5', + 'v8/buildtools': 'https://chromium.googlesource.com/chromium/buildtools.git@ecc8e253abac3b6186a97573871a084f4c0ca3ae', + 'v8/testing/gmock': 'https://chromium.googlesource.com/external/googlemock.git@29763965ab52f24565299976b936d1265cb6a271', + 'v8/testing/gtest': 'https://chromium.googlesource.com/external/googletest.git@23574bf2333f834ff665f894c97bef8a5b33a0a9', + 'v8/third_party/icu': 'https://chromium.googlesource.com/chromium/deps/icu.git@7fe225d77f307fdbe24695179a84336ef95c1253', + 'v8/tools/clang': 'https://chromium.googlesource.com/chromium/src/tools/clang.git@73ec8804ed395b0886d6edf82a9f33583f4a7902', + 'v8/buildtools/clang_format/script': 'https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format.git@81edd558fea5dd7855d67a1dc61db34ae8c1fd63', + 'v8/buildtools/third_party/libc++/trunk': 'https://chromium.googlesource.com/chromium/llvm-project/libcxx.git@48198f9110397fff47fe7c37cbfa296be7d44d3d', + 'v8/buildtools/third_party/libc++abi/trunk': 'https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git@4ad1009ab3a59fa7a6896d74d5e4de5885697f95', +} diff --git a/vendor/buildtools b/vendor/buildtools deleted file mode 160000 index 5d89977c..00000000 --- a/vendor/buildtools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5d89977ce55240995d1596fe420b818468f5ec37 diff --git a/vendor/depot_tools b/vendor/depot_tools new file mode 160000 index 00000000..faa4b4eb --- /dev/null +++ b/vendor/depot_tools @@ -0,0 +1 @@ +Subproject commit faa4b4eb51757e38879a34c4005c4e56c2d360ad diff --git a/vendor/gyp b/vendor/gyp deleted file mode 160000 index f7bc250c..00000000 --- a/vendor/gyp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f7bc250ccc4d619a1cf238db87e5979f89ff36d7 diff --git a/vendor/v8 b/vendor/v8 index 1d34d0ae..b0493ed1 160000 --- a/vendor/v8 +++ b/vendor/v8 @@ -1 +1 @@ -Subproject commit 1d34d0ae82dd018e86e7d6184e4026657d19755a +Subproject commit b0493ed16c0b363a0e92bf4a790d4fd851c74e70 From 33b71c76d3f191c1ca83c3b31d7d0ba66af4ec74 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 14:55:40 -0500 Subject: [PATCH 066/117] move to full checkout of the v8 source --- .gitignore | 3 +++ .gitmodules | 3 --- Rakefile | 3 ++- ext/libv8/builder.rb | 31 ++++++++++++++++++++++++++++--- libv8.gemspec | 2 +- vendor/.gclient | 11 ----------- vendor/.gclient_entries | 12 ------------ vendor/v8 | 1 - 8 files changed, 34 insertions(+), 32 deletions(-) delete mode 100644 vendor/.gclient delete mode 100644 vendor/.gclient_entries delete mode 160000 vendor/v8 diff --git a/.gitignore b/.gitignore index 0ac7805e..92449eb4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ lib/libv8/VERSION /ext/libv8/.location.yml /release/**/libv8 /release/**/.vagrant +/vendor/.gclient +/vendor/.gclient_entries +/vendor/v8/ diff --git a/.gitmodules b/.gitmodules index 65c228ad..37ac743d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "vendor/v8"] - path = vendor/v8 - url = https://chromium.googlesource.com/v8/v8.git [submodule "vendor/depot_tools"] path = vendor/depot_tools url = https://chromium.googlesource.com/chromium/tools/depot_tools.git diff --git a/Rakefile b/Rakefile index 357c5f48..4d176da4 100644 --- a/Rakefile +++ b/Rakefile @@ -74,8 +74,9 @@ end desc "clean up artifacts of the build" task :clean => [:clean_submodules] do sh "rm -rf pkg" + sh "rm -rf vendor/v8" sh "git clean -dxf" end task :default => [:compile, :spec] -task :build => [:clean_submodules] +task :build => [:clean] diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 6534f686..60eeb3e2 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -1,4 +1,8 @@ +unless $:.include? File.expand_path("../../../lib", __FILE__) + $:.unshift File.expand_path("../../../lib", __FILE__) +end require 'mkmf' +require 'libv8/version' require File.expand_path '../compiler', __FILE__ require File.expand_path '../arch', __FILE__ require File.expand_path '../make', __FILE__ @@ -51,10 +55,10 @@ def make_flags(*flags) end def build_libv8! + setup_python! + setup_build_deps! Dir.chdir(File.expand_path('../../../vendor/v8', __FILE__)) do fail 'No compilers available' if @compiler.nil? - setup_python! - setup_build_deps! patch! print_build_info puts 'Beginning compilation. This will take some time.' @@ -77,9 +81,30 @@ def setup_python! end end + ## + # The release tag to checkout. If this is version 4.5.95.0 of the libv8 gem, + # then this will be 4.5.95 + # + def source_version + Libv8::VERSION.gsub(/\.\d+$/, '') + end + + ## + # Checkout all of the V8 source and its dependencies using the + # chromium depot tools. + # + # https://chromium.googlesource.com/v8/v8.git#Getting-the-Code + # def setup_build_deps! + fetch = File.expand_path('../../../vendor/depot_tools/fetch', __FILE__) gclient = File.expand_path('../../../vendor/depot_tools/gclient', __FILE__) - `#{gclient} sync` + Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do + `#{fetch} v8` + Dir.chdir('v8') do + `git checkout #{source_version}` + `#{gclient} sync` + end + end end private diff --git a/libv8.gemspec b/libv8.gemspec index 62546521..03830e07 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| submodules = `git submodule --quiet foreach 'echo $path'`.split("\n").map(&:chomp) submodules.each do |submodule| s.files += Dir.chdir(submodule) do - `git ls-files`.split("\n").reject {|f| f =~ /^out|^test|^benchmarks/}.map {|f| "#{submodule}/#{f}"} + `git ls-files`.split("\n").map {|f| "#{submodule}/#{f}"} end end diff --git a/vendor/.gclient b/vendor/.gclient deleted file mode 100644 index 67e6f82d..00000000 --- a/vendor/.gclient +++ /dev/null @@ -1,11 +0,0 @@ -solutions = [ - { "name" : "v8", - "url" : "https://chromium.googlesource.com/v8/v8.git", - "deps_file" : "DEPS", - "managed" : True, - "custom_deps" : { - }, - "safesync_url": "", - }, -] -cache_dir = None diff --git a/vendor/.gclient_entries b/vendor/.gclient_entries deleted file mode 100644 index e4f122c0..00000000 --- a/vendor/.gclient_entries +++ /dev/null @@ -1,12 +0,0 @@ -entries = { - 'v8': 'https://chromium.googlesource.com/v8/v8.git', - 'v8/build/gyp': 'https://chromium.googlesource.com/external/gyp.git@5122240c5e5c4d8da12c543d82b03d6089eb77c5', - 'v8/buildtools': 'https://chromium.googlesource.com/chromium/buildtools.git@ecc8e253abac3b6186a97573871a084f4c0ca3ae', - 'v8/testing/gmock': 'https://chromium.googlesource.com/external/googlemock.git@29763965ab52f24565299976b936d1265cb6a271', - 'v8/testing/gtest': 'https://chromium.googlesource.com/external/googletest.git@23574bf2333f834ff665f894c97bef8a5b33a0a9', - 'v8/third_party/icu': 'https://chromium.googlesource.com/chromium/deps/icu.git@7fe225d77f307fdbe24695179a84336ef95c1253', - 'v8/tools/clang': 'https://chromium.googlesource.com/chromium/src/tools/clang.git@73ec8804ed395b0886d6edf82a9f33583f4a7902', - 'v8/buildtools/clang_format/script': 'https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format.git@81edd558fea5dd7855d67a1dc61db34ae8c1fd63', - 'v8/buildtools/third_party/libc++/trunk': 'https://chromium.googlesource.com/chromium/llvm-project/libcxx.git@48198f9110397fff47fe7c37cbfa296be7d44d3d', - 'v8/buildtools/third_party/libc++abi/trunk': 'https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git@4ad1009ab3a59fa7a6896d74d5e4de5885697f95', -} diff --git a/vendor/v8 b/vendor/v8 deleted file mode 160000 index b0493ed1..00000000 --- a/vendor/v8 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b0493ed16c0b363a0e92bf4a790d4fd851c74e70 From 7aafb0ff99e44f9c68e56f3c784cb66f0a9e5cf9 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 15:02:43 -0500 Subject: [PATCH 067/117] don't clean out the bundle when making clean --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 4d176da4..5aca8b8c 100644 --- a/Rakefile +++ b/Rakefile @@ -75,7 +75,7 @@ desc "clean up artifacts of the build" task :clean => [:clean_submodules] do sh "rm -rf pkg" sh "rm -rf vendor/v8" - sh "git clean -dxf" + sh "git clean -dxf -e .bundle -e vendor/bundle" end task :default => [:compile, :spec] From 4df4f19e2abdcc118c6d205c91dd3ef3ebeabb05 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 15:20:09 -0500 Subject: [PATCH 068/117] add check to see which python script is failing --- ext/libv8/builder.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 60eeb3e2..14d03876 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -99,10 +99,12 @@ def setup_build_deps! fetch = File.expand_path('../../../vendor/depot_tools/fetch', __FILE__) gclient = File.expand_path('../../../vendor/depot_tools/gclient', __FILE__) Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do - `#{fetch} v8` + system "#{fetch} v8" or fail "unable to fetch v8 source" Dir.chdir('v8') do - `git checkout #{source_version}` - `#{gclient} sync` + unless system "git checkout #{source_version}" + fail "unable to checkout source for v8 #{source_version}" + end + system "#{gclient} sync" or fail "could not sync v8 build dependencies" end end end From 7192977500463033e38d21110f71c4efc9e293eb Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 15:35:14 -0500 Subject: [PATCH 069/117] update binary builders --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 5aca8b8c..4f8da359 100644 --- a/Rakefile +++ b/Rakefile @@ -57,9 +57,9 @@ namespace :build do arch_dir = Pathname(__FILE__).dirname.join("release/#{arch}") Dir.chdir(arch_dir) do sh "vagrant up" - sh "vagrant ssh -c 'cd /vagrant && rm -rf libv8 && git clone /libv8/.git libv8'" + sh "vagrant ssh -c 'cd /vagrant && rm -rf libv8 && git clone --recursive /libv8/.git libv8'" sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle install --path vendor/bundle'" - sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle exec rake checkout binary'" + sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle exec rake binary'" sh "vagrant ssh -c 'cp /vagrant/libv8/pkg/*.gem /vagrant'" end end From 3fb8bf1e42e312addb07dd4d5870f042e5039f64 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 15:53:15 -0500 Subject: [PATCH 070/117] put the depot tools in the path --- ext/libv8/builder.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 14d03876..6a309a2d 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -96,15 +96,14 @@ def source_version # https://chromium.googlesource.com/v8/v8.git#Getting-the-Code # def setup_build_deps! - fetch = File.expand_path('../../../vendor/depot_tools/fetch', __FILE__) - gclient = File.expand_path('../../../vendor/depot_tools/gclient', __FILE__) + ENV['PATH'] = "#{File.expand_path('../../../vendor/depot_tools', __FILE__)}:#{ENV['PATH']}" Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do - system "#{fetch} v8" or fail "unable to fetch v8 source" + system "fetch v8" or fail "unable to fetch v8 source" Dir.chdir('v8') do unless system "git checkout #{source_version}" fail "unable to checkout source for v8 #{source_version}" end - system "#{gclient} sync" or fail "could not sync v8 build dependencies" + system "gclient sync" or fail "could not sync v8 build dependencies" end end end From 6786a2c4c2ce89f6ef905c981f5bd9fa9a5ba289 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Jul 2015 16:58:33 -0500 Subject: [PATCH 071/117] clang is required to compile 4.5.x --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa53cec6..8336bc88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,6 @@ rvm: - 2.0.0 - 1.9.3 - rbx-2 -matrix: - include: - - rvm: 2.1.2-clang - env: CXX=clang++ - fast_finish: true bundler_args: -j4 script: - bundle exec rake spec build binary --trace @@ -19,3 +14,4 @@ notifications: - cowboyd@thefrontside.net - bordjukov@gmail.com cache: bundler +env: CXX=clang++ From 1d85a563aee79ac6d923d4cce6aa53d84695296e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 16:35:33 +0300 Subject: [PATCH 072/117] Initialize submodules to the correct versions --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 4f8da359..5eac5d91 100644 --- a/Rakefile +++ b/Rakefile @@ -69,12 +69,12 @@ end task :clean_submodules do sh "git submodule --quiet foreach git reset --hard" sh "git submodule --quiet foreach git clean -dxf" + sh "git submodule update --init" end desc "clean up artifacts of the build" task :clean => [:clean_submodules] do sh "rm -rf pkg" - sh "rm -rf vendor/v8" sh "git clean -dxf -e .bundle -e vendor/bundle" end From 9fd0db977e8cd2449a69f7e9be8d53458e09715a Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:09:46 +0300 Subject: [PATCH 073/117] Tweak the RSpec output configuration Turn on colour and warnings for easier debugging when migrating to 3.* --- .rspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.rspec b/.rspec index 49d5710b..1e6da830 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,3 @@ --format documentation +--color +--warnings \ No newline at end of file From 8715eec947aa7f3f24db9a6e95c3c90a093ffef9 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:11:08 +0300 Subject: [PATCH 074/117] Move the patch application message Actually display which patch is going to get applied before calling the patch command. --- ext/libv8/patcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/patcher.rb b/ext/libv8/patcher.rb index ff085584..a811b4b5 100644 --- a/ext/libv8/patcher.rb +++ b/ext/libv8/patcher.rb @@ -10,10 +10,10 @@ def patch! applied_patches = f.readlines.map(&:chomp) (available_patches - applied_patches).each do |patch| + puts "Applying #{patch}" `patch -p1 -N < #{patch}` fail "failed to apply patch #{patch}" unless $?.success? f.puts patch - puts "Applying #{patch}" end end end From 3836e837c17d70543f741f25f5113414f2dcebf6 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:11:42 +0300 Subject: [PATCH 075/117] Do not add the tests to the produced packages --- libv8.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libv8.gemspec b/libv8.gemspec index 03830e07..39c4beed 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| submodules = `git submodule --quiet foreach 'echo $path'`.split("\n").map(&:chomp) submodules.each do |submodule| s.files += Dir.chdir(submodule) do - `git ls-files`.split("\n").map {|f| "#{submodule}/#{f}"} + `git ls-files`.split("\n").reject {|f| f =~ /^test/}.map {|f| "#{submodule}/#{f}"} end end From 9f287c9855b6d9c9035f7929c714035b14aedab2 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:12:12 +0300 Subject: [PATCH 076/117] Remove unnecessary checkout logic --- ext/libv8/checkout.rb | 52 ------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 ext/libv8/checkout.rb diff --git a/ext/libv8/checkout.rb b/ext/libv8/checkout.rb deleted file mode 100644 index b7102a39..00000000 --- a/ext/libv8/checkout.rb +++ /dev/null @@ -1,52 +0,0 @@ -require File.expand_path '../../../lib/libv8/version.rb', __FILE__ - -module Libv8 - module Checkout - module_function - - GYP_SVN = 'http://gyp.googlecode.com/svn' - V8_Source = File.expand_path '../../../vendor/v8', __FILE__ - GYP_Source = File.expand_path '../../../vendor/gyp', __FILE__ - - def checkout! - # When compiling from a source gem, it's not a git repository anymore and - # we assume the right code is already checked out. - return unless git?(V8_Source) - - Dir.chdir(V8_Source) do - `git fetch` - `git checkout #{Libv8::VERSION.gsub(/\.\d+(\.rc\d+)?$/,'')} -f` - `rm -f .applied_patches` - end - - return unless git?(GYP_Source) - - check_git_svn! - - Dir.chdir(GYP_Source) do - mkf = File.readlines(File.join(V8_Source, 'Makefile')) - idx = mkf.index {|l| l =~ /#{GYP_SVN}/} + 1 - rev = /--revision (\d+)/.match(mkf[idx])[1] - `git fetch` - # --git-dir is needed for older versions of git and git-svn - `git --git-dir=../../.git/modules/vendor/gyp/ svn init #{GYP_SVN} -Ttrunk` - `git config --replace-all svn-remote.svn.fetch trunk:refs/remotes/origin/master` - svn_rev = `git --git-dir=../../.git/modules/vendor/gyp/ svn find-rev r#{rev} | tail -n 1`.chomp - `git checkout #{svn_rev} -f` - end - end - - def git?(dir) - File.exist?(File.join(dir, '.git')) - end - - def check_git_svn! - # msysgit provides git svn - return if RUBY_PLATFORM =~ /mingw/ - - unless system 'git help svn 2>&1 > /dev/null' - fail "git-svn not installed!\nPlease install git-svn." - end - end - end -end From ff62f6ae388825d20dccc886ce05b03d85583018 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:14:27 +0300 Subject: [PATCH 077/117] Make the Arch class recognise arm64 --- ext/libv8/arch.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index 0a08f82a..8f48d886 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -1,14 +1,15 @@ -require 'rbconfig' require 'rubygems' module Libv8 module Arch module_function + def libv8_arch case Gem::Platform.local.cpu - when /^arm$/ then 'arm' - when /^x86$/ then 'ia32' - when /^x86_64$/ then 'x64' + when /^arm$/ then 'arm' + when /^a(rm|arch)64$/ then 'arm64' + when /^x86$/ then 'ia32' + when /^x86_64$/ then 'x64' else warn "Unsupported target: #{Gem::Platform.local.cpu}" Gem::Platform.local.cpu From 20ba4f605d2256d40a358852253b03550b2cbe1f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:15:01 +0300 Subject: [PATCH 078/117] Remove unnecessary armtest flag from builder.rb --- ext/libv8/builder.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 6a309a2d..3246977c 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -29,10 +29,6 @@ def make_flags(*flags) # http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.4' - # Check which ARM features are available according to the compiler - # XXX: Needs testing - flags << "armtest=on" if @compiler.target.include? "arm" - # Fix Malformed archive issue caused by GYP creating thin archives by # default. flags << "ARFLAGS.target=crs" From d9e4b54d06f8c652c94c419ebe1a7c2642d38d48 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:15:15 +0300 Subject: [PATCH 079/117] Make the build process print the command it will use Helpful for debugging purposes --- ext/libv8/builder.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 3246977c..daeaecba 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -58,7 +58,10 @@ def build_libv8! patch! print_build_info puts 'Beginning compilation. This will take some time.' - system "env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}" + + command = "env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}" + puts "Building v8 with #{command}" + system command end return $?.exitstatus end From 1cd7ab0d4dd9cae9bb6c67f92edfba16c5d328c7 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:15:46 +0300 Subject: [PATCH 080/117] Use `system` to call `which` --- ext/libv8/builder.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index daeaecba..44898611 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -124,8 +124,8 @@ def choose_compiler end def python_version - if `which python` =~ /python/ - `python -c "import platform; print(platform.python_version())"`.chomp + if system 'which python 2>&1 > /dev/null' + `python -c 'import platform; print(platform.python_version())'`.chomp else "not available" end From 967794a6bf2fb093c96402482916467beb19273e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:16:26 +0300 Subject: [PATCH 081/117] Add additional archives to the paths --- ext/libv8/paths.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/paths.rb b/ext/libv8/paths.rb index 12eccddd..f94c004a 100644 --- a/ext/libv8/paths.rb +++ b/ext/libv8/paths.rb @@ -11,7 +11,7 @@ def include_paths end def object_paths - [libv8_object(:base), libv8_object(:snapshot)].map do |path| + [libv8_object(:base), libv8_object(:libplatform), libv8_object(:libbase), libv8_object(:snapshot)].map do |path| Shellwords.escape path end end From aba295070cc9d127473bcc5ea20a0d9a5736f6c1 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:16:43 +0300 Subject: [PATCH 082/117] Add the libplatform header to the incflags --- ext/libv8/location.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/libv8/location.rb b/ext/libv8/location.rb index f8972dab..666dc546 100644 --- a/ext/libv8/location.rb +++ b/ext/libv8/location.rb @@ -48,6 +48,7 @@ class System < Location def configure(context = MkmfContext.new) context.send(:dir_config, 'v8') context.send(:find_header, 'v8.h') or fail NotFoundError + context.send(:find_header, 'libplatform/libplatform.h') or fail NotFoundError context.send(:have_library, 'v8') or fail NotFoundError end From ebc7c34f70f6f017d020bcc7011fd070849b35ac Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:16:57 +0300 Subject: [PATCH 083/117] Make sure the C locale is set when calling the compiler --- ext/libv8/compiler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index 0b2dd094..c9afb3d2 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -55,7 +55,7 @@ def available?(command) end def execute_command(command) - output = `#{command}` + output = `env LC_ALL=C LANG=C #{command}` status = $? ExecutionResult.new output, status end From f7b2181f0dd24c5222de6ccdefe0dcffb79b20bf Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:17:22 +0300 Subject: [PATCH 084/117] Migrate to RSpec 3 and add some more specs --- libv8.gemspec | 3 +-- spec/compiler/apple_llvm_spec.rb | 6 ++--- spec/compiler/clang_spec.rb | 6 ++--- spec/compiler/gcc_spec.rb | 8 +++---- spec/compiler/generic_compiler_spec.rb | 14 +++++------ spec/compiler_spec.rb | 22 +++++++++--------- spec/location_spec.rb | 32 +++++++++++++------------- 7 files changed, 45 insertions(+), 46 deletions(-) diff --git a/libv8.gemspec b/libv8.gemspec index 39c4beed..278a54be 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -28,6 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake', '~> 10' s.add_development_dependency 'rake-compiler', '~> 0' - s.add_development_dependency 'rspec', '~> 2.14', '< 2.14.99' - s.add_development_dependency 'rspec-spies', '~> 2.0' + s.add_development_dependency 'rspec', '~> 3' end diff --git a/spec/compiler/apple_llvm_spec.rb b/spec/compiler/apple_llvm_spec.rb index 26de32f2..f5b9c587 100644 --- a/spec/compiler/apple_llvm_spec.rb +++ b/spec/compiler/apple_llvm_spec.rb @@ -7,14 +7,14 @@ module Libv8::Compiler describe '#name' do it 'returns Apple LLVM' do - subject.name.should eq 'Apple LLVM' + expect(subject.name).to eq 'Apple LLVM' end end describe '#version' do it 'returns the version of the compiler' do stub_as_available 'c++', :apple_llvm, '5.1' - subject.version.should eq '5.1' + expect(subject.version).to eq '5.1' end end @@ -22,7 +22,7 @@ module Libv8::Compiler context 'when Apple LLVM\'s version is >= 4.3' do it 'returns true' do stub_as_available 'c++', :apple_llvm, '5.1' - subject.compatible?.should be_true + expect(subject).to be_compatible end end end diff --git a/spec/compiler/clang_spec.rb b/spec/compiler/clang_spec.rb index 47e89188..ef9e7994 100644 --- a/spec/compiler/clang_spec.rb +++ b/spec/compiler/clang_spec.rb @@ -7,14 +7,14 @@ module Libv8::Compiler describe '#name' do it 'returns clang' do - subject.name.should eq 'clang' + expect(subject.name).to eq 'clang' end end describe '#version' do it 'returns the version of the compiler' do stub_as_available 'c++', :clang, '3.4.1' - subject.version.should eq '3.4.1' + expect(subject.version).to eq '3.4.1' end end @@ -22,7 +22,7 @@ module Libv8::Compiler context 'when clang\'s version is >= 3.1' do it 'returns true' do stub_as_available 'c++', :clang, '3.4.1' - subject.compatible?.should be_true + expect(subject).to be_compatible end end end diff --git a/spec/compiler/gcc_spec.rb b/spec/compiler/gcc_spec.rb index 689f53bf..50eab012 100644 --- a/spec/compiler/gcc_spec.rb +++ b/spec/compiler/gcc_spec.rb @@ -7,14 +7,14 @@ module Libv8::Compiler describe '#name' do it 'returns GCC' do - subject.name.should eq 'GCC' + expect(subject.name).to eq 'GCC' end end describe '#version' do it 'returns the version of the compiler' do stub_as_available 'c++', :gcc, '4.9.0' - subject.version.should eq '4.9.0' + expect(subject.version).to eq '4.9.0' end end @@ -22,14 +22,14 @@ module Libv8::Compiler context 'when GCC\'s version is >= 4.3' do it 'returns true' do stub_as_available 'c++', :gcc, '4.9.0' - subject.compatible?.should be_true + expect(subject).to be_compatible end end context 'when GCC\'s version is < 4.3' do it 'returns false' do stub_as_available 'c++', :gcc, '4.2.1-freebsd' - subject.compatible?.should be_false + expect(subject).to_not be_compatible end end end diff --git a/spec/compiler/generic_compiler_spec.rb b/spec/compiler/generic_compiler_spec.rb index 9f64937c..8a3e0fdc 100644 --- a/spec/compiler/generic_compiler_spec.rb +++ b/spec/compiler/generic_compiler_spec.rb @@ -7,43 +7,43 @@ module Libv8::Compiler describe '#name' do it 'returns just the base name of the command' do - GenericCompiler.new('/usr/sbin/c++').name.should eq 'c++' + expect(GenericCompiler.new('/usr/sbin/c++').name).to eq 'c++' end end describe '#to_s' do it 'should be the command used to call the compiler' do - subject.to_s.should eq 'c++' + expect(subject.to_s).to eq 'c++' end end describe '#version' do it 'returns the version of the compiler' do stub_as_available 'c++', :clang, '3.4.1' - subject.version.should eq '3.4.1' + expect(subject.version).to eq '3.4.1' end it 'returns nil when determining the version fails' do stub_as_unavailable 'c++' - subject.version.should be_nil + expect(subject.version).to be_nil end end describe '#target' do it 'returns the target of the compiler' do stub_as_available 'c++', :clang, '3.4.1' - subject.target.should eq 'x86_64-unknown-linux-gnu' + expect(subject.target).to eq 'x86_64-unknown-linux-gnu' end it 'returns nil when determining the target fails' do stub_as_unavailable 'c++' - subject.target.should be_nil + expect(subject.target).to be_nil end end describe '#compatible?' do it 'returns false' do - GenericCompiler.new('c++').compatible?.should be_false + expect(GenericCompiler.new('c++')).to_not be_compatible end end end diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb index aca39915..334b12fd 100644 --- a/spec/compiler_spec.rb +++ b/spec/compiler_spec.rb @@ -6,23 +6,23 @@ module Libv8 describe '::type_of' do it 'recognises correctly GCC' do stub_as_available 'c++', :gcc, '4.9.0' - Compiler.available_compilers('c++').first.should be_a Compiler::GCC + expect(Compiler.available_compilers('c++').first).to be_a Compiler::GCC stub_as_available 'g++', :gcc, '4.2.1-freebsd' - Compiler.available_compilers('g++').first.should be_a Compiler::GCC + expect(Compiler.available_compilers('g++').first).to be_a Compiler::GCC end it 'recognises correctly Clang' do stub_as_available 'c++', :clang, '3.4.1' - Compiler.available_compilers('c++').first.should be_a Compiler::Clang + expect(Compiler.available_compilers('c++').first).to be_a Compiler::Clang stub_as_available 'freebsd-clang++', :clang, '3.3-freebsd' - Compiler.available_compilers('freebsd-clang++').first.should be_a Compiler::Clang + expect(Compiler.available_compilers('freebsd-clang++').first).to be_a Compiler::Clang end it 'recognises correctly Apple\'s LLVM' do stub_as_available 'c++', :apple_llvm, '5.1' - Compiler.available_compilers('c++').first.should be_a Compiler::AppleLLVM + expect(Compiler.available_compilers('c++').first).to be_a Compiler::AppleLLVM end end @@ -33,8 +33,8 @@ module Libv8 stub_as_available 'clang++', :clang, '3.4.1' available_compilers = Compiler.available_compilers 'c++', 'g++', 'clang++' - available_compilers.map(&:class).should have(2).items - available_compilers.all? { |compiler| compiler.should be_a Compiler::Clang } + expect(available_compilers.map(&:class).count).to eq 2 + available_compilers.all? { |compiler| expect(compiler).to be_a Compiler::Clang } end end @@ -42,14 +42,14 @@ module Libv8 context 'when calling the compiler command succedes' do it 'returns the version string of the compiler' do stub_as_available 'c++', :clang, '3.4.1' - Compiler.version_string_of('c++').should eq version_output_of(:clang, '3.4.1') + expect(Compiler.version_string_of('c++')).to eq version_output_of(:clang, '3.4.1') end end context 'when calling the compiler command fails' do it 'raises an exception' do stub_as_unavailable 'c++' - expect { Compiler.version_string_of('c++') }.to raise_exception + expect { Compiler.version_string_of('c++') }.to raise_exception(RuntimeError, /Could not get version string of compiler/) end end end @@ -57,12 +57,12 @@ module Libv8 describe '::available?' do it 'returns true when the command is available' do stub_as_available 'c++', :clang, '3.4.1' - Compiler::available?('c++').should be_true + expect(Compiler::available?('c++')).to be true end it 'returns false when the command cannot be found ' do stub_as_unavailable 'c++' - Compiler::available?('c++').should be_false + expect(Compiler::available?('c++')).to be false end end end diff --git a/spec/location_spec.rb b/spec/location_spec.rb index c48e2c16..fb3a3fa0 100644 --- a/spec/location_spec.rb +++ b/spec/location_spec.rb @@ -8,27 +8,27 @@ describe "the system location" do before do @location = Libv8::Location::System.new - @context.stub(:dir_config) + allow(@context).to receive :dir_config end describe "configuring a compliation context with it" do before do - @context.stub(:find_header) {true} - @context.stub(:have_library) {true} + allow(@context).to receive(:find_header) {true} + allow(@context).to receive(:have_library) {true} @location.configure @context end it "adds the include path to the front of the include flags" do - @context.should have_received(:dir_config).with('v8').at_least(:once) - @context.should have_received(:find_header).with('v8.h').at_least(:once) - @context.should have_received(:have_library).with('v8').at_least(:once) + expect(@context).to have_received(:dir_config).with('v8').at_least(:once) + expect(@context).to have_received(:find_header).with('v8.h').at_least(:once) + expect(@context).to have_received(:have_library).with('v8').at_least(:once) end end describe "when the v8 library cannot be found" do before do - @context.stub(:find_header) {true} - @context.stub(:have_library) {false} + allow(@context).to receive(:find_header) {true} + allow(@context).to receive(:have_library) {false} end it "raises a NotFoundError" do @@ -38,8 +38,8 @@ describe "when the v8.h header cannot be found" do before do - @context.stub(:find_header) {false} - @context.stub(:have_library) {true} + allow(@context).to receive(:find_header) {false} + allow(@context).to receive(:have_library) {true} end it "raises a NotFoundError" do @@ -51,20 +51,20 @@ describe "the vendor location" do before do @location = Libv8::Location::Vendor.new - @context.stub(:incflags) {@incflags ||= "-I/usr/include -I/usr/local/include"} - @context.stub(:ldflags) {@ldflags ||= "-lobjc -lpthread"} + allow(@context).to receive(:incflags) {@incflags ||= "-I/usr/include -I/usr/local/include"} + allow(@context).to receive(:ldflags) {@ldflags ||= "-lobjc -lpthread"} - Libv8::Paths.stub(:vendored_source_path) {"/foo bar/v8"} - Libv8::Arch.stub(:libv8_arch) {'x64'} + allow(Libv8::Paths).to receive(:vendored_source_path) {"/foo bar/v8"} + allow(Libv8::Arch).to receive(:libv8_arch) {'x64'} @location.configure @context end it "prepends its own incflags before any pre-existing ones" do - @context.incflags.should eql "-I/foo\\ bar/v8/include -I/usr/include -I/usr/local/include" + expect(@context.incflags).to eql "-I/foo\\ bar/v8/include -I/usr/include -I/usr/local/include" end it "prepends the locations of any libv8 objects on the the ldflags" do - @context.ldflags.should eql "/foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a /foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_snapshot.a -lobjc -lpthread" + expect(@context.ldflags).to eql "/foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a /foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_libplatform.a /foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_libbase.a /foo\\ bar/v8/out/x64.release/obj.target/tools/gyp/libv8_snapshot.a -lobjc -lpthread" end end end From a26c33c26b7dfaec61d17d40c4350c929b61d709 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 17:34:58 +0300 Subject: [PATCH 085/117] Reintroduce the removal of vendor/v8 on clean Depot tools do not like it whenever the vendor/v8 directory still exists when fetch is called. --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 5eac5d91..febc572e 100644 --- a/Rakefile +++ b/Rakefile @@ -75,6 +75,7 @@ end desc "clean up artifacts of the build" task :clean => [:clean_submodules] do sh "rm -rf pkg" + sh "rm -rf vendor/v8" sh "git clean -dxf -e .bundle -e vendor/bundle" end From 7569d8b27867a2ebf17f1eeddcda002601ea3485 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 19:06:49 +0300 Subject: [PATCH 086/117] Fix build failures with GCC It seems that the GYP configuration assumes that every x86/x86_64 MacOS or Linux system is using clang. State explicitly to GYP that we are not using clang whenever we are not using clang. See discussion in 6786a2c4c2ce89f6ef905c981f5bd9fa9a5ba289 --- .travis.yml | 24 +++++++++++++++++++----- ext/libv8/builder.rb | 5 ++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8336bc88..06bd4088 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,27 @@ rvm: - 2.0.0 - 1.9.3 - rbx-2 -bundler_args: -j4 +matrix: + include: + - rvm: ruby-2.2.2-clang + env: CXX=clang++ + - rvm: ruby-head + - rvm: ruby-head-clang + env: CXX=clang++ + - rvm: ree + - rvm: ruby-1.8.7 + allow_failures: + - rvm: ree + - rvm: ruby-1.8.7 + - rvm: ruby-head + - rvm: ruby-head-clang + fast_finish: true +bundler_args: -j4 --retry=3 script: - - bundle exec rake spec build binary --trace - - travis_wait gem install pkg/*.gem + - MAKEFLAGS+=-j8 bundle exec rake spec build binary --trace + - MAKEFLAGS+=-j8 travis_wait gem install pkg/*.gem notifications: recipients: - cowboyd@thefrontside.net - bordjukov@gmail.com -cache: bundler -env: CXX=clang++ +cache: bundler \ No newline at end of file diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 44898611..31267d8d 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -33,9 +33,8 @@ def make_flags(*flags) # default. flags << "ARFLAGS.target=crs" - # Pass clang=1 to GYP as noted in wiki - # https://code.google.com/p/v8/wiki/BuildingWithGYP#Clang_+_make - flags << 'GYP_DEFINES="clang=1"' if @compiler.is_a? Compiler::Clang + # Pass clang flag to GYP in order to work around GCC compilation failures + flags << "GYP_DEFINES=\"clang=#{@compiler.is_a?(Compiler::Clang) ? '1' : '0'}\"" # Disable i18n flags << 'i18nsupport=off' From 2a545e9ba09206e899c9fa384de6f937b9657abc Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 19:08:29 +0300 Subject: [PATCH 087/117] Turn off strictaliasing warning for GCC < 4.6 --- ext/libv8/builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 31267d8d..313b7586 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -27,7 +27,7 @@ def make_flags(*flags) # FreeBSD uses gcc 4.2 by default which leads to # compilation failures due to warnings about aliasing. # http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup - flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.4' + flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.6' # Fix Malformed archive issue caused by GYP creating thin archives by # default. From 4192cb6704913b8232410fe0fc1dc7dcb2db0f50 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 19:21:05 +0300 Subject: [PATCH 088/117] Raise the minimum supported version of GCC to 4.8 See https://code.google.com/p/v8-wiki/wiki/BuildingWithGYP#GCC_+_make for more info --- ext/libv8/compiler/gcc.rb | 2 +- spec/compiler/gcc_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/libv8/compiler/gcc.rb b/ext/libv8/compiler/gcc.rb index f40cc84d..f781483f 100644 --- a/ext/libv8/compiler/gcc.rb +++ b/ext/libv8/compiler/gcc.rb @@ -8,7 +8,7 @@ def name end def compatible? - version > '4.3' unless version.nil? + version > '4.7' unless version.nil? end private diff --git a/spec/compiler/gcc_spec.rb b/spec/compiler/gcc_spec.rb index 50eab012..8196564c 100644 --- a/spec/compiler/gcc_spec.rb +++ b/spec/compiler/gcc_spec.rb @@ -19,7 +19,7 @@ module Libv8::Compiler end describe '#compatible?' do - context 'when GCC\'s version is >= 4.3' do + context 'when GCC\'s version is >= 4.8' do it 'returns true' do stub_as_available 'c++', :gcc, '4.9.0' expect(subject).to be_compatible From 18118be01ac7e37a8d7d43f98f80966bf9a58cf2 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 19:52:29 +0300 Subject: [PATCH 089/117] Remove unnecessary make strictaliasing make flag Since GCCs prior to 4.8 are no longer supported, this flag is no longer needed. --- ext/libv8/builder.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 313b7586..6d2eae32 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -24,11 +24,6 @@ def make_target end def make_flags(*flags) - # FreeBSD uses gcc 4.2 by default which leads to - # compilation failures due to warnings about aliasing. - # http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup - flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.6' - # Fix Malformed archive issue caused by GYP creating thin archives by # default. flags << "ARFLAGS.target=crs" From 7b7c6b63c73b278f2d007089a41dfed53d631872 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 19:53:32 +0300 Subject: [PATCH 090/117] Update the supported platforms in README.md --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index efa5c608..196a0110 100644 --- a/README.md +++ b/README.md @@ -22,16 +22,11 @@ opens the door for supporting Windows. That depends on your platform. Right now, we support the following platforms. -* x86_64-darwin10.7.0 -* x86_64-darwin-10 -* x86_64-darwin-11 -* x86_64-darwin-12 -* x86_64-darwin-13 +* x86_64-darwin-14 * x86_64-linux * x86-linux -* x86_64-freebsd-9 * x86_64-freebsd-10 -* x86_64-solaris-2.11 +* i386-freebsd-10 If you don't see your platform on this list, first, make sure that it installs from source, and second talk to us about setting up a binary From 792eff70805d8697ee50c4ad2bb839dabd2372e6 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 5 Jul 2015 20:40:40 +0300 Subject: [PATCH 091/117] Disable external startup data Disable external startup data until it's implemented on all platforms. In libv8's case the binary size is not a major concern. --- ext/libv8/builder.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 6d2eae32..d07e3003 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -23,14 +23,21 @@ def make_target "#{libv8_arch}.#{profile}" end + def gyp_defines(*defines) + # Do not use an external snapshot as we don't really care for binary size + defines << 'v8_use_external_startup_data=0' + + # Pass clang flag to GYP in order to work around GCC compilation failures + defines << "clang=#{@compiler.is_a?(Compiler::Clang) ? '1' : '0'}" + + "GYP_DEFINES=\"#{defines.join ' '}\"" + end + def make_flags(*flags) # Fix Malformed archive issue caused by GYP creating thin archives by # default. flags << "ARFLAGS.target=crs" - # Pass clang flag to GYP in order to work around GCC compilation failures - flags << "GYP_DEFINES=\"clang=#{@compiler.is_a?(Compiler::Clang) ? '1' : '0'}\"" - # Disable i18n flags << 'i18nsupport=off' @@ -41,6 +48,9 @@ def make_flags(*flags) # with it on flags << 'werror=no' + # Append GYP variable definitions + flags << gyp_defines + "#{make_target} #{flags.join ' '}" end From 76e85e28d40ef974a4d9e996246d6bac054d7c9d Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 6 Jul 2015 00:10:11 +0300 Subject: [PATCH 092/117] Update the incompatible compiler warning --- ext/libv8/builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index d07e3003..58612263 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -143,7 +143,7 @@ def print_build_info puts "Using compiler: #{@compiler} (#{@compiler.name} version #{@compiler.version})" unless @compiler.compatible? warn "Unable to find a compiler officially supported by v8." - warn "It is recommended to use GCC v4.4 or higher" + warn "It is recommended to use clang v3.5 or GCC v4.8 or higher" end end end From 60abda51a198c9ffe556ddcb5daf5dd392b334ce Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 6 Jul 2015 00:11:12 +0300 Subject: [PATCH 093/117] Fix a typo in well known compiler names list This was causing the build scripts to not detect clang++ whenever both it and an incompatible GCC were present on the system. --- ext/libv8/compiler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index c9afb3d2..1f64ed84 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -21,7 +21,7 @@ def well_known_compilers compilers += ['g++48', 'g++46', 'g++44'] # Default compiler names - compilers << ['g++', 'clang++'] + compilers += ['g++', 'clang++'] compilers.uniq end From 531b4acc4f4bf438774b358570fc8b84f19bc7da Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 6 Jul 2015 21:50:04 -0500 Subject: [PATCH 094/117] build libv8 in vagrant home directory The chromium depot tools have problems with the /vagrant project directory causing the new build process to fail. https://github.com/pristineio/webrtc-build-scripts/issues/50 Moving the build into the home directory and not the shared project directory fixed things right up. The binary gem is copied into the shared folder at the end. --- Rakefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index febc572e..2d1cf1e0 100644 --- a/Rakefile +++ b/Rakefile @@ -57,10 +57,11 @@ namespace :build do arch_dir = Pathname(__FILE__).dirname.join("release/#{arch}") Dir.chdir(arch_dir) do sh "vagrant up" - sh "vagrant ssh -c 'cd /vagrant && rm -rf libv8 && git clone --recursive /libv8/.git libv8'" - sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle install --path vendor/bundle'" - sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle exec rake binary'" - sh "vagrant ssh -c 'cp /vagrant/libv8/pkg/*.gem /vagrant'" + sh "vagrant ssh -c 'rm -rf libv8 && git clone /libv8/.git libv8'" + sh "vagrant ssh -c 'cd libv8 && git submodule update --init --depth=1'" + sh "vagrant ssh -c 'cd libv8 && bundle install --path vendor/bundle'" + sh "vagrant ssh -c 'cd libv8 && bundle exec rake binary'" + sh "vagrant ssh -c 'cp libv8/pkg/*.gem /vagrant'" end end end From 046bcc9555ff7e429e1e9ebda33df56a29e5b219 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 7 Jul 2015 21:03:37 -0500 Subject: [PATCH 095/117] update location of v8 include path in 4.5.x, v8 starts expecting the include paths to contain the root of the v8 source directory, and everywhere it had previously referenced `v8.h`, it now references `include/v8.h`. insted of 'v8-profiler.h', it refererces 'include/v8-profiler.h', etc... This adds a test to make sure it can find 'include/v8.h' in the include path as part of the installation verification. --- ext/libv8/location.rb | 6 +++++- ext/libv8/paths.rb | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ext/libv8/location.rb b/ext/libv8/location.rb index 666dc546..ddb63b27 100644 --- a/ext/libv8/location.rb +++ b/ext/libv8/location.rb @@ -32,11 +32,15 @@ def configure(context = MkmfContext.new) end def verify_installation! + include_paths = Libv8::Paths.include_paths + unless include_paths.detect { |p| Pathname(p).join('include/v8.h').exist? } + fail HeaderNotFound, "Unable to locate 'include/v8.h' in the libv8 header paths: #{include_paths.inspect}" + end Libv8::Paths.object_paths.each do |p| fail ArchiveNotFound, p unless File.exist? p end end - + class HeaderNotFound < StandardError; end class ArchiveNotFound < StandardError def initialize(filename) super "libv8 did not install properly, expected binary v8 archive '#{filename}'to exist, but it was not found" diff --git a/ext/libv8/paths.rb b/ext/libv8/paths.rb index f94c004a..ec403f59 100644 --- a/ext/libv8/paths.rb +++ b/ext/libv8/paths.rb @@ -7,12 +7,12 @@ module Paths module_function def include_paths - [Shellwords.escape("#{vendored_source_path}/include")] + [Shellwords.escape(vendored_source_path)] end def object_paths - [libv8_object(:base), libv8_object(:libplatform), libv8_object(:libbase), libv8_object(:snapshot)].map do |path| - Shellwords.escape path + [:base, :libplatform, :libbase, :snapshot].map do |name| + Shellwords.escape libv8_object(name) end end From a41d8bd8ad1520391ca758eb3fb70b815f75fa33 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 7 Jul 2015 21:16:34 -0500 Subject: [PATCH 096/117] fix failing test case --- spec/location_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/location_spec.rb b/spec/location_spec.rb index fb3a3fa0..367782f0 100644 --- a/spec/location_spec.rb +++ b/spec/location_spec.rb @@ -60,7 +60,7 @@ end it "prepends its own incflags before any pre-existing ones" do - expect(@context.incflags).to eql "-I/foo\\ bar/v8/include -I/usr/include -I/usr/local/include" + expect(@context.incflags).to eql "-I/foo\\ bar/v8 -I/usr/include -I/usr/local/include" end it "prepends the locations of any libv8 objects on the the ldflags" do From ecb57762832e30656fcceb461a76580d48a57ea7 Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Fri, 10 Jul 2015 16:19:36 -0500 Subject: [PATCH 097/117] Include all header files Was not including include/libplatform/libplatform.h in the binary gem because it was not a recursive dir glob. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 2d1cf1e0..49754df0 100644 --- a/Rakefile +++ b/Rakefile @@ -34,7 +34,7 @@ task :binary => :compile do gemspec.files += ['ext/libv8/.location.yml'] # V8 - gemspec.files += Dir['vendor/v8/include/*'] + gemspec.files += Dir['vendor/v8/include/**/*.h'] gemspec.files += Dir['vendor/v8/out/**/*.a'] FileUtils.chmod 0644, gemspec.files From c06e7aaaab588ca0f7ca5e3302cecc640a66f46e Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 10 Jul 2015 17:17:22 -0500 Subject: [PATCH 098/117] use container based builds on travis http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 06bd4088..cb194d2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,4 +28,5 @@ notifications: recipients: - cowboyd@thefrontside.net - bordjukov@gmail.com -cache: bundler \ No newline at end of file +cache: bundler +sudo: false From ddb34ffbf0051917103440b00708c72a07dbd5c5 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 11 Jul 2015 01:59:30 +0300 Subject: [PATCH 099/117] Update FreeBSD GCC names --- ext/libv8/compiler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index 1f64ed84..92b35a65 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -18,7 +18,7 @@ def well_known_compilers compilers << 'c++' # FreeBSD GCC command names - compilers += ['g++48', 'g++46', 'g++44'] + compilers += ['g++48', 'g++49', 'g++5'] # Default compiler names compilers += ['g++', 'clang++'] From 0ff84cd7bd5462b1e94abe66b8da1a87260171c4 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 11 Jul 2015 02:02:26 +0300 Subject: [PATCH 100/117] Bump clang++ before g++ as it's preferred by V8 devs --- ext/libv8/compiler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index 92b35a65..f28da198 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -21,7 +21,7 @@ def well_known_compilers compilers += ['g++48', 'g++49', 'g++5'] # Default compiler names - compilers += ['g++', 'clang++'] + compilers += ['clang++', 'g++'] compilers.uniq end From 599e9a8627706787e611d223a7b1ce7fddfc6ff7 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 11 Jul 2015 02:02:58 +0300 Subject: [PATCH 101/117] Fix indentation of Compiler::type_of --- ext/libv8/compiler.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index f28da198..8159911f 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -35,8 +35,8 @@ def type_of(compiler_name) case version_string_of(compiler_name) when /^Apple LLVM\b/ then AppleLLVM when /\bclang\b/i then Clang - when /^gcc/i then GCC - else GenericCompiler + when /^gcc/i then GCC + else GenericCompiler end end From 286345a66f6f9c3e59cd0629519782172d9ac314 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sat, 11 Jul 2015 18:51:23 -0500 Subject: [PATCH 102/117] v4.5.95.1 - binary release basis --- lib/libv8/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index eeafa02a..0872d694 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "4.5.95.0" + VERSION = "4.5.95.1" end From eb06e07a43e03a42f0fd44b1235ef00517507871 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sun, 12 Jul 2015 01:56:54 -0500 Subject: [PATCH 103/117] disable appveyor until windows build is fixed --- README.md | 2 +- appveyor.yml => appveyor.yml.disabled | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename appveyor.yml => appveyor.yml.disabled (100%) diff --git a/README.md b/README.md index 196a0110..cca6bdde 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # libv8 [![Gem Version](https://badge.fury.io/rb/libv8.svg)](http://badge.fury.io/rb/libv8) [![Build Status](https://travis-ci.org/cowboyd/libv8.svg?branch=master)](https://travis-ci.org/cowboyd/libv8) -[![Build status](https://ci.appveyor.com/api/projects/status/ugeqff972kxlba5j?svg=true)](https://ci.appveyor.com/project/cowboyd/libv8) + [![Join the chat at https://gitter.im/cowboyd/therubyracer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cowboyd/therubyracer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) A gem for distributing the v8 runtime libraries and headers in both diff --git a/appveyor.yml b/appveyor.yml.disabled similarity index 100% rename from appveyor.yml rename to appveyor.yml.disabled From cfba65e23f808c47c22a90b92e86056caf4eda6b Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sun, 12 Jul 2015 15:29:12 -0500 Subject: [PATCH 104/117] v4.5.95.2 --- lib/libv8/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 0872d694..8bff906a 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "4.5.95.1" + VERSION = "4.5.95.2" end From 80cc6a1e8c87e26d44370c2435f19970443edf8d Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sun, 12 Jul 2015 18:30:30 -0500 Subject: [PATCH 105/117] v4.5.95.3 - binary release basis --- lib/libv8/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 8bff906a..f0bc9e77 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "4.5.95.2" + VERSION = "4.5.95.3" end From 9999e40d597110bef5905a7716bebe4462eb83e6 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sun, 12 Jul 2015 23:42:05 -0500 Subject: [PATCH 106/117] gyp now provides option to make normal archives by setting the standalone_static_library, gyp will generate normal archives for this target --- ext/libv8/builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 58612263..bca76634 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -36,7 +36,7 @@ def gyp_defines(*defines) def make_flags(*flags) # Fix Malformed archive issue caused by GYP creating thin archives by # default. - flags << "ARFLAGS.target=crs" + flags << "standalone_static_library=1" # Disable i18n flags << 'i18nsupport=off' From 6bd36df369e5853b9aafc8407f7fc342c44a07e9 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sun, 12 Jul 2015 23:45:14 -0500 Subject: [PATCH 107/117] v4.5.95.4 --- lib/libv8/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index f0bc9e77..ef0cac2c 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "4.5.95.3" + VERSION = "4.5.95.4" end From b2ad4647348199c6c64b107e5cc26debaac07bdc Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Sun, 12 Jul 2015 23:46:34 -0500 Subject: [PATCH 108/117] v4.5.95.5 - binary release series --- lib/libv8/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index ef0cac2c..075efb88 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,3 @@ module Libv8 - VERSION = "4.5.95.4" + VERSION = "4.5.95.5" end From f5dc4299cb95e68daa1531b8332bf3895260bd41 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 13 Jul 2015 15:41:02 +0300 Subject: [PATCH 109/117] Instruct GYP to create a standalone static library --- ext/libv8/builder.rb | 4 ---- patches/build-standalone-static-library.patch | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 patches/build-standalone-static-library.patch diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index bca76634..02d76160 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -34,10 +34,6 @@ def gyp_defines(*defines) end def make_flags(*flags) - # Fix Malformed archive issue caused by GYP creating thin archives by - # default. - flags << "standalone_static_library=1" - # Disable i18n flags << 'i18nsupport=off' diff --git a/patches/build-standalone-static-library.patch b/patches/build-standalone-static-library.patch new file mode 100644 index 00000000..994c3224 --- /dev/null +++ b/patches/build-standalone-static-library.patch @@ -0,0 +1,14 @@ +diff --git a/build/standalone.gypi b/build/standalone.gypi +index b6519c4..ef9e7c5 100644 +--- a/build/standalone.gypi ++++ b/build/standalone.gypi +@@ -373,6 +373,9 @@ + }], + ], + 'target_conditions': [ ++ ['_type=="static_library"', { ++ 'standalone_static_library': 1, ++ }], + ['v8_code == 0', { + 'defines!': [ + 'DEBUG', From 0f9667847096c1f20f7e784ea009c43d8835b1db Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 13 Jul 2015 15:38:03 -0500 Subject: [PATCH 110/117] enhance the binary builders by * doing a full clone of the depot tools. I thought that I could save some time, but it means that building the binaries is not idempotent * using rvm instead of system ruby --- Rakefile | 3 +-- release/x86-linux/Vagrantfile | 14 +++++++++----- release/x86_64-linux/Vagrantfile | 14 +++++++++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Rakefile b/Rakefile index 49754df0..e43da122 100644 --- a/Rakefile +++ b/Rakefile @@ -57,8 +57,7 @@ namespace :build do arch_dir = Pathname(__FILE__).dirname.join("release/#{arch}") Dir.chdir(arch_dir) do sh "vagrant up" - sh "vagrant ssh -c 'rm -rf libv8 && git clone /libv8/.git libv8'" - sh "vagrant ssh -c 'cd libv8 && git submodule update --init --depth=1'" + sh "vagrant ssh -c 'rm -rf libv8 && git clone --recursive /libv8/.git libv8'" sh "vagrant ssh -c 'cd libv8 && bundle install --path vendor/bundle'" sh "vagrant ssh -c 'cd libv8 && bundle exec rake binary'" sh "vagrant ssh -c 'cp libv8/pkg/*.gem /vagrant'" diff --git a/release/x86-linux/Vagrantfile b/release/x86-linux/Vagrantfile index be2221b4..1848475e 100644 --- a/release/x86-linux/Vagrantfile +++ b/release/x86-linux/Vagrantfile @@ -66,10 +66,14 @@ Vagrant.configure(2) do |config| # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL - sudo apt-get update - sudo apt-get install -y gcc-4.8 g++-4.8 build-essential git git-svn python ruby ruby-dev - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 - sudo update-alternatives --config gcc - gem install bundler + apt-get update + apt-get install -y gcc-4.8 g++-4.8 build-essential git git-svn python ruby ruby-dev emacs + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 + update-alternatives --config gcc + su -c 'gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3' - vagrant + su -c '\\curl -sSL https://get.rvm.io | bash -s stable' - vagrant + su -c 'rvm install 2.2.2 --disable-binary' - vagrant + su -c 'rvm --default use 2.2.2' - vagrant + su -c 'gem install bundler' - vagrant SHELL end diff --git a/release/x86_64-linux/Vagrantfile b/release/x86_64-linux/Vagrantfile index f06a1ed0..7deda6f7 100644 --- a/release/x86_64-linux/Vagrantfile +++ b/release/x86_64-linux/Vagrantfile @@ -66,10 +66,14 @@ Vagrant.configure(2) do |config| # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL - sudo apt-get update - sudo apt-get install -y gcc-4.8 g++-4.8 build-essential git git-svn python ruby ruby-dev - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 - sudo update-alternatives --config gcc - gem install bundler + apt-get update + apt-get install -y gcc-4.8 g++-4.8 build-essential git git-svn python ruby ruby-dev emacs + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 + update-alternatives --config gcc + su -c 'gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3' - vagrant + su -c '\\curl -sSL https://get.rvm.io | bash -s stable' - vagrant + su -c 'rvm install 2.2.2 --disable-binary' - vagrant + su -c 'rvm --default use 2.2.2' - vagrant + su -c 'gem install bundler' - vagrant SHELL end From 0fa385da8614adbfd2de6bf1cecc0eec7cdf0137 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 15 Jul 2015 01:23:14 +0300 Subject: [PATCH 111/117] Add a 64-bit FreeBSD 10.1 build --- Rakefile | 2 +- ext/libv8/builder.rb | 2 + release/x86_64-freebsd10/Vagrantfile | 79 ++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 release/x86_64-freebsd10/Vagrantfile diff --git a/Rakefile b/Rakefile index e43da122..e049211a 100644 --- a/Rakefile +++ b/Rakefile @@ -51,7 +51,7 @@ task :binary => :compile do end namespace :build do - ['x86_64-linux', 'x86-linux'].each do |arch| + ['x86_64-linux', 'x86-linux', 'x86_64-freebsd10'].each do |arch| desc "build binary gem for #{arch}" task arch do arch_dir = Pathname(__FILE__).dirname.join("release/#{arch}") diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 02d76160..1fd622b8 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -99,10 +99,12 @@ def setup_build_deps! Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do system "fetch v8" or fail "unable to fetch v8 source" Dir.chdir('v8') do + system "git checkout Makefile" # Work around a weird bug on FreeBSD unless system "git checkout #{source_version}" fail "unable to checkout source for v8 #{source_version}" end system "gclient sync" or fail "could not sync v8 build dependencies" + system "git checkout Makefile" # Work around a weird bug on FreeBSD end end end diff --git a/release/x86_64-freebsd10/Vagrantfile b/release/x86_64-freebsd10/Vagrantfile new file mode 100644 index 00000000..0c934b80 --- /dev/null +++ b/release/x86_64-freebsd10/Vagrantfile @@ -0,0 +1,79 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure(2) do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://atlas.hashicorp.com/search. + config.vm.box = "ignisf/freebsd10.1" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + # config.vm.guest = :freebsd + # config.vm.network "private_network", ip: "10.0.1.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + config.vm.synced_folder ".", "/vagrant", type: :rsync + config.vm.synced_folder "../..", "/libv8", type: :rsync + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies + # such as FTP and Heroku are also available. See the documentation at + # https://docs.vagrantup.com/v2/push/atlas.html for more information. + # config.push.define "atlas" do |push| + # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" + # end + + # Enable provisioning with a shell script. Additional provisioners such as + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the + # documentation for more information about their specific syntax and use. + # config.vm.provision "shell", inline: <<-SHELL + # sudo apt-get update + # sudo apt-get install -y apache2 + # SHELL + + config.vm.provision "shell", inline: <<-SHELL + sudo pkg install -y gmake ruby rubygem-bundler git-subversion python2 + SHELL +end From 10e62c806976bcce5966d5fc2cb5e54b046183fd Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 15 Jul 2015 01:54:18 +0300 Subject: [PATCH 112/117] Add amd64 to arch detection --- ext/libv8/arch.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/libv8/arch.rb b/ext/libv8/arch.rb index 8f48d886..cc6862cd 100644 --- a/ext/libv8/arch.rb +++ b/ext/libv8/arch.rb @@ -6,10 +6,10 @@ module Arch def libv8_arch case Gem::Platform.local.cpu - when /^arm$/ then 'arm' - when /^a(rm|arch)64$/ then 'arm64' - when /^x86$/ then 'ia32' - when /^x86_64$/ then 'x64' + when /^arm$/ then 'arm' + when /^a(rm|arch)64$/ then 'arm64' + when /^x86$/ then 'ia32' + when /^(x86_64|amd64)$/ then 'x64' else warn "Unsupported target: #{Gem::Platform.local.cpu}" Gem::Platform.local.cpu From 9d305e1ea0c18a43348f405f28bab5b8846c32b6 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 15 Jul 2015 02:12:15 +0300 Subject: [PATCH 113/117] Use NFS for Vagrant shared folders for FreeBSD --- release/x86_64-freebsd10/Vagrantfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/release/x86_64-freebsd10/Vagrantfile b/release/x86_64-freebsd10/Vagrantfile index 0c934b80..0f2b150e 100644 --- a/release/x86_64-freebsd10/Vagrantfile +++ b/release/x86_64-freebsd10/Vagrantfile @@ -39,9 +39,11 @@ Vagrant.configure(2) do |config| # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. - # config.vm.synced_folder "../data", "/vagrant_data" - config.vm.synced_folder ".", "/vagrant", type: :rsync - config.vm.synced_folder "../..", "/libv8", type: :rsync + #config.vm.synced_folder ".", "/vagrant", type: :rsync + #config.vm.synced_folder "../..", "/libv8", type: :rsync + + config.vm.synced_folder ".", "/vagrant", nfs: true + config.vm.synced_folder "../..", "/libv8", nfs: true # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. From 4152edfae14363b56c146361fc5cf42fdb76c12f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 15 Jul 2015 18:11:05 +0300 Subject: [PATCH 114/117] Confiure the host-only network adapter for FreeBSD NFS requires a host-only network to be present. --- release/x86_64-freebsd10/Vagrantfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/release/x86_64-freebsd10/Vagrantfile b/release/x86_64-freebsd10/Vagrantfile index 0f2b150e..e0a4fe3f 100644 --- a/release/x86_64-freebsd10/Vagrantfile +++ b/release/x86_64-freebsd10/Vagrantfile @@ -26,9 +26,7 @@ Vagrant.configure(2) do |config| # Create a private network, which allows host-only access to the machine # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - # config.vm.guest = :freebsd - # config.vm.network "private_network", ip: "10.0.1.10" + config.vm.network "private_network", ip: "10.0.1.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on From 6b57f9dd3e257f5f520ef4174b89b63fd8c4e929 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Fri, 17 Jul 2015 13:38:47 +0300 Subject: [PATCH 115/117] Install and use g++ 4.8 in Travis --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index cb194d2e..ff16881b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,3 +30,13 @@ notifications: - bordjukov@gmail.com cache: bundler sudo: false +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-4.8 + - g++-4.8 + - clang +env: + - CXX=g++-4.8 From bc7e50c1c6bc89954bc853de40e30ff5b6a26ea7 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 18 Jul 2015 02:45:11 +0300 Subject: [PATCH 116/117] Add a Requirements section and update the README --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cca6bdde..1fb493b3 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,16 @@ distribution > This step release system is a workaround to carlhuda/bundler#1537 +### Requirements + +Building the v8 library from source imposes the following requirements: + +* A compiler that supports C++11 (such as GCC 4.8 and above or clang, +preferably 3.5 and above) +* GNU Make +* Python 2 +* git-svn + ### Using a git version If you want to use the latest unstable version of the gem you can do @@ -74,15 +84,14 @@ You can find more info on using a git repo as a gem source in ### What if I can't install from source? -If you can fix the "Makefile" so that it correctly compiles for your +If you can fix v8's build system so that it correctly compiles for your platform, we'll pull it right in! To get the source, these commands will get you started: - git clone git://github.com/cowboyd/libv8.git + git clone --recursive git://github.com/cowboyd/libv8.git cd libv8 bundle install - bundle exec rake checkout bundle exec rake compile ### Bring your own V8 @@ -101,9 +110,15 @@ Using Bundler (in your Gemfile): bundle config build.libv8 --with-system-v8 +#### Gotchas + Please note that if you intend to run your own V8, you must install both V8 *and its headers* (found in libv8-dev for Debian distros). +Also keep in mind that v8's API does not tend to be stable and you need to make +sure that the version of therubyracer you intend to use is compatible with the +version of v8 present on your system. Otherwise therubyracer's build will fail. + ### Bring your own compiler You can specify a compiler of your choice by either setting the `CXX` From 1f540a258288b1bcde671f17624dcb77e2f889e1 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 18 Jul 2015 03:01:09 +0300 Subject: [PATCH 117/117] Remove stale patches for arm and Apple clang 5.1 These patches were not getting applied anyway. If the arm patches are still needed, they will be applied as necessary at a later stage. --- patches/arm/do-not-imply-vfp3-and-armv7.patch | 16 ---------------- patches/arm/do-not-use-vfp2.patch | 13 ------------- patches/clang51/no-unused-variable.patch | 12 ------------ 3 files changed, 41 deletions(-) delete mode 100644 patches/arm/do-not-imply-vfp3-and-armv7.patch delete mode 100644 patches/arm/do-not-use-vfp2.patch delete mode 100644 patches/clang51/no-unused-variable.patch diff --git a/patches/arm/do-not-imply-vfp3-and-armv7.patch b/patches/arm/do-not-imply-vfp3-and-armv7.patch deleted file mode 100644 index 891ab35c..00000000 --- a/patches/arm/do-not-imply-vfp3-and-armv7.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/build/standalone.gypi b/build/standalone.gypi -index 125c5bf..9900c5b 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -77,9 +77,9 @@ - }], - ], - # Default ARM variable settings. -- 'armv7%': 1, -+ 'armv7%': 0, - 'arm_neon%': 0, -- 'arm_fpu%': 'vfpv3', -+ 'arm_fpu%': 'vfp', - }, - 'target_defaults': { - 'default_configuration': 'Debug', diff --git a/patches/arm/do-not-use-vfp2.patch b/patches/arm/do-not-use-vfp2.patch deleted file mode 100644 index 7b413a46..00000000 --- a/patches/arm/do-not-use-vfp2.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/build/common.gypi b/build/common.gypi -index 3a59639..594abe4 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -173,7 +173,6 @@ - [ 'v8_use_arm_eabi_hardfloat=="true"', { - 'defines': [ - 'USE_EABI_HARDFLOAT=1', -- 'CAN_USE_VFP2_INSTRUCTIONS', - ], - 'target_conditions': [ - ['_toolset=="target"', { - diff --git a/patches/clang51/no-unused-variable.patch b/patches/clang51/no-unused-variable.patch deleted file mode 100644 index 3b39349c..00000000 --- a/patches/clang51/no-unused-variable.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/build/standalone.gypi b/build/standalone.gypi -index 125c5bf..a283a28 100644 ---- a/build/standalone.gypi -+++ b/build/standalone.gypi -@@ -210,6 +212,7 @@ - '-Wendif-labels', - '-W', - '-Wno-unused-parameter', -+ '-Wno-unused-variable', - '-Wnon-virtual-dtor', - ], - },