summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/autoconf.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-02 22:35:07 +0800
committerruki <[email protected]>2020-11-02 22:35:07 +0800
commitc6de181558376e63359e1cbde6bec6176f157374 (patch)
tree94fa93a24cea80e0ac0ad86c39a6bceb9f25c52e /xmake/modules/package/tools/autoconf.lua
parent4b6ecc8c7f6ee75aa91a185cf8c49930cce825c3 (diff)
improve tools/autoconf
Diffstat (limited to 'xmake/modules/package/tools/autoconf.lua')
-rw-r--r--xmake/modules/package/tools/autoconf.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 55ef0041e..e55a0e08d 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -97,7 +97,8 @@ function _get_configs(package, configs)
end
-- get the build environments
-function buildenvs(package)
+function buildenvs(package, opt)
+ opt = opt or {}
local envs = {}
if package:is_plat(os.subhost()) then
local cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags"))
@@ -110,6 +111,11 @@ function buildenvs(package)
table.insert(asflags, "-m32")
table.insert(ldflags, "-m32")
end
+ table.join2(cflags, opt.cflags)
+ table.join2(cflags, opt.cxflags)
+ table.join2(cxxflags, opt.cxxflags)
+ table.join2(cxxflags, opt.cxflags)
+ table.join2(asflags, opt.asflags)
envs.CFLAGS = table.concat(cflags, ' ')
envs.CXXFLAGS = table.concat(cxxflags, ' ')
envs.ASFLAGS = table.concat(asflags, ' ')
@@ -117,6 +123,12 @@ function buildenvs(package)
else
local cflags = table.join(table.wrap(package:build_getenv("cxflags")), package:build_getenv("cflags"))
local cxxflags = table.join(table.wrap(package:build_getenv("cxflags")), package:build_getenv("cxxflags"))
+ local asflags = table.wrap(package:build_getenv("asflags"))
+ table.join2(cflags, opt.cflags)
+ table.join2(cflags, opt.cxflags)
+ table.join2(cxxflags, opt.cxxflags)
+ table.join2(cxxflags, opt.cxflags)
+ table.join2(asflags, opt.asflags)
envs.CC = package:build_getenv("cc")
envs.AS = package:build_getenv("as")
envs.AR = package:build_getenv("ar")
@@ -126,7 +138,7 @@ function buildenvs(package)
envs.RANLIB = package:build_getenv("ranlib")
envs.CFLAGS = table.concat(cflags, ' ')
envs.CXXFLAGS = table.concat(cxxflags, ' ')
- envs.ASFLAGS = table.concat(table.wrap(package:build_getenv("asflags")), ' ')
+ envs.ASFLAGS = table.concat(asflags, ' ')
envs.ARFLAGS = table.concat(table.wrap(package:build_getenv("arflags")), ' ')
envs.LDFLAGS = table.concat(table.wrap(package:build_getenv("ldflags")), ' ')
envs.SHFLAGS = table.concat(table.wrap(package:build_getenv("shflags")), ' ')
@@ -206,7 +218,7 @@ function configure(package, configs, opt)
end
-- do configure
- os.vrunv("sh", argv, {envs = opt.envs or buildenvs(package)})
+ os.vrunv("sh", argv, {envs = opt.envs or buildenvs(package, opt)})
end
-- install package