summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorLuis Lavena <luislavena@gmail.com>2008-11-29 04:33:46 -0200
committerLuis Lavena <luislavena@gmail.com>2008-11-29 04:33:46 -0200
commit0abc191c2d73ef8173f861a5ef24412b7de4d0bb (patch)
tree150a3f43d7fb942601ed326de2d10aa7c5ef7529 /features
parent46be5a30f21348bedacc510b5d808d003bb66e29 (diff)
downloadrake-compiler-0abc191c2d73ef8173f861a5ef24412b7de4d0bb.tar.gz
Checked in cross-compilation feature (WiP).
Diffstat (limited to 'features')
-rw-r--r--features/cross-compile.feature13
-rw-r--r--features/step_definitions/cross_compilation.rb15
2 files changed, 28 insertions, 0 deletions
diff --git a/features/cross-compile.feature b/features/cross-compile.feature
new file mode 100644
index 0000000..eb42cf7
--- /dev/null
+++ b/features/cross-compile.feature
@@ -0,0 +1,13 @@
+Feature: Cross-compile C extensions
+
+ In order to avoid bitching from Windows users
+ As a Ruby developer on Linux
+ I want some rake tasks that take away the pain of compilation
+
+ Scenario: compile single extension
+ Given that all my source files are in place
+ And I'm running a POSIX operating system
+ And I've installed cross compile toolchain
+ When rake task 'cross compile' is invoked
+ Then rake task 'cross compile' succeeded
+ And binaries for platform 'i386-mingw32' get generated
diff --git a/features/step_definitions/cross_compilation.rb b/features/step_definitions/cross_compilation.rb
new file mode 100644
index 0000000..ac78278
--- /dev/null
+++ b/features/step_definitions/cross_compilation.rb
@@ -0,0 +1,15 @@
+# Naive way of looking into platforms, please include others like FreeBSD?
+if RUBY_PLATFORM =~ /linux|darwin/
+ Given %r{^I'm running a POSIX operating system$} do
+ end
+end
+
+Given %r{^I've cross compile tools installed$} do
+ compiler = 'i586-mingw32msvc-gcc'
+ found = false
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
+ next unless File.exist?(File.join(path, compiler))
+ found = true
+ end
+ raise "Cannot locate '#{compiler}' in the PATH." unless found
+end