Skip to content

Commit

Permalink
Various tweaks to make gherkin build on Lion
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Mar 16, 2012
1 parent 2b12bbf commit ac817b3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.9.1](https://github.com/cucumber/gherkin/compare/v2.9.0...v2.9.1)

* The build system and instruction has been updated to work on OS X Lion. (Aslak Hellesøy)

## [2.9.0](https://github.com/cucumber/gherkin/compare/v2.8.0...v2.9.0)

* Added output to Reporter API (Aslak Hellesøy)
Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ TODO: Make all specs pass with js lexer - replace 'c(listener)' with 'js(listene

### .NET dll

You must install Mono from source, or use a release of Mono after November 18 2011.
You must install Mono SDK 2.10.8 or newer.

You must also download NuGet.exe from [CodePlex](http://nuget.codeplex.com/releases) and place it in `/usr/local/nuget/NuGet.exe`. When it's installed, update it and register your NuGet API Key:

# In case we need to update
mono /usr/local/nuget/NuGet.exe Update -self

# The key is at http://nuget.org/Contribute/MyAccount
# The key is at https://nuget.org/account
mono /usr/local/nuget/NuGet.exe SetApiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx

Now you can build the .NET dll with:
Expand All @@ -177,17 +177,30 @@ This should put the dll into `release/nuspec/lib/gherkin.dll`
### MinGW Rubies (for Windows gems)

In order to build Windows binaries (so we can release Windows gems from OS X/Linux) we first need to install MinGW.
On OS X, download prebuilt binaries (version 4.3.0) from http://crossgcc.rts-software.org/doku.php.
Unpack it under /usr/local and add it to your PATH, typically in your `~/.bashrc`:
Follow the MinGW installation instructions from the [rake-compiler](https://github.com/luislavena/rake-compiler) project.
IMPORTANT! You may have to get an older version - gcc 4.7.0 is experimental. See [this issue](https://github.com/luislavena/rake-compiler/issues/50)

export PATH=$PATH:/usr/local/i386-mingw32-4.3.0/bin
Now, make sure you have openssl installed:

brew install openssl

Next, we're going to install Ruby 1.8.7 and Ruby 1.9.3 for MinGW. We need both versions so we can build Windows binaries for both.
OS X Lion (or later) doesn't ship with an LLVM free gcc, which you will need in order to install ruby 1.8.7. We can install it with:

brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/apple-gcc42.rb
export CC=gcc-4.2

For more info see:

* http://stackoverflow.com/questions/6170813/why-cant-i-install-rails-on-lion-using-rvm
* https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers

Now we need to set up [rake-compiler](http://github.com/luislavena/rake-compiler/)
We'll start by installing some rubies.
First, set the `CC` variable to your mingw32-gcc, for example:

Make sure you have openssl installed first.
export CC=/usr/local/mingw/bin/i686-w64-mingw32-gcc

brew install openssl
Now, let's install some rubies:

# 1.8.7
rvm install 1.8.7-p352
Expand All @@ -200,14 +213,14 @@ Make sure you have openssl installed first.
rake-compiler cross-ruby VERSION=1.8.7-p352

# 1.9.3
rvm install 1.9.3-p0
rvm use 1.9.3-p0
rvm install 1.9.3-p125
rvm use 1.9.3-p125
rvm gemset create cucumber
rvm gemset use cucumber
gem install bundler
unset GHERKIN_JS
bundle install
rake-compiler cross-ruby VERSION=1.9.3-p0
rake-compiler cross-ruby VERSION=1.9.3-p125

Now you can build Windows gems:

Expand Down
2 changes: 1 addition & 1 deletion gherkin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Gem::Specification.new do |s|
s.files += Dir['lib/gherkin/rb_lexer/*.rb']
s.files += Dir['ext/**/*.c']
s.extensions = Dir['ext/**/extconf.rb']
s.add_development_dependency('rake-compiler', '>= 0.7.9')
s.add_development_dependency('rake-compiler', '>= 0.8.0')
end
s.files -= Dir['**/.gitignore']

Expand Down
5 changes: 3 additions & 2 deletions tasks/ikvm.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace :ikvm do

def mono(args)
if(`which mono`.strip =~ /mono/)
sh("mono #{args}")
# http://monomvc.wordpress.com/2012/03/06/nuget-on-mono/
sh("mono --runtime=v4.0.30319 #{args}")
else
raise "[ERROR] You must install Mono and IKVM build gherkin for .NET. See README.md"
end
Expand All @@ -26,7 +27,7 @@ namespace :ikvm do
mono("#{IKVMC_EXE} #{args}")
rescue => e
if e.message =~ /Cannot open assembly/
e.message << "\n\n[ERROR] You must install Mono and IKVM build gherkin for .NET. See README.rdoc"
e.message << "\n\n[ERROR] You must install Mono and IKVM build gherkin for .NET. See README.md"
end
raise e
end
Expand Down

0 comments on commit ac817b3

Please sign in to comment.