From 5c7c6e3966e4aece6f264c8c4bf75055bf7d0f96 Mon Sep 17 00:00:00 2001 From: nightpool Date: Fri, 17 Jul 2020 17:06:55 -0400 Subject: [PATCH 1/5] update to 8.4.371.19 This requires changing our checkout strategy to check out the branch-heads branch (as documented at https://v8.dev/docs/version-numbers) instead of using the 8.4.371 branch, which never gets patches (it's always locked to 8.4.371.0). We could also specify the v8 patch version manually, and i'm open to doing that, just wanted to do this to get it working. --- ext/libv8/builder.rb | 4 ++-- lib/libv8/version.rb | 3 ++- vendor/depot_tools | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 88716d55..a767ceca 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -65,7 +65,7 @@ def setup_python! # then this will be 4.5.95 # def source_version - Libv8::VERSION.gsub(/\.[^.]+$/, '') + Libv8::V8_MINOR_VERSION end ## @@ -84,7 +84,7 @@ def setup_build_deps! Dir.chdir('v8') do system 'git fetch origin' - unless system "git checkout #{source_version}" + unless system "git checkout branch-heads/#{source_version}" fail "unable to checkout source for v8 #{source_version}" end system "gclient sync" or fail "could not sync v8 build dependencies" diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index 54025723..ddd4ee06 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,3 +1,4 @@ module Libv8 - VERSION = "7.3.495.0" + V8_MINOR_VERSION = "8.4" + VERSION = "8.4.371.0" end diff --git a/vendor/depot_tools b/vendor/depot_tools index 9c062012..3229d944 160000 --- a/vendor/depot_tools +++ b/vendor/depot_tools @@ -1 +1 @@ -Subproject commit 9c0620120980e4c247ff8325ee8bbdcd4d9576e0 +Subproject commit 3229d944bfb4bc5983785f49cbc58f78872d8cb8 From c46dcba41aa1766d47bb93e97d594620c91b3c2a Mon Sep 17 00:00:00 2001 From: nightpool Date: Fri, 17 Jul 2020 17:07:05 -0400 Subject: [PATCH 2/5] Use last good version before build error Using bisect, I was able to find that the build error was introduced in https://github.com/v8/v8/commit/5bbca548e9841d25645e0ed077638b1d96bd1f07, so let's use the version before that one while we wait for upstream to merge the patch (https://bugs.chromium.org/p/v8/issues/detail?id=10708) --- CHANGELOG.md | 4 ++++ ext/libv8/builder.rb | 4 ++-- lib/libv8/version.rb | 3 +-- vendor/depot_tools | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81597410..b5c43c03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### v8.4.255.0 - 2020-07-15 + +* Update upstream v8 version to 8.4.255.0 + ### v7.3.495.0 - 2020-04-14 * Update upstream v8 version to 7.3.495.0 diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index a767ceca..88716d55 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -65,7 +65,7 @@ def setup_python! # then this will be 4.5.95 # def source_version - Libv8::V8_MINOR_VERSION + Libv8::VERSION.gsub(/\.[^.]+$/, '') end ## @@ -84,7 +84,7 @@ def setup_build_deps! Dir.chdir('v8') do system 'git fetch origin' - unless system "git checkout branch-heads/#{source_version}" + 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" diff --git a/lib/libv8/version.rb b/lib/libv8/version.rb index ddd4ee06..62cee7b5 100644 --- a/lib/libv8/version.rb +++ b/lib/libv8/version.rb @@ -1,4 +1,3 @@ module Libv8 - V8_MINOR_VERSION = "8.4" - VERSION = "8.4.371.0" + VERSION = "8.4.255.0" end diff --git a/vendor/depot_tools b/vendor/depot_tools index 3229d944..9d9199a5 160000 --- a/vendor/depot_tools +++ b/vendor/depot_tools @@ -1 +1 @@ -Subproject commit 3229d944bfb4bc5983785f49cbc58f78872d8cb8 +Subproject commit 9d9199a509bf792d7d24ac91d92ed0d111f8d9fb From 43902f09ea2282e5f6eeccf83608c1137c3c4375 Mon Sep 17 00:00:00 2001 From: nightpool Date: Fri, 17 Jul 2020 17:08:09 -0400 Subject: [PATCH 3/5] Bundle ICU data files Otherwise, attempts to use the i18n api (toLocaleString, Intl, etc) raise the TypeError 'Internal error. Icu error.' --- 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 88716d55..7836f5e5 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -23,7 +23,8 @@ def gn_args v8_use_external_startup_data=false target_cpu="#{libv8_arch}" v8_target_cpu="#{libv8_arch}" - treat_warnings_as_errors=false).join(' ') + treat_warnings_as_errors=false + icu_use_data_file=false).join(' ') end def generate_gn_args From 818cc4ef8479543d2cec92360740d74a59c08660 Mon Sep 17 00:00:00 2001 From: nightpool Date: Fri, 17 Jul 2020 17:08:14 -0400 Subject: [PATCH 4/5] Revamp Travis configuration files for automatic deployment We now build against three darwin versions (Sierra, High Sierra and Catalina) to match Ruby core. We continue to build against 3 ruby versions on Linux, but we only deploy the ruby 2.7 builds (since they should all be identical). --- .gitignore | 1 + .travis.yml | 18 ++++++++++------ README.md | 3 --- Rakefile | 61 +++++++++++++++++++++-------------------------------- 4 files changed, 36 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index feb18620..c7bac795 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ lib/libv8/VERSION /release/**/.scaleway /vendor/.gclient /vendor/.gclient_entries +/vendor/.cipd /vendor/v8/ diff --git a/.travis.yml b/.travis.yml index 42a4f668..65f84050 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,12 @@ rvm: - 2.5 matrix: include: - - rvm: 2.6 - os: osx - osx_image: xcode9.4.1 - fast_finish: true + - os: osx + osx_image: xcode12 + - os: osx + osx_image: xcode11.3 + - os: osx + osx_image: xcode10.1 addons: apt: packages: @@ -25,19 +27,21 @@ before_install: - if [ "$TRAVIS_OS_NAME" == "osx" -a "$TRAVIS_RUBY_VERSION" != "system" ]; then gem update bundler; fi script: - git submodule update --init - - bundle exec rake spec binary --trace + - bundle exec rake spec binary osx_varients --trace deploy: provider: releases - file: $(git ls-files -o pkg | head -1) + file_glob: true + file: pkg/*.gem api_key: secure: OMCBceg89uRnU+FIPAPbeOK2pISvV4Cz62r9iTRIGXQCOOXX8M40i77/3DmtkMtc9FEuNyAu1+CH886PL2WtZZPK4CmEU3HuqXz1a5VsCI+zcAZL1tevKvblXOVQ3MG+B/SZRC3rEzGwjk4027WtzCCGoGCLUu4TFJP05+/8XN4= skip_cleanup: true on: tags: true - # condition: $TRAVIS_OS_NAME = osx + rvm: '2.7' # Only deploy 1 of each platform cache: bundler: true notifications: recipients: - cowboyd@thefrontside.net - bordjukov@gmail.com + - nightpool@cybre.space diff --git a/README.md b/README.md index 308622bd..32e7eac4 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,6 @@ platforms. * x86_64-darwin-19 * x86_64-darwin-18 * x86_64-darwin-17 -* x86_64-darwin-16 -* x86_64-darwin-15 -* x86_64-darwin-14 * x86_64-linux * x86-linux diff --git a/Rakefile b/Rakefile index 44c6b408..1196a821 100644 --- a/Rakefile +++ b/Rakefile @@ -20,9 +20,20 @@ DISTRIBUTIONS = [ module Helpers module_function def binary_gemspec(platform = Gem::Platform.local) - gemspec = eval(File.read 'libv8.gemspec') - gemspec.platform = platform - gemspec + eval(File.read 'libv8.gemspec').tap do |gemspec| + gemspec.platform = platform + 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/location.rb', 'ext/libv8/paths.rb'] + gemspec.files += ['ext/libv8/.location.yml'] + + # V8 + gemspec.files += Dir['vendor/v8/include/**/*.h'] + gemspec.files += Dir['vendor/v8/out.gn/**/*.a'] + end end def binary_gem_name(platform = Gem::Platform.local) @@ -37,29 +48,14 @@ end desc "build a binary gem #{Helpers.binary_gem_name}" task :binary => :compile do - 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/location.rb', 'ext/libv8/paths.rb'] - gemspec.files += ['ext/libv8/.location.yml'] + require 'rubygems/package' - # V8 - gemspec.files += Dir['vendor/v8/include/**/*.h'] - gemspec.files += Dir['vendor/v8/out.gn/**/*.a'] + gemspec = Helpers.binary_gemspec FileUtils.chmod 0644, 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 - + package = Gem::Package.build gemspec FileUtils.mv package, 'pkg' end @@ -110,22 +106,13 @@ end task :default => [:compile, :spec] task :build => [:clean] -task :repack, [:gemfile, :new_arch] do |t, args| - dir = Dir::mktmpdir - - begin - sh "gem unpack #{args[:gemfile]} --target=#{dir}" - sh "gem spec #{args[:gemfile]} --ruby > #{dir}/repack.gemspec" - Dir.chdir(dir) do - sh "sed -iorig 's/^ s.platform = .*$/ s.platform = \"#{args[:new_arch]}\".freeze/' repack.gemspec" - Dir.chdir(Dir.glob("libv8-*/").first) do - sh 'mv ../repack.gemspec ./' - sh 'gem build repack.gemspec' - end - end +desc 'Generate OSX varient platform names' +task :osx_varients => [:compile] do + gemspec = binary_gemspec + return unless gemspec.platform == 'osx' - sh "mv #{dir}/*/*.gem ./pkg/" - ensure - FileUtils.remove_entry_secure dir + %w(x86_64 universal).each do |cpu| + gemspec.platform.cpu = cpu + Gem::Package.build gemspec end end From ffc7bb0c24e99a0da56dbef6ddb4bbc969c15ecb Mon Sep 17 00:00:00 2001 From: nightpool Date: Sat, 18 Jul 2020 12:24:54 -0400 Subject: [PATCH 5/5] bug fixes --- .travis.yml | 4 +++- Rakefile | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 65f84050..727b14eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,9 @@ before_install: - if [ "$TRAVIS_OS_NAME" == "osx" -a "$TRAVIS_RUBY_VERSION" != "system" ]; then gem update bundler; fi script: - git submodule update --init - - bundle exec rake spec binary osx_varients --trace + - bundle exec rake spec binary --trace +before_deploy: + - bundle exec rake osx_varients --trace deploy: provider: releases file_glob: true diff --git a/Rakefile b/Rakefile index 1196a821..a58bceab 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,7 @@ require 'bundler/setup' require 'rspec/core/rake_task' require 'tmpdir' +require 'rubygems/package' Bundler::GemHelper.install_tasks RSpec::Core::RakeTask.new :spec @@ -48,8 +49,6 @@ end desc "build a binary gem #{Helpers.binary_gem_name}" task :binary => :compile do - require 'rubygems/package' - gemspec = Helpers.binary_gemspec FileUtils.chmod 0644, gemspec.files @@ -106,13 +105,19 @@ end task :default => [:compile, :spec] task :build => [:clean] -desc 'Generate OSX varient platform names' -task :osx_varients => [:compile] do - gemspec = binary_gemspec - return unless gemspec.platform == 'osx' +desc 'Generate OSX varient platform names. Requires `compile` to already have been run.' +task :osx_varients do + gemspec = Helpers.binary_gemspec + next unless gemspec.platform.os == 'osx' %w(x86_64 universal).each do |cpu| - gemspec.platform.cpu = cpu - Gem::Package.build gemspec + platform = gemspec.platform.dup + next unless platform.cpu != cpu + + platform.cpu = cpu + gemspec.platform = platform + + package = Gem::Package.build gemspec + FileUtils.mv package, 'pkg' end end