mkmf: take PKG_CONFIG_PATH
from dir_config
library path
So that version dependent pkg-config files can override files in the default locations.
This commit is contained in:
parent
21a29844a3
commit
dff8d12226
Notes:
git
2021-11-26 22:32:45 +09:00
14
lib/mkmf.rb
14
lib/mkmf.rb
@ -1856,16 +1856,24 @@ SRC
|
|||||||
# invoked with the option and a stripped output string is returned
|
# invoked with the option and a stripped output string is returned
|
||||||
# without modifying any of the global values mentioned above.
|
# without modifying any of the global values mentioned above.
|
||||||
def pkg_config(pkg, option=nil)
|
def pkg_config(pkg, option=nil)
|
||||||
|
_, ldir = dir_config(pkg)
|
||||||
|
if ldir
|
||||||
|
pkg_config_path = "#{ldir}/pkgconfig"
|
||||||
|
if File.directory?(pkg_config_path)
|
||||||
|
Logging.message("PKG_CONFIG_PATH = %s\n", pkg_config_path)
|
||||||
|
envs = ["PKG_CONFIG_PATH"=>[pkg_config_path, ENV["PKG_CONFIG_PATH"]].compact.join(File::PATH_SEPARATOR)]
|
||||||
|
end
|
||||||
|
end
|
||||||
if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
|
if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
|
||||||
# if and only if package specific config command is given
|
# if and only if package specific config command is given
|
||||||
elsif ($PKGCONFIG ||=
|
elsif ($PKGCONFIG ||=
|
||||||
(pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
|
(pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
|
||||||
find_executable0(pkgconfig) && pkgconfig) and
|
find_executable0(pkgconfig) && pkgconfig) and
|
||||||
xsystem("#{$PKGCONFIG} --exists #{pkg}")
|
xsystem([*envs, $PKGCONFIG, "--exists", pkg])
|
||||||
# default to pkg-config command
|
# default to pkg-config command
|
||||||
pkgconfig = $PKGCONFIG
|
pkgconfig = $PKGCONFIG
|
||||||
get = proc {|opt|
|
get = proc {|opt|
|
||||||
opt = xpopen("#{$PKGCONFIG} --#{opt} #{pkg}", err:[:child, :out], &:read)
|
opt = xpopen([*envs, $PKGCONFIG, "--#{opt}", pkg], err:[:child, :out], &:read)
|
||||||
Logging.open {puts opt.each_line.map{|s|"=> #{s.inspect}"}}
|
Logging.open {puts opt.each_line.map{|s|"=> #{s.inspect}"}}
|
||||||
opt.strip if $?.success?
|
opt.strip if $?.success?
|
||||||
}
|
}
|
||||||
@ -1876,7 +1884,7 @@ SRC
|
|||||||
end
|
end
|
||||||
if pkgconfig
|
if pkgconfig
|
||||||
get ||= proc {|opt|
|
get ||= proc {|opt|
|
||||||
opt = xpopen("#{pkgconfig} --#{opt}", err:[:child, :out], &:read)
|
opt = xpopen([*envs, pkgconfig, "--#{opt}"], err:[:child, :out], &:read)
|
||||||
Logging.open {puts opt.each_line.map{|s|"=> #{s.inspect}"}}
|
Logging.open {puts opt.each_line.map{|s|"=> #{s.inspect}"}}
|
||||||
opt.strip if $?.success?
|
opt.strip if $?.success?
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user