Use the dedicated constants LIBARG
and LIBPATHFLAG
This commit is contained in:
parent
be7e5f1f85
commit
b19fcd02fa
Notes:
git
2024-12-23 02:52:33 +00:00
30
lib/mkmf.rb
30
lib/mkmf.rb
@ -1980,32 +1980,22 @@ SRC
|
|||||||
pkgconfig = nil
|
pkgconfig = nil
|
||||||
end
|
end
|
||||||
if pkgconfig
|
if pkgconfig
|
||||||
has_ms_win_syntax = false
|
|
||||||
if $mswin
|
|
||||||
has_ms_win_syntax = xpopen([pkgconfig, "--help"]).read.include?('msvc-syntax')
|
|
||||||
if has_ms_win_syntax
|
|
||||||
args << "--msvc-syntax"
|
|
||||||
else
|
|
||||||
Logging.message("WARNING: #{pkgconfig} does not support the --msvc-syntax. Try using a recent pkgconf instead")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
get = proc {|opts|
|
get = proc {|opts|
|
||||||
opts = Array(opts).map { |o| "--#{o}" }
|
opts = Array(opts).map { |o| "--#{o}" }
|
||||||
opts = xpopen([*envs, pkgconfig, *opts, *args], err:[:child, :out], &:read)
|
opts = xpopen([*envs, pkgconfig, *opts, *args], err:[:child, :out], &:read)
|
||||||
Logging.open {puts opts.each_line.map{|s|"=> #{s.inspect}"}}
|
Logging.open {puts opts.each_line.map{|s|"=> #{s.inspect}"}}
|
||||||
if $?.success?
|
if $?.success?
|
||||||
opts = opts.strip
|
opts = opts.strip
|
||||||
if $mswin and not has_ms_win_syntax
|
libarg, libpath = LIBARG, LIBPATHFLAG.strip
|
||||||
opts = Shellwords.shellwords(opts).map { |s|
|
opts = opts.shellsplit.map { |s|
|
||||||
if s.start_with?('-l')
|
if s.start_with?('-l')
|
||||||
"#{s[2..]}.lib"
|
libarg % s[2..]
|
||||||
elsif s.start_with?('-L')
|
elsif s.start_with?('-L')
|
||||||
"/libpath:#{s[2..]}"
|
libpath % s[2..]
|
||||||
else
|
else
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
}.quote.join(" ")
|
}.quote.join(" ")
|
||||||
end
|
|
||||||
opts
|
opts
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user