mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
fix for MinGW MSYS shell
This commit is contained in:
parent
51d533eeed
commit
d75ae5a19c
1 changed files with 12 additions and 1 deletions
13
Rakefile
13
Rakefile
|
@ -58,12 +58,23 @@ task 'gem:precompile' => ['gem'] do
|
||||||
multi = rubies.size > 1
|
multi = rubies.size > 1
|
||||||
rubies.each { |ruby|
|
rubies.each { |ruby|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
# Convert MinGW's drive letters to Windows' ones
|
||||||
|
# e.g. /c/ruby/bin/ruby.exe => c:/ruby/bin/ruby.exe
|
||||||
|
ruby.gsub!(/^\/([a-zA-Z])\//, '\1:/')
|
||||||
|
|
||||||
lib_dir = 'lib'
|
lib_dir = 'lib'
|
||||||
if multi
|
if multi
|
||||||
major, minor, _ = `#{ruby} -e "print RUBY_VERSION"`.chomp.split('.')
|
major, minor, _ = `#{ruby} -e "print RUBY_VERSION"`.chomp.split('.')
|
||||||
lib_dir = File.join(lib_dir, [major, minor].join('.'))
|
lib_dir = File.join(lib_dir, [major, minor].join('.'))
|
||||||
end
|
end
|
||||||
make_cmd = (`#{ruby} -e "print RUBY_PLATFORM"` =~ /mswin/) ? 'nmake' : 'make'
|
|
||||||
|
target_platform = `#{ruby} -e "print RUBY_PLATFORM"`
|
||||||
|
# Convert MinGW's drive letters to Windows' ones
|
||||||
|
# e.g. --with-opencv-dir=/c/path/to/opencv => --with-opencv-dir=c:/path/to/opencv
|
||||||
|
args.map! { |a| a.gsub(/=\/([a-zA-Z])\//, '=\1:/') } if target_platform =~ /mingw/
|
||||||
|
|
||||||
|
make_cmd = (target_platform =~ /mswin/) ? 'nmake' : 'make'
|
||||||
Dir.chdir(target_dir) {
|
Dir.chdir(target_dir) {
|
||||||
cmd = [ruby, extension, *args].join(' ')
|
cmd = [ruby, extension, *args].join(' ')
|
||||||
Gem::Ext::ExtConfBuilder.run(cmd, results)
|
Gem::Ext::ExtConfBuilder.run(cmd, results)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue