From db1c57d774b3807640b1e09414af7c6488a5fe86 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Jan 2021 23:02:20 +0800 Subject: improve tools/make --- xmake/modules/package/tools/make.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xmake/modules/package/tools/make.lua') diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua index 0075ab723..57e9b631e 100644 --- a/xmake/modules/package/tools/make.lua +++ b/xmake/modules/package/tools/make.lua @@ -85,7 +85,7 @@ function build(package, configs, opt) opt = opt or {} -- pass configurations - local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local njob = opt.jobs or option.get("jobs") or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) local argv = {"-j" .. njob} if option.get("verbose") then table.insert(argv, "VERBOSE=1") @@ -116,7 +116,8 @@ function install(package, configs, opt) opt = opt or {} -- pass configurations - local argv = {"install"} + local njob = opt.jobs or option.get("jobs") or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local argv = {"install", "-j" .. njob} if option.get("verbose") then table.insert(argv, "VERBOSE=1") end -- cgit v1.3.1 From 9eca92ce0882344be8d945847643a3a5a4f066de Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Jan 2021 23:03:44 +0800 Subject: fix tools/make --- xmake/modules/package/tools/make.lua | 20 ++++---------------- xmake/modules/private/xrepo/action/install.lua | 1 + 2 files changed, 5 insertions(+), 16 deletions(-) (limited to 'xmake/modules/package/tools/make.lua') diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua index 57e9b631e..b236b9da6 100644 --- a/xmake/modules/package/tools/make.lua +++ b/xmake/modules/package/tools/make.lua @@ -112,27 +112,15 @@ end -- install package function install(package, configs, opt) - -- init options + -- do build opt = opt or {} + build(package, configs, opt) - -- pass configurations - local njob = opt.jobs or option.get("jobs") or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) - local argv = {"install", "-j" .. njob} + -- do install + local argv = {"install"} if option.get("verbose") then table.insert(argv, "VERBOSE=1") end - for name, value in pairs(configs) do - value = tostring(value):trim() - if value ~= "" then - if type(name) == "number" then - table.insert(argv, value) - else - table.insert(argv, name .. "=" .. value) - end - end - end - - -- do install if is_host("bsd") then os.vrunv("gmake", argv, {envs = opt.envs or buildenvs(package)}) else diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua index 2f63b0e5d..3b9032689 100644 --- a/xmake/modules/private/xrepo/action/install.lua +++ b/xmake/modules/private/xrepo/action/install.lua @@ -180,6 +180,7 @@ function _install_packages(packages) table.insert(require_argv, "-D") end if option.get("jobs") then + table.insert(require_argv, "-j") table.insert(require_argv, option.get("jobs")) end if option.get("force") then -- cgit v1.3.1