improve support for MSYS2 - close #120

This commit is contained in:
josh committed 2020-10-08 19:04:50 -04:00
1 parent 8e06efe61e
commit 5ec74604c6
12 files changed
+108 -115

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@ module Rscons
# @return [Boolean]
# Whether to output ANSI color escape codes.
def do_ansi?(io)
if RUBY_PLATFORM =~ /mingw/
if RUBY_PLATFORM =~ /mingw|msys/
(ENV["TERM"] == "xterm") && %w[fifo characterSpecial].include?(io.stat.ftype)
else
io.tty?
+1 -1
View File
@@ -1,6 +1,6 @@
module Rscons
on_windows = RUBY_PLATFORM =~ /mingw|cygwin/
on_windows = RUBY_PLATFORM =~ /mingw|msys|cygwin/
pic_flags = on_windows ? [] : %w[-fPIC]
# Default Rscons construction variables.
+7 -4
View File
@@ -9,7 +9,7 @@ module Rscons
#
# @return [Boolean] Whether the given path is an absolute filesystem path.
def absolute_path?(path)
if RUBY_PLATFORM =~ /mingw/
if RUBY_PLATFORM =~ /mingw|msys/
path =~ %r{^(?:\w:)?[\\/]}
else
path.start_with?("/")
@@ -68,8 +68,8 @@ module Rscons
case RbConfig::CONFIG["host_os"]
when /linux/
return File.read("/proc/cpuinfo").scan(/^processor\s*:/).size
when /mswin|mingw/
if `wmic cpu get NumberOfLogicalProcessors /value` =~ /NumberOfLogicalProcessors=(\d+)/
when /mswin|mingw|msys/
if `wmic cpu get NumberOfLogicalProcessors -value` =~ /NumberOfLogicalProcessors=(\d+)/
return $1.to_i
end
when /darwin/
@@ -225,11 +225,14 @@ module Rscons
# Directory to look in.
# @param executable [String]
# Executable to look for.
#
# @return [String, nil]
# Executable found.
def test_path_for_executable(path_entry, executable)
is_executable = lambda do |path|
File.file?(path) and File.executable?(path)
end
if RbConfig::CONFIG["host_os"] =~ /mswin|windows|mingw/i
if RbConfig::CONFIG["host_os"] =~ /mswin|windows|mingw|msys/i
if File.directory?(path_entry)
executable = executable.downcase
dir_entries = Dir.entries(path_entry)