Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #108 from cosmo0920/use-rake-compiler-dock
Browse files Browse the repository at this point in the history
Use rake compiler dock

Patch by Hiroshi Hatake. Thanks!!!
  • Loading branch information
kou committed Oct 6, 2015
2 parents bfbb197 + a977d32 commit 1e2a565
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
41 changes: 32 additions & 9 deletions Rakefile
Expand Up @@ -148,16 +148,39 @@ namespace :clean do
end
end

desc "Build cross compile binary with Vagrant"
def cross_target_rubies
"2.0.0:2.1.6:2.2.2"
end

desc "Build cross compile binary with rake-compiler-dock"
namespace :build do
task :windows do
pkg_dir = "#{base_dir}/pkg"
mkdir pkg_dir unless File.exist?(pkg_dir)
cd "build/windows" do
sh("vagrant", "up")
cp(Dir.glob("pkg/rroonga-*-mingw32.gem"), pkg_dir)
sh("vagrant", "destroy", "-f")
end
task :windows => [:windows_x86, :windows_x64]
end

desc "Build cross compile binary with rake-compiler-dock for i386"
namespace :build do
task :windows_x86 do
require "rake_compiler_dock"
rm_rf binary_dir
RakeCompilerDock.sh %Q[
bundle
rake clean
rake cross native gem RUBY_CC_VERSION=\"#{cross_target_rubies}\"
]
end
end

desc "Build cross compile binary with rake-compiler-dock for x64"
namespace :build do
task :windows_x64 do
require "rake_compiler_dock"
rm_rf binary_dir
RakeCompilerDock.sh %Q[
bundle
rake clean
export RROONGA_USE_GROONGA_X64=true
rake cross native gem RUBY_CC_VERSION=\"#{cross_target_rubies}\"
]
end
end

Expand Down
14 changes: 6 additions & 8 deletions doc/text/cross-compile.md
Expand Up @@ -56,19 +56,17 @@ $ bundle exec rake clean:groonga
$ bundle exec rake RUBY_CC_VERSION=1.9.3:2.0.0:2.1.3 cross RROONGA_USE_GROONGA_X64=true clean native gem
```

# For Vagrant tool Users
# For rake-compiler-dock

Vagrant is provided in `Windows`, `OS X` and `Linux(deb)/Linux(rpm)`.
`rake-compiler-dock` depends `docker` and some platform requires docker client such as `docker-machine`.
Please install `docker` and docker client before cross compiling with `rake-compiler-dock`.

## execute vagrant
## cross compiling with rake-compiler-dock

`build\windows\` directory contains Vagrantfile and its provisioning scripts.

execute following command:
execute following rake task:

```bash
$ cd build\windows
$ vagrant up
$ bundle exec rake build:windows
```

Then, `pkg` directory is created. And cross compiled gems move into `pkg` directory.
1 change: 1 addition & 0 deletions rroonga.gemspec
Expand Up @@ -89,6 +89,7 @@ Gem::Specification.new do |s|
s.add_development_dependency("test-unit-notify")
s.add_development_dependency("rake")
s.add_development_dependency("rake-compiler", [">= 0.9.5"])
s.add_development_dependency("rake-compiler-dock", ["~> 0.4.3"])
s.add_development_dependency("bundler")
s.add_development_dependency("yard")
s.add_development_dependency("packnga", [">= 1.0.0"])
Expand Down

0 comments on commit 1e2a565

Please sign in to comment.