summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-12-02 22:38:24 +0900
committerNobuyoshi Nakada <nobu.nakada@gmail.com>2024-12-23 11:52:14 +0900
commitb19fcd02fae7bea162c6f1cee371a4b024305be7 (patch)
tree8488d6cf6d4f85287655b4fb034ffe9ce924355e
parentbe7e5f1f85685a757bea6c8dae4e30914a5eec67 (diff)
Use the dedicated constants `LIBARG` and `LIBPATHFLAG`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/9815
-rw-r--r--lib/mkmf.rb30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 0001d5926f..768a152ca7 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1980,32 +1980,22 @@ SRC
pkgconfig = nil
end
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|
opts = Array(opts).map { |o| "--#{o}" }
opts = xpopen([*envs, pkgconfig, *opts, *args], err:[:child, :out], &:read)
Logging.open {puts opts.each_line.map{|s|"=> #{s.inspect}"}}
if $?.success?
opts = opts.strip
- if $mswin and not has_ms_win_syntax
- opts = Shellwords.shellwords(opts).map { |s|
- if s.start_with?('-l')
- "#{s[2..]}.lib"
- elsif s.start_with?('-L')
- "/libpath:#{s[2..]}"
- else
- s
- end
- }.quote.join(" ")
- end
+ libarg, libpath = LIBARG, LIBPATHFLAG.strip
+ opts = opts.shellsplit.map { |s|
+ if s.start_with?('-l')
+ libarg % s[2..]
+ elsif s.start_with?('-L')
+ libpath % s[2..]
+ else
+ s
+ end
+ }.quote.join(" ")
opts
end
}