Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Sep 10, 2023
1 parent 2b26c15 commit 1385ce6
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions lib/mini_portile2/mini_portile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,29 @@ def fmt.%(x)
x ? x.inspect : self
end

MakeMakefile.checking_for "pkg-config for #{pkg}", fmt do
if ($PKGCONFIG ||=
(pkgconfig = MakeMakefile.with_config("pkg-config") {MakeMakefile.config_string("PKG_CONFIG") || "pkg-config"}) &&
MakeMakefile.find_executable0(pkgconfig) && pkgconfig)
# default to pkg-config command
pkgconfig = $PKGCONFIG
args = [pkg]
elsif MakeMakefile.find_executable0(pkgconfig = "#{pkg}-config")
# default to package specific config command, as a last resort.
else
raise RuntimeError, "pkg-config is not found"
end

get = proc {|opts|
opts = Array(opts).map { |o| "--#{o}" }
opts = MakeMakefile.xpopen([pkgconfig, *opts, *args], err:[:child, :out], &:read)
MakeMakefile::Logging.open {puts opts.each_line.map{|s|"=> #{s.inspect}"}}
opts.strip if $?.success?
}

get[options]
if ($PKGCONFIG ||=
(pkgconfig = MakeMakefile.with_config("pkg-config") {MakeMakefile.config_string("PKG_CONFIG") || "pkg-config"}) &&
MakeMakefile.find_executable0(pkgconfig) && pkgconfig)
# default to pkg-config command
pkgconfig = $PKGCONFIG
args = [pkg]
elsif MakeMakefile.find_executable0(pkgconfig = "#{pkg}-config")
# default to package specific config command, as a last resort.
else
raise RuntimeError, "pkg-config is not found"
end

get = proc {|opts|
puts "MIKE: in get: input: #{opts.inspect}"
opts = Array(opts).map { |o| "--#{o}" }
opts = MakeMakefile.xpopen([pkgconfig, *opts, *args], err:[:child, :out], &:read)
puts "MIKE: in get: success: #{$?.success?}"
puts "MIKE: in get: output: #{opts.inspect}"
MakeMakefile::Logging.open {puts opts.each_line.map{|s|"=> #{s.inspect}"}}
opts.strip if $?.success?
}

get[options]
end

def initialize(name, version, **kwargs)
Expand Down

0 comments on commit 1385ce6

Please sign in to comment.