summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-09 23:49:29 +0800
committerruki <[email protected]>2021-02-09 23:49:29 +0800
commitf2e144e8ae5e64b31f635605f64d99c441c302a4 (patch)
tree386a9062b70c0f05b00c68347a27b5299bb4a424
parentb5b7cf1d0574b789d0d7d8a5ced75eaf16e82a99 (diff)
fix autogen envs
-rw-r--r--xmake/modules/package/tools/autoconf.lua29
1 files changed, 27 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 37b05ce75..8d32635f5 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -217,6 +217,31 @@ function buildenvs(package, opt)
return envs
end
+-- get the autogen environments
+function autogen_envs(package, opt)
+ opt = opt or {}
+ local envs = {}
+ local ACLOCAL_PATH = {}
+ local PKG_CONFIG_PATH = {}
+ for _, dep in ipairs(package:orderdeps()) do
+ local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig")
+ if os.isdir(pkgconfig) then
+ table.insert(PKG_CONFIG_PATH, pkgconfig)
+ end
+ pkgconfig = path.join(dep:installdir(), "share", "pkgconfig")
+ if os.isdir(pkgconfig) then
+ table.insert(PKG_CONFIG_PATH, pkgconfig)
+ end
+ local aclocal = path.join(dep:installdir(), "share", "aclocal")
+ if os.isdir(aclocal) then
+ table.insert(ACLOCAL_PATH, aclocal)
+ end
+ end
+ envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH)
+ envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH)
+ return envs
+end
+
-- configure package
function configure(package, configs, opt)
@@ -229,9 +254,9 @@ function configure(package, configs, opt)
-- generate configure file
if not os.isfile("configure") then
if os.isfile("autogen.sh") then
- os.vrunv("sh", {"./autogen.sh"}, {envs = envs})
+ os.vrunv("sh", {"./autogen.sh"}, {envs = autogen_envs(package, opt)})
elseif os.isfile("configure.ac") then
- os.vrunv("autoreconf", {"--install", "--symlink"}, {envs = envs})
+ os.vrunv("autoreconf", {"--install", "--symlink"}, {envs = autogen_envs(package, opt)})
end
end