Allow cross-compiling Windows ruby extensions using mingw

OK pirofti@
This commit is contained in:
jeremy 2012-04-03 18:15:18 +00:00
parent 81992847f7
commit 0b6e3d3de8
3 changed files with 43 additions and 19 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.5 2011/09/16 09:24:58 espie Exp $
# $OpenBSD: Makefile,v 1.6 2012/04/03 18:15:18 jeremy Exp $
COMMENT = build and package Ruby extensions using Rake as glue
DISTNAME = rake-compiler-0.7.9
REVISION= 0
REVISION = 1
CATEGORIES = devel
HOMEPAGE = http://github.com/luislavena/rake-compiler

View File

@ -1,16 +1,29 @@
$OpenBSD: patch-lib_rake_extensiontask_rb,v 1.2 2010/12/21 17:15:14 jeremy Exp $
$OpenBSD: patch-lib_rake_extensiontask_rb,v 1.3 2012/04/03 18:15:18 jeremy Exp $
Include the mingw directory in the PATH if cross compiling.
Don't have it accidently use gmake, because the makefiles
created can use BSD make extensions.
--- lib/rake/extensiontask.rb.orig Fri Dec 10 12:15:51 2010
+++ lib/rake/extensiontask.rb Fri Dec 10 12:16:20 2010
@@ -349,7 +349,5 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/nativ
--- lib/rake/extensiontask.rb.orig Wed Dec 31 16:00:00 1969
+++ lib/rake/extensiontask.rb Wed Nov 30 04:25:41 2011
@@ -70,6 +70,8 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/nativ
# only define cross platform functionality when enabled
return unless @cross_compile
+ ENV['PATH'] = "${LOCALBASE}/mingw32/bin:#{ENV['PATH']}"
+
if cross_platform.is_a?(Array) then
cross_platform.each { |platf| define_cross_platform_tasks(platf) }
else
@@ -359,9 +361,7 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/nativ
if RUBY_PLATFORM =~ /mswin/ then
'nmake'
else
- ENV['MAKE'] || %w[gmake make].find { |c|
+ ENV['MAKE'] || '${MAKE_PROGRAM}'
- system("#{c} -v >> #{dev_null} 2>&1")
- }
+ ENV['MAKE'] || 'make'
end
end
@make

View File

@ -1,16 +1,27 @@
$OpenBSD: patch-tasks_bin_cross-ruby_rake,v 1.2 2010/12/21 17:15:14 jeremy Exp $
$OpenBSD: patch-tasks_bin_cross-ruby_rake,v 1.3 2012/04/03 18:15:18 jeremy Exp $
Don't have it accidently use gmake, because the makefiles
created can use BSD make extensions.
Include the mingw directory in the PATH as this file is only used
for cross-compilation.
--- tasks/bin/cross-ruby.rake.orig Fri Dec 10 12:16:03 2010
+++ tasks/bin/cross-ruby.rake Fri Dec 10 12:16:26 2010
@@ -33,7 +33,7 @@ end
Add the j flag to tar as all downloaded files are .tar.bz2.
--- tasks/bin/cross-ruby.rake.orig Wed Dec 31 16:00:00 1969
+++ tasks/bin/cross-ruby.rake Wed Nov 30 04:23:04 2011
@@ -17,6 +17,8 @@
# for cross-compilation.
#
require 'rake/extensioncompiler'
+ENV['PATH'] = "${LOCALBASE}/mingw32/bin:#{ENV['PATH']}"
+
require 'rake'
require 'rake/clean'
@@ -84,7 +86,7 @@ end
source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{RUBY_CC_VERSION}.tar.bz2"
file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}" => ["#{USER_HOME}/sources/#{source_file}"] do |t|
chdir File.dirname(t.name) do
- t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}" }
+ t.prerequisites.each { |f| sh "tar jxf #{File.basename(f)}" }
end
end
-MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
+MAKE = ENV['MAKE'] || '${MAKE_PROGRAM}'
USER_HOME = File.expand_path("~/.rake-compiler")
RUBY_CC_VERSION = "ruby-#{ENV['VERSION'] || '1.8.6-p398'}"
RUBY_SOURCE = ENV['SOURCE']