diff options
| author | ruki <[email protected]> | 2019-07-27 00:42:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-07-26 22:15:08 +0800 |
| commit | 8a2970632ac14fa9a61b020597ccdde72790caff (patch) | |
| tree | 50312d4909512513d18a94b1c7332aa19e375193 | |
| parent | 73b4b5bf675153f8e989d8ead3f7d109645640f5 (diff) | |
fix tools/xmake for root
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index ecee3eefc..227db9c70 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -50,11 +50,25 @@ function _get_configs(package, configs) return configs end +-- init arguments and inherit some global options from the parent xmake +function _init_argv(...) + local argv = {...} + for _, name in ipairs({"diagnosis", "verbose", "quiet", "yes", "confirm", "root"}) do + local value = option.get(name) + if type(value) == "boolean" then + table.insert(argv, "--" .. name) + elseif value ~= nil then + table.insert(argv, "--" .. name .. "=" .. value) + end + end + return argv +end + -- install package function install(package, configs) -- inherit builtin configs - local argv = {"f", "-y", "-c"} + local argv = _init_argv("f", "-y", "-c") local names = {"plat", "arch", "ndk", "ndk_sdkver", "vs", "mingw", "sdk", "bin", "cross", "ld", "sh", "ar", "cc", "cxx", "mm", "mxx"} for _, name in ipairs(names) do local value = get_config(name) @@ -74,31 +88,13 @@ function install(package, configs) table.insert(argv, "--" .. name .. "=" .. value) end end - if option.get("verbose") then - table.insert(argv, "-v") - end - if option.get("diagnosis") then - table.insert(argv, "--diagnosis") - end os.vrunv("xmake", argv) -- do build - argv = {} - if option.get("verbose") then - table.insert(argv, "-v") - end - if option.get("diagnosis") then - table.insert(argv, "--diagnosis") - end + argv = _init_argv() os.vrunv("xmake", argv) -- do install - argv = {"install", "-y", "-o", package:installdir()} - if option.get("verbose") then - table.insert(argv, "-v") - end - if option.get("diagnosis") then - table.insert(argv, "--diagnosis") - end + argv = _init_argv("install", "-y", "-o", package:installdir()) os.vrunv("xmake", argv) end |
