Skip to content

Commit 7c2db55

Browse files
committed
Detect Homebrew's pkgconfig path without pkgconf
GitHub: fix apache/arrow#46235 Reported by Shizuo Fujita. Thanks!!!
1 parent c9cba77 commit 7c2db55

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

lib/pkg-config.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,17 +340,22 @@ def compute_default_path
340340
if brew
341341
homebrew_repository = run_command("brew", "--repository")
342342
if homebrew_repository
343-
homebrew_repository_candidates <<
344-
Pathname(homebrew_repository.to_s)
343+
homebrew_repository_candidates <<
344+
Pathname(homebrew_repository.strip)
345345
end
346346
end
347347
homebrew_repository_candidates.uniq.each do |candidate|
348-
pkgconfig_base_path = candidate + "Library/Homebrew/os/mac/pkgconfig"
349-
path = pkgconfig_base_path + mac_os_version
350-
unless path.exist?
351-
path = pkgconfig_base_path + mac_os_version.gsub(/\.\d+\z/, "")
348+
mac_pkgconfig_base_path =
349+
candidate + "Library/Homebrew/os/mac/pkgconfig"
350+
mac_pkgconfig_path = mac_pkgconfig_base_path + mac_os_version
351+
unless mac_pkgconfig_path.exist?
352+
mac_pkgconfig_path =
353+
mac_pkgconfig_base_path + mac_os_version.gsub(/\.\d+\z/, "")
352354
end
353-
paths << path.to_s if path.exist?
355+
paths << mac_pkgconfig_path.to_s if mac_pkgconfig_path.exist?
356+
357+
pkgconfig_path = candidate + "lib/pkgconfig"
358+
paths << pkgconfig_path.to_s if pkgconfig_path.exist?
354359
end
355360
end
356361
paths.concat(default_paths)

0 commit comments

Comments
 (0)