summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/autoconf.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-07 23:49:05 +0800
committerruki <[email protected]>2020-04-07 16:54:34 +0800
commit088df3a0bbe2bd99b5d60a5a1f5fb54d4be1673d (patch)
tree316d3c3aeaeccd20e8ace1435a7badaf76069a48 /xmake/modules/package/tools/autoconf.lua
parent20b25b2a16d0282b0496f23d0f0e1ba8842b9205 (diff)
support m32 for autoconf and make
Diffstat (limited to 'xmake/modules/package/tools/autoconf.lua')
-rw-r--r--xmake/modules/package/tools/autoconf.lua19
1 files changed, 17 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index f67032d7c..5a28633df 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -19,6 +19,7 @@
--
-- imports
+import("core.base.option")
import("core.project.config")
-- get configs
@@ -77,9 +78,18 @@ function buildenvs(package)
if package:is_plat(os.subhost()) then
local cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags"))
local cxxflags = table.join(table.wrap(package:config("cxflags")), package:config("cxxflags"))
+ local asflags = table.copy(table.wrap(package:config("asflags")))
+ local ldflags = table.copy(table.wrap(package:config("ldflags")))
+ if package:is_plat("linux") and package:is_arch("i386") then
+ table.insert(cflags, "-m32")
+ table.insert(cxxflags, "-m32")
+ table.insert(asflags, "-m32")
+ table.insert(ldflags, "-m32")
+ end
envs.CFLAGS = table.concat(cflags, ' ')
envs.CXXFLAGS = table.concat(cxxflags, ' ')
- envs.ASFLAGS = table.concat(table.wrap(package:config("asflags")), ' ')
+ envs.ASFLAGS = table.concat(asflags, ' ')
+ envs.LDFLAGS = table.concat(ldflags, ' ')
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"))
@@ -166,7 +176,12 @@ function install(package, configs, opt)
configure(package, configs, opt)
-- do make and install
- os.vrun("make -j4")
+ local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ local argv = {"-j" .. njob}
+ if option.get("verbose") then
+ table.insert(argv, "V=1")
+ end
+ os.vrunv("make", argv)
os.vrun("make install")
end