Skip to content

Commit 3709021

Browse files
committed
Merge branch 'master' of github.com:tjschuck/rake-compiler-dev-box
2 parents 0104654 + e37b7cd commit 3709021

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ All of your gem binaries will be put into `pkg`:
6464

6565
Happy compiling!
6666

67+
### Limiting Target Rubies
68+
69+
Some gems might choose to not support older versions of Ruby (like [Nokogiri](http://nokogiri.org), which no longer supports 1.8).
70+
71+
If you wish to limit the versions of Ruby that your cross-compiled Windows binaries supports, you can use the environment variables `BASE_VERSION` and `RUBY_CC_VERSION`:
72+
73+
* `BASE_VERSION`: the native version of Ruby that will be used as a base for cross-compilation
74+
75+
* `RUBY_CC_VERSION`: a colon-separated list of target versions for cross-compilation
76+
77+
_Note: If you wish to target 1.8.x, your base version must be 1.8.x -- versions 1.9+ cannot cross-build 1.8._
78+
79+
#### Examples:
80+
81+
Use Ruby 1.9.3 to cross-compile a fat binary that includes 1.9 and 2.0 binaries:
82+
83+
vagrant@precise64:/vagrant$ BASE_VERSION=1.9.3 RUBY_CC_VERSION=1.9.3:2.0.0 package_all nokogiri
84+
85+
Use Ruby 2.0.0 to cross-compile a fat binary that includes 2.0 and 2.1 binaries:
86+
87+
vagrant@precise64:/vagrant$ BASE_VERSION=2.0.0 RUBY_CC_VERSION=2.0.0:2.1.3 package_all nokogiri
88+
89+
By default, with no environment variables, rake-compiler-dev-box will try to cross-compile for all available versions, using 1.8 as a base.
90+
6791
## VM Management
6892

6993
Log out of the virtual machine (`exit` or `^D`).

bin/package_win32_fat_binary

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ cd '/vagrant'
1212
# passed in path of gem to be cross-compiled
1313
cd $1
1414

15+
base_version=${BASE_VERSION:-1.8.7-p374}
16+
cc_versions=${RUBY_CC_VERSION:-1.8.7:1.9.3:2.0.0:2.1.3}
17+
1518
# need to use 1.8.7 for fat-binaries (1.9.3 can't cross-build 1.8.7)
16-
rvm use 1.8.7
19+
rvm use $base_version
1720
bundle install
1821

1922
bundle exec rake clean
20-
bundle exec rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
23+
bundle exec rake cross native gem RUBY_CC_VERSION=$cc_versions

bin/prepare_xrubies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rvm all do gem install rake-compiler -v "~> 0.9.2"
1919
export MAKE="make"
2020

2121
# Build 1.8.7 with mingw32 compiler (GCC 4.2)
22-
rvm use 1.8.7
22+
rvm use 1.8.7-p374
2323
rake-compiler cross-ruby VERSION=1.8.7-p374 HOST=i586-mingw32msvc
2424

2525
# Build 1.9.3 using 1.9.3 as base

0 commit comments

Comments
 (0)