mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
mkmf: unify duplicate code in pkg_config
This commit is contained in:
parent
b90e56e624
commit
7672f6a423
1 changed files with 3 additions and 8 deletions
11
lib/mkmf.rb
11
lib/mkmf.rb
|
|
@ -1872,21 +1872,16 @@ SRC
|
||||||
xsystem([*envs, $PKGCONFIG, "--exists", pkg])
|
xsystem([*envs, $PKGCONFIG, "--exists", pkg])
|
||||||
# default to pkg-config command
|
# default to pkg-config command
|
||||||
pkgconfig = $PKGCONFIG
|
pkgconfig = $PKGCONFIG
|
||||||
get = proc {|opts|
|
args = [pkg]
|
||||||
opts = Array(opts).map { |o| "--#{o}" }
|
|
||||||
opts = xpopen([*envs, $PKGCONFIG, *opts, pkg], err:[:child, :out], &:read)
|
|
||||||
Logging.open {puts opts.each_line.map{|s|"=> #{s.inspect}"}}
|
|
||||||
opts.strip if $?.success?
|
|
||||||
}
|
|
||||||
elsif find_executable0(pkgconfig = "#{pkg}-config")
|
elsif find_executable0(pkgconfig = "#{pkg}-config")
|
||||||
# default to package specific config command, as a last resort.
|
# default to package specific config command, as a last resort.
|
||||||
else
|
else
|
||||||
pkgconfig = nil
|
pkgconfig = nil
|
||||||
end
|
end
|
||||||
if pkgconfig
|
if pkgconfig
|
||||||
get ||= proc {|opts|
|
get = proc {|opts|
|
||||||
opts = Array(opts).map { |o| "--#{o}" }
|
opts = Array(opts).map { |o| "--#{o}" }
|
||||||
opts = xpopen([*envs, pkgconfig, *opts], 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}"}}
|
||||||
opts.strip if $?.success?
|
opts.strip if $?.success?
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue