2011-05-24 14:17:58 -04:00
|
|
|
require 'bundler/setup'
|
2012-04-25 23:46:30 -04:00
|
|
|
require 'rspec/core/rake_task'
|
2014-06-14 05:26:44 -04:00
|
|
|
|
|
|
|
Bundler::GemHelper.install_tasks
|
2014-06-17 09:01:04 -04:00
|
|
|
RSpec::Core::RakeTask.new :spec
|
2011-05-24 14:17:58 -04:00
|
|
|
|
2017-07-21 14:34:58 -04:00
|
|
|
DISTRIBUTIONS = [
|
|
|
|
'x86_64-linux',
|
|
|
|
'x86-linux',
|
|
|
|
'x86_64-freebsd-10',
|
|
|
|
'x86_64-freebsd-11',
|
|
|
|
'amd64-freebsd-10',
|
|
|
|
'amd64-freebsd-11',
|
|
|
|
'arm-linux',
|
2017-07-26 11:16:19 -04:00
|
|
|
'aarch64-linux',
|
2017-07-21 18:29:43 -04:00
|
|
|
# 'x86_64-linux-musl'
|
2017-07-21 14:34:58 -04:00
|
|
|
]
|
|
|
|
|
2014-06-14 05:26:44 -04:00
|
|
|
module Helpers
|
|
|
|
module_function
|
2014-06-17 07:46:26 -04:00
|
|
|
def binary_gemspec(platform = Gem::Platform.local)
|
2014-06-17 09:01:04 -04:00
|
|
|
gemspec = eval(File.read 'libv8.gemspec')
|
2014-06-17 07:46:26 -04:00
|
|
|
gemspec.platform = platform
|
2014-06-14 05:26:44 -04:00
|
|
|
gemspec
|
|
|
|
end
|
2012-05-12 06:38:07 -04:00
|
|
|
|
2014-06-17 07:46:26 -04:00
|
|
|
def binary_gem_name(platform = Gem::Platform.local)
|
|
|
|
File.basename binary_gemspec(platform).cache_file
|
2014-06-14 05:26:44 -04:00
|
|
|
end
|
2013-05-15 08:09:49 -04:00
|
|
|
end
|
|
|
|
|
2012-04-26 11:28:27 -04:00
|
|
|
desc "compile v8 via the ruby extension mechanism"
|
2015-07-03 03:53:25 -04:00
|
|
|
task :compile do
|
2012-04-26 11:28:27 -04:00
|
|
|
sh "ruby ext/libv8/extconf.rb"
|
|
|
|
end
|
|
|
|
|
2014-06-14 05:26:44 -04:00
|
|
|
desc "build a binary gem #{Helpers.binary_gem_name}"
|
2012-06-21 08:55:00 -04:00
|
|
|
task :binary => :compile do
|
2014-06-14 06:32:45 -04:00
|
|
|
gemspec = Helpers.binary_gemspec
|
2012-07-02 00:10:13 -04:00
|
|
|
gemspec.extensions.clear
|
2014-06-14 06:32:45 -04:00
|
|
|
|
2012-04-25 23:26:17 -04:00
|
|
|
# We don't need most things for the binary
|
2013-01-04 16:41:18 -05:00
|
|
|
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']
|
2014-06-14 06:32:45 -04:00
|
|
|
|
2012-04-25 23:26:17 -04:00
|
|
|
# V8
|
2015-07-10 17:19:36 -04:00
|
|
|
gemspec.files += Dir['vendor/v8/include/**/*.h']
|
2012-05-01 18:04:47 -04:00
|
|
|
gemspec.files += Dir['vendor/v8/out/**/*.a']
|
2014-06-14 06:32:45 -04:00
|
|
|
|
2014-06-17 04:09:39 -04:00
|
|
|
FileUtils.chmod 0644, gemspec.files
|
2012-04-25 23:26:17 -04:00
|
|
|
FileUtils.mkdir_p 'pkg'
|
2014-06-14 06:32:45 -04:00
|
|
|
|
2013-03-22 11:53:42 -04:00
|
|
|
package = if Gem::VERSION < '2.0.0'
|
2013-03-28 10:04:22 -04:00
|
|
|
Gem::Builder.new(gemspec).build
|
2013-03-22 11:53:42 -04:00
|
|
|
else
|
|
|
|
require 'rubygems/package'
|
2014-06-17 09:01:04 -04:00
|
|
|
Gem::Package.build gemspec
|
2013-03-22 11:53:42 -04:00
|
|
|
end
|
2014-06-14 06:32:45 -04:00
|
|
|
|
2014-06-17 09:01:04 -04:00
|
|
|
FileUtils.mv package, 'pkg'
|
2012-04-25 23:26:17 -04:00
|
|
|
end
|
|
|
|
|
framework for building binary gems
I'm tired of our releases getting held up because building the binaries
is such a yak shave. We're in dire need of some automation. I tried
spiking some things out with Docker, but for the time being, it was
easier to just go with Vagrant.
Currently, our release process for binary gems involves
1. a source release at an even point (e.g. 3.16.14.8)
2. a version bump to serve as the basis for binary releases
3. a mish-mash of gem builds and pushes for osx, linux, freebsd, etc...
In order to make things eaiser for us to manage these binary builds, I'm
proposing a standardized build using Vagrant. For each supported
release, a Vagrant file goes into /release/<arch>/Vagrantfile
The vagrantfile is responsible for provisioning a modern
ruby toolchain including bundler, git, git-svn, ruby and ruby source and
headers.
It should also clone the libv8 source into the /libv8
This can then be used to build the binary gem for that platform.
This PR includes the Vagrantfile for x86_64-linux
2015-06-26 19:36:57 -04:00
|
|
|
namespace :build do
|
2017-07-21 14:34:58 -04:00
|
|
|
DISTRIBUTIONS.each do |arch|
|
framework for building binary gems
I'm tired of our releases getting held up because building the binaries
is such a yak shave. We're in dire need of some automation. I tried
spiking some things out with Docker, but for the time being, it was
easier to just go with Vagrant.
Currently, our release process for binary gems involves
1. a source release at an even point (e.g. 3.16.14.8)
2. a version bump to serve as the basis for binary releases
3. a mish-mash of gem builds and pushes for osx, linux, freebsd, etc...
In order to make things eaiser for us to manage these binary builds, I'm
proposing a standardized build using Vagrant. For each supported
release, a Vagrant file goes into /release/<arch>/Vagrantfile
The vagrantfile is responsible for provisioning a modern
ruby toolchain including bundler, git, git-svn, ruby and ruby source and
headers.
It should also clone the libv8 source into the /libv8
This can then be used to build the binary gem for that platform.
This PR includes the Vagrantfile for x86_64-linux
2015-06-26 19:36:57 -04:00
|
|
|
desc "build binary gem for #{arch}"
|
|
|
|
task arch do
|
|
|
|
arch_dir = Pathname(__FILE__).dirname.join("release/#{arch}")
|
|
|
|
Dir.chdir(arch_dir) do
|
2016-05-03 17:56:57 -04:00
|
|
|
ENV['RUBYLIB'] = nil # https://github.com/mitchellh/vagrant/issues/6158
|
framework for building binary gems
I'm tired of our releases getting held up because building the binaries
is such a yak shave. We're in dire need of some automation. I tried
spiking some things out with Docker, but for the time being, it was
easier to just go with Vagrant.
Currently, our release process for binary gems involves
1. a source release at an even point (e.g. 3.16.14.8)
2. a version bump to serve as the basis for binary releases
3. a mish-mash of gem builds and pushes for osx, linux, freebsd, etc...
In order to make things eaiser for us to manage these binary builds, I'm
proposing a standardized build using Vagrant. For each supported
release, a Vagrant file goes into /release/<arch>/Vagrantfile
The vagrantfile is responsible for provisioning a modern
ruby toolchain including bundler, git, git-svn, ruby and ruby source and
headers.
It should also clone the libv8 source into the /libv8
This can then be used to build the binary gem for that platform.
This PR includes the Vagrantfile for x86_64-linux
2015-06-26 19:36:57 -04:00
|
|
|
sh "vagrant up"
|
2016-05-12 19:28:08 -04:00
|
|
|
sh "vagrant ssh -c 'rm -rf ~/libv8'"
|
|
|
|
sh "vagrant ssh -c 'git clone /libv8/.git ~/libv8 --recursive'"
|
2016-05-03 17:56:57 -04:00
|
|
|
sh "vagrant ssh -c 'cd ~/libv8 && bundle install --path vendor/bundle'"
|
2017-07-18 15:43:38 -04:00
|
|
|
sh "vagrant ssh -c 'cd ~/libv8 && env MAKEFLAGS=-j4 bundle exec rake binary'"
|
2017-07-21 07:00:55 -04:00
|
|
|
sh "vagrant status | grep scaleway" do |ok, res|
|
|
|
|
if ok
|
|
|
|
sh "vagrant ssh --no-tty -c 'cd ~/libv8/pkg && tar -cf - *.gem' 2>/dev/null | tar -xv"
|
|
|
|
else
|
|
|
|
sh "vagrant ssh -c 'cp ~/libv8/pkg/*.gem /vagrant'"
|
|
|
|
end
|
2017-07-18 15:19:40 -04:00
|
|
|
end
|
2016-11-21 13:43:55 -05:00
|
|
|
sh "vagrant destroy -f"
|
framework for building binary gems
I'm tired of our releases getting held up because building the binaries
is such a yak shave. We're in dire need of some automation. I tried
spiking some things out with Docker, but for the time being, it was
easier to just go with Vagrant.
Currently, our release process for binary gems involves
1. a source release at an even point (e.g. 3.16.14.8)
2. a version bump to serve as the basis for binary releases
3. a mish-mash of gem builds and pushes for osx, linux, freebsd, etc...
In order to make things eaiser for us to manage these binary builds, I'm
proposing a standardized build using Vagrant. For each supported
release, a Vagrant file goes into /release/<arch>/Vagrantfile
The vagrantfile is responsible for provisioning a modern
ruby toolchain including bundler, git, git-svn, ruby and ruby source and
headers.
It should also clone the libv8 source into the /libv8
This can then be used to build the binary gem for that platform.
This PR includes the Vagrantfile for x86_64-linux
2015-06-26 19:36:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-07-03 03:53:25 -04:00
|
|
|
end
|
framework for building binary gems
I'm tired of our releases getting held up because building the binaries
is such a yak shave. We're in dire need of some automation. I tried
spiking some things out with Docker, but for the time being, it was
easier to just go with Vagrant.
Currently, our release process for binary gems involves
1. a source release at an even point (e.g. 3.16.14.8)
2. a version bump to serve as the basis for binary releases
3. a mish-mash of gem builds and pushes for osx, linux, freebsd, etc...
In order to make things eaiser for us to manage these binary builds, I'm
proposing a standardized build using Vagrant. For each supported
release, a Vagrant file goes into /release/<arch>/Vagrantfile
The vagrantfile is responsible for provisioning a modern
ruby toolchain including bundler, git, git-svn, ruby and ruby source and
headers.
It should also clone the libv8 source into the /libv8
This can then be used to build the binary gem for that platform.
This PR includes the Vagrantfile for x86_64-linux
2015-06-26 19:36:57 -04:00
|
|
|
|
2017-07-21 14:34:58 -04:00
|
|
|
desc "Build binary gems for all supported distributions"
|
2017-07-21 18:29:43 -04:00
|
|
|
task :binary_release => [:build] + DISTRIBUTIONS.map {|distribution| "build:#{distribution}"} do
|
|
|
|
sh "cd #{File.dirname(__FILE__)} && mkdir -p pkg"
|
|
|
|
sh "cd #{File.dirname(__FILE__)} && mv release/**/*.gem pkg/"
|
|
|
|
end
|
2017-07-21 14:34:58 -04:00
|
|
|
|
2014-06-16 19:38:41 -04:00
|
|
|
task :clean_submodules do
|
|
|
|
sh "git submodule --quiet foreach git reset --hard"
|
2014-06-17 08:16:02 -04:00
|
|
|
sh "git submodule --quiet foreach git clean -dxf"
|
2015-07-05 09:35:33 -04:00
|
|
|
sh "git submodule update --init"
|
2014-06-16 19:38:41 -04:00
|
|
|
end
|
|
|
|
|
2012-04-25 23:26:17 -04:00
|
|
|
desc "clean up artifacts of the build"
|
2014-06-16 19:38:41 -04:00
|
|
|
task :clean => [:clean_submodules] do
|
2012-04-25 23:46:30 -04:00
|
|
|
sh "rm -rf pkg"
|
2015-07-03 16:02:43 -04:00
|
|
|
sh "git clean -dxf -e .bundle -e vendor/bundle"
|
2011-06-15 16:55:18 -04:00
|
|
|
end
|
|
|
|
|
2014-06-14 05:26:44 -04:00
|
|
|
task :default => [:compile, :spec]
|
2015-07-03 15:55:40 -04:00
|
|
|
task :build => [:clean]
|