summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-12-19 21:32:36 +0800
committerGitHub <[email protected]>2018-12-19 21:32:36 +0800
commitcb2d2a305e2202790db0e2a7e4ff5291fc29606f (patch)
tree2ce141feba7c6d2ec2a08673260eea0eacac59e6
parent3cd27c65b98182bbdba8f9913951d479a37cdc80 (diff)
parent4175116555b4337ad6cd423373462eb9107617ec (diff)
Merge pull request #298 from chenzhekl/master
Add support for Linuxbrew.
-rw-r--r--xmake/modules/lib/detect/pkg_config.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua
index 4c69ff93f..ac16c3ec8 100644
--- a/xmake/modules/lib/detect/pkg_config.lua
+++ b/xmake/modules/lib/detect/pkg_config.lua
@@ -85,7 +85,10 @@ function info(name, opt)
-- find the prefix directory of brew directly, because `brew --prefix name` is too slow!
if not opt.mode or opt.mode == "release" then
- local pcfile = find_file(name .. ".pc", "/usr/local/Cellar/" .. (opt.brewhint or name) .. "/*/lib/pkgconfig")
+ local brew_pkg_root = try { function () return os.iorunv(brew, {"--prefix"}) end } or "/usr/local"
+ brew_pkg_root = path.join(brew_pkg_root, opt.plat == "macosx" and "Cellar" or "opt")
+
+ local pcfile = find_file(name .. ".pc", path.join(brew_pkg_root, (opt.brewhint or name), "*/lib/pkgconfig"))
if pcfile then
brewprefix = path.directory(path.directory(path.directory(pcfile)))
os.addenv("PKG_CONFIG_PATH", path.directory(pcfile))