diff options
| author | ruki <[email protected]> | 2019-03-20 14:54:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-03-20 14:54:49 +0800 |
| commit | 85deccc73a0278e01fa8580b68b38f16e0598bf7 (patch) | |
| tree | a9a446a5be5ca662525df921e50ce66029bc3359 /xmake/modules | |
| parent | 57506c7b8ba8941ebac3676a241f8444e0079a56 (diff) | |
| parent | 8bb6ddf5c40f15fe6570f73dc5c4e5295ce95180 (diff) | |
Merge branch 'repo' into dev
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/detect/tools/find_cmake.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/check_cxsnippets.lua | 18 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/find_package.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_cfuncs.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_cincludes.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_ctypes.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_cxxfuncs.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_cxxincludes.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_cxxtypes.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/package/manager/find_package.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/package/manager/xmake/find_package.lua | 100 | ||||
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 86 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 63 | ||||
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 45 |
14 files changed, 255 insertions, 102 deletions
diff --git a/xmake/modules/detect/tools/find_cmake.lua b/xmake/modules/detect/tools/find_cmake.lua index e9a20232d..021133052 100644 --- a/xmake/modules/detect/tools/find_cmake.lua +++ b/xmake/modules/detect/tools/find_cmake.lua @@ -52,7 +52,7 @@ function main(opt) -- find program version local version = nil - if opt and opt.version then + if program and opt and opt.version then version = find_programver(program, opt) end diff --git a/xmake/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua index e44043b99..48a56fe1b 100644 --- a/xmake/modules/lib/detect/check_cxsnippets.lua +++ b/xmake/modules/lib/detect/check_cxsnippets.lua @@ -120,7 +120,7 @@ end -- .e.g -- { verbose = false, target = [target|option], sourcekind = "[cc|cxx]" -- , types = {"wchar_t", "char*"}, includes = "stdio.h", funcs = {"sigsetjmp", "sigsetjmp((void*)0, 0)"} --- , config = {defines = "xx", cxflags = ""}} +-- , configs = {defines = "xx", cxflags = ""}} -- -- funcs: -- sigsetjmp @@ -144,11 +144,23 @@ function main(snippets, opt) -- init snippets snippets = snippets or {} + -- get configs + local configs = opt.configs or opt.config + -- get links - local links = table.wrap(opt.links) + local links = {} + if configs and configs.links then + table.join2(links, configs.links) + end if opt.target then table.join2(links, opt.target:get("links")) end + if configs and configs.syslinks then + table.join2(links, configs.syslinks) + end + if opt.target then + table.join2(links, opt.target:get("syslinks")) + end -- get types local types = table.wrap(opt.types) @@ -199,7 +211,7 @@ function main(snippets, opt) -- trace if opt.verbose or option.get("verbose") or option.get("diagnosis") then - local kind = ifelse(sourcekind == "cc", "c", "c++") + local kind = opt.sourcekind == "cc" and "c" or "c++" if #includes > 0 then cprint("${dim}> checking for the %s includes(%s)", kind, table.concat(includes, ", ")) end diff --git a/xmake/modules/lib/detect/find_package.lua b/xmake/modules/lib/detect/find_package.lua index dc9286c54..63745c48d 100644 --- a/xmake/modules/lib/detect/find_package.lua +++ b/xmake/modules/lib/detect/find_package.lua @@ -87,7 +87,6 @@ function main(name, opt) if opt.verbose or option.get("verbose") then if result then cprint("checking for the %s ... ${color.success}%s", name, result.version and result.version or "${text.success}") - dprint(result) else cprint("checking for the %s ... ${color.nothing}${text.nothing}", name) end diff --git a/xmake/modules/lib/detect/has_cfuncs.lua b/xmake/modules/lib/detect/has_cfuncs.lua index 6cf8f4cd3..73ab54eca 100644 --- a/xmake/modules/lib/detect/has_cfuncs.lua +++ b/xmake/modules/lib/detect/has_cfuncs.lua @@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets") -- @param funcs the funcs -- @param opt the argument options -- .e.g --- { verbose = false, target = [target|option], includes = "", config = {linkdirs = .., links = .., defines = .., ..}} +-- { verbose = false, target = [target|option], includes = "", configs = {linkdirs = .., links = .., defines = .., ..}} -- -- funcs: -- sigsetjmp @@ -55,5 +55,6 @@ function main(funcs, opt) opt.funcs = funcs -- has funcs? - return check_cxsnippets("", opt) + local name = opt.name or "has_cfuncs" + return check_cxsnippets({[name] = ""}, opt) end diff --git a/xmake/modules/lib/detect/has_cincludes.lua b/xmake/modules/lib/detect/has_cincludes.lua index a70c17f56..195a482e1 100644 --- a/xmake/modules/lib/detect/has_cincludes.lua +++ b/xmake/modules/lib/detect/has_cincludes.lua @@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets") -- @param includes the includes -- @param opt the argument options -- .e.g --- { verbose = false, target = [target|option], config = {defines = "..", .. }} +-- { verbose = false, target = [target|option], configs = {defines = "..", .. }} -- -- @return true or false -- @@ -49,5 +49,6 @@ function main(includes, opt) opt.includes = includes -- has includes? - return check_cxsnippets("", opt) + local name = opt.name or "has_cincludes" + return check_cxsnippets({[name] = ""}, opt) end diff --git a/xmake/modules/lib/detect/has_ctypes.lua b/xmake/modules/lib/detect/has_ctypes.lua index 2341b983d..2ac05a30e 100644 --- a/xmake/modules/lib/detect/has_ctypes.lua +++ b/xmake/modules/lib/detect/has_ctypes.lua @@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets") -- @param types the types -- @param opt the argument options -- .e.g --- { verbose = false, target = [target|option], includes = .., config = {defines = .., ..}} +-- { verbose = false, target = [target|option], includes = .., configs = {defines = .., ..}} -- -- @return true or false -- @@ -49,5 +49,6 @@ function main(types, opt) opt.types = types -- has types? - return check_cxsnippets("", opt) + local name = opt.name or "has_ctypes" + return check_cxsnippets({[name] = ""}, opt) end diff --git a/xmake/modules/lib/detect/has_cxxfuncs.lua b/xmake/modules/lib/detect/has_cxxfuncs.lua index 0ee26c897..e30a21416 100644 --- a/xmake/modules/lib/detect/has_cxxfuncs.lua +++ b/xmake/modules/lib/detect/has_cxxfuncs.lua @@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets") -- @param funcs the funcs -- @param opt the argument options -- .e.g --- { verbose = false, target = [target|option], includes = "", config = {linkdirs = .., links = .., defines = .., ..}} +-- { verbose = false, target = [target|option], includes = "", configs = {linkdirs = .., links = .., defines = .., ..}} -- -- funcs: -- sigsetjmp @@ -55,5 +55,6 @@ function main(funcs, opt) opt.funcs = funcs -- has funcs? - return check_cxsnippets("", opt) + local name = opt.name or "has_cxxfuncs" + return check_cxsnippets({[name] = ""}, opt) end diff --git a/xmake/modules/lib/detect/has_cxxincludes.lua b/xmake/modules/lib/detect/has_cxxincludes.lua index 57c08ddb6..6c4846134 100644 --- a/xmake/modules/lib/detect/has_cxxincludes.lua +++ b/xmake/modules/lib/detect/has_cxxincludes.lua @@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets") -- @param includes the includes -- @param opt the argument options -- .e.g --- { verbose = false, target = [target|option], config = {defines = "..", .. }} +-- { verbose = false, target = [target|option], configs = {defines = "..", .. }} -- -- @return true or false -- @@ -49,5 +49,6 @@ function main(includes, opt) opt.includes = includes -- has includes? - return check_cxsnippets("", opt) + local name = opt.name or "has_cxxincludes" + return check_cxsnippets({[name] = ""}, opt) end diff --git a/xmake/modules/lib/detect/has_cxxtypes.lua b/xmake/modules/lib/detect/has_cxxtypes.lua index 1011a4b5f..f52cee697 100644 --- a/xmake/modules/lib/detect/has_cxxtypes.lua +++ b/xmake/modules/lib/detect/has_cxxtypes.lua @@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets") -- @param types the types -- @param opt the argument options -- .e.g --- { verbose = false, target = [target|option], includes = .., config = {defines = .., ..}} +-- { verbose = false, target = [target|option], includes = .., configs = {defines = .., ..}} -- -- @return true or false -- @@ -49,5 +49,6 @@ function main(types, opt) opt.types = types -- has types? - return check_cxsnippets("", opt) + local name = opt.name or "has_cxxtypes" + return check_cxsnippets({[name] = ""}, opt) end diff --git a/xmake/modules/package/manager/find_package.lua b/xmake/modules/package/manager/find_package.lua index 7fec292e5..49ec98208 100644 --- a/xmake/modules/package/manager/find_package.lua +++ b/xmake/modules/package/manager/find_package.lua @@ -127,16 +127,6 @@ function _find_package(manager_name, package_name, opt) -- remove repeat result.linkdirs = table.unique(result.linkdirs) result.includedirs = table.unique(result.includedirs) - - -- check valid version - if result.version then - local version = try { function () return semver.new(result.version) end } - if version then - result.version = version:rawstr() - else - result.version = nil - end - end end -- ok? @@ -191,7 +181,7 @@ function main(name, opt) -- match version? if opt.version and result then - if not result.version or not semver.satisfies(result.version, opt.version) then + if not (result.version and (result.version == opt.version or semver.satisfies(result.version, opt.version))) then result = nil end end diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua index cb00d5756..0c6461480 100644 --- a/xmake/modules/package/manager/xmake/find_package.lua +++ b/xmake/modules/package/manager/xmake/find_package.lua @@ -27,6 +27,7 @@ import("core.base.global") import("core.project.config") import("core.project.option") import("core.project.target") +import("core.package.package") import("core.language.language") import("lib.detect.find_file") import("lib.detect.find_library") @@ -34,86 +35,76 @@ import("lib.detect.find_library") -- find package from the repository (maybe only include and no links) function _find_package_from_repo(name, opt) - -- get build mode, e.g. debug_f7821231 - local mode = table.concat({opt.mode or "release", opt.configs_hash}, '_') - - -- get the prefix directories - local prefixdirs = table.wrap(opt.prefixdirs) - local platsubdirs = path.join(config.get("plat") or os.host(), config.get("arch") or os.arch()) - if #prefixdirs == 0 then - table.insert(prefixdirs, path.join(opt.islocal and config.directory() or global.directory(), "prefix", platsubdirs, mode)) - end - - -- find the prefix info file of package, .e.g prefix/info/z/zlib/1.2.11/info.txt + -- find the manifest file of package, .e.g ~/.xmake/packages/z/zlib/1.1.12/ed41d5327fad3fc06fe376b4a94f62ef/manifest.txt local packagedirs = {} - local packagepath = path.join(name:sub(1, 1), name, "*") - table.insert(packagedirs, path.join(opt.islocal and config.directory() or global.directory(), "prefix", "info", platsubdirs, mode, packagepath)) - local prefixfile = find_file("info.txt", packagedirs) - if not prefixfile then + table.insert(packagedirs, path.join(package.installdir(), name:sub(1, 1), name, opt.version or "*", opt.buildhash)) + local manifest_file = find_file("manifest.txt", packagedirs) + if not manifest_file then return end - -- load prefix info - local prefixinfo = io.load(prefixfile) - if not prefixinfo then + -- load manifest info + local manifest = io.load(manifest_file) + if not manifest then return end - -- get prefix directory of this package - local prefixdir = path.translate(path.directory(path.directory(path.directory(path.directory(prefixfile)))):gsub("[/\\]prefix[/\\]info[/\\]", "/prefix/")) + -- get manifest variables + local vars = manifest.vars or {} + + -- get install directory of this package + local installdir = path.directory(manifest_file) -- save includedirs to result (maybe only include and no links) local result = {} local includedirs = {} - for _, includedir in ipairs(prefixinfo.includedirs) do - table.insert(includedirs, path.join(prefixdir, includedir)) + for _, includedir in ipairs(vars.includedirs) do + table.insert(includedirs, path.join(installdir, includedir)) end if #includedirs == 0 then - table.insert(includedirs, path.join(prefixdir, "include")) + table.insert(includedirs, path.join(installdir, "include")) end result.includedirs = table.unique(includedirs) -- get links and link directories local links = {} local linkdirs = {} - for _, linkdir in ipairs(prefixinfo.linkdirs) do - table.insert(linkdirs, path.join(prefixdir, linkdir)) + for _, linkdir in ipairs(vars.linkdirs) do + table.insert(linkdirs, path.join(installdir, linkdir)) end - if prefixinfo.links then - table.join2(links, prefixinfo.links) + if vars.links then + table.join2(links, vars.links) end - if prefixinfo.installed and (not prefixinfo.linkdirs or not prefixinfo.links) then + if not vars.linkdirs or not vars.links then local found = false - for _, line in ipairs(prefixinfo.installed) do - line = line:trim() - if line:endswith(".lib") or line:endswith(".a") then + for _, file in ipairs(os.files(path.join(installdir, "lib", "*"))) do + if file:endswith(".lib") or file:endswith(".a") then found = true - if not prefixinfo.linkdirs then - table.insert(linkdirs, path.join(prefixdir, path.directory(line))) + if not vars.linkdirs then + table.insert(linkdirs, path.directory(file)) end - if not prefixinfo.links then - table.insert(links, target.linkname(path.filename(line))) + if not vars.links then + table.insert(links, target.linkname(path.filename(file))) end end end if not found then - for _, line in ipairs(prefixinfo.installed) do - line = line:trim() - if line:endswith(".so") or line:endswith(".dylib") then - if not prefixinfo.linkdirs then - table.insert(linkdirs, path.join(prefixdir, path.directory(line))) + for _, file in ipairs(os.files(path.join(installdir, "lib", "*"))) do + if file:endswith(".so") or file:endswith(".dylib") then + if not vars.linkdirs then + table.insert(linkdirs, path.directory(file)) end - if not prefixinfo.links then - table.insert(links, target.linkname(path.filename(line))) + if not vars.links then + table.insert(links, target.linkname(path.filename(file))) end end end end end - -- add root include and link directories + -- add root link directories if #linkdirs == 0 then - table.insert(linkdirs, path.join(prefixdir, "lib")) + table.insert(linkdirs, path.join(installdir, "lib")) end -- uses name as links directly .e.g libname.a @@ -135,16 +126,25 @@ function _find_package_from_repo(name, opt) end -- inherit the other prefix variables - for name, values in pairs(prefixinfo) do - if name ~= "links" and name ~= "linkdirs" and name ~= "includedirs" and name ~= "installed" and name ~= "prefixdir" then + for name, values in pairs(vars) do + if name ~= "links" and name ~= "linkdirs" and name ~= "includedirs" then result[name] = values end end - -- get version - result.version = path.filename(path.directory(prefixfile)) + -- update the project references file + if result then + local projectdir = os.projectdir() + if projectdir and os.isdir(projectdir) then + local references_file = path.join(installdir, "references.txt") + local references = os.isfile(references_file) and io.load(references_file) or {} + references[projectdir] = os.date("%y%m%d") + io.save(references_file, references) + end + end - -- ok + -- get version + result.version = manifest.version or path.filename(path.directory(path.directory(manifest_file))) return result end @@ -247,7 +247,7 @@ end -- find package using the xmake package manager -- -- @param name the package name --- @param opt the options, .e.g {verbose = true, version = "1.12.x", configs_hash = "xxxxxx") +-- @param opt the options, .e.g {verbose = true, version = "1.12.x", buildhash = "xxxxxx") -- function main(name, opt) diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 29e147636..32186a080 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -22,6 +22,68 @@ -- @file autoconf.lua -- +-- get configs +function _get_configs(package, configs) + local configs = configs or {} + table.insert(configs, "--prefix=" .. package:installdir()) + return configs +end + +-- enter environments +function _enter_envs(package) + + -- get old environments + local envs = {} + envs.CFLAGS = os.getenv("CFLAGS") + envs.CXXFLAGS = os.getenv("CXXFLAGS") + envs.ASFLAGS = os.getenv("ASFLAGS") + envs.ACLOCAL_PATH = os.getenv("ACLOCAL_PATH") + envs.PKG_CONFIG_PATH = os.getenv("PKG_CONFIG_PATH") + + -- set new environments + local cflags = package:config("cflags") + local cxflags = package:config("cxflags") + local cxxflags = package:config("cxxflags") + local asflags = package:config("asflags") + if package:plat() == "windows" then + local vs_runtime = package:config("vs_runtime") + if vs_runtime then + cxflags = (cxflags or "") .. " /" .. vs_runtime .. (package:debug() and "d" or "") + end + end + if cflags then + os.addenv("CFLAGS", cflags) + end + if cxflags then + os.addenv("CFLAGS", cxflags) + os.addenv("CXXFLAGS", cxflags) + end + if cxxflags then + os.addenv("CXXFLAGS", cxxflags) + end + if asflags then + os.addenv("ASFLAGS", asflags) + end + for _, dep in ipairs(package:orderdeps()) do + local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") + if os.isdir(pkgconfig) then + os.addenv("PKG_CONFIG_PATH", pkgconfig) + end + local aclocal = path.join(dep:installdir(), "share", "aclocal") + if os.isdir(aclocal) then + os.addenv("ACLOCAL_PATH", aclocal) + end + end + return envs +end + +-- leave environments +function _leave_envs(package, envs) + for k, v in pairs(envs) do + os.setenv(k, v) + end +end + -- install package function install(package, configs) @@ -34,12 +96,9 @@ function install(package, configs) end end - -- inherit require and option configs + -- pass configurations local argv = {} - if not configs or not configs.prefix then - table.insert(argv, "--prefix=" .. package:installdir()) - end - for name, value in pairs(configs) do + for name, value in pairs(_get_configs(package, configs)) do value = tostring(value):trim() if type(name) == "number" then if value ~= "" then @@ -50,15 +109,8 @@ function install(package, configs) end end - -- inherit flags from configs - local flags_prev = {} - for _, name in ipairs({"cflags", "cxxflags", "ldflags"}) do - local flags = package:config(name) or (configs and configs[name] or nil) - if flags then - flags_prev[name] = os.getenv(name:upper()) - os.addenv(name:upper(), flags) - end - end + -- enter environments + local envs = _enter_envs(package) -- do configure os.vrunv("./configure", argv) @@ -67,9 +119,7 @@ function install(package, configs) os.vrun("make -j4") os.vrun("make install") - -- restore flags - for name, flags in pairs(flags_prev) do - os.setenv(name:upper(), flags) - end + -- leave environments + _leave_envs(package, envs) end diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index cbcf99014..f7afc56c5 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -26,6 +26,59 @@ import("core.base.option") import("lib.detect.find_file") +-- get configs +function _get_configs(package, configs) + local configs = configs or {} + if package:plat() == "windows" then + local vs_runtime = package:config("vs_runtime") + if vs_runtime then + table.insert(configs, '-DCMAKE_CXX_FLAGS_DEBUG="/' .. vs_runtime .. 'd"') + table.insert(configs, '-DCMAKE_CXX_FLAGS_RELEASE="/' .. vs_runtime .. '"') + table.insert(configs, '-DCMAKE_C_FLAGS_DEBUG="/' .. vs_runtime .. 'd"') + table.insert(configs, '-DCMAKE_C_FLAGS_RELEASE="/' .. vs_runtime .. '"') + end + end + local cflags = package:config("cflags") + if cflags then + table.insert(configs, '-DCMAKE_C_FLAGS="' .. cflags .. '"') + end + local cxflags = package:config("cxflags") + if cxflags then + table.insert(configs, '-DCMAKE_C_FLAGS="' .. cxflags .. '"') + table.insert(configs, '-DCMAKE_CXX_FLAGS="' .. cxflags .. '"') + end + local cxxflags = package:config("cxxflags") + if cxxflags then + table.insert(configs, '-DCMAKE_CXX_FLAGS="' .. cxxflags .. '"') + end + local asflags = package:config("asflags") + if asflags then + table.insert(configs, '-DCMAKE_ASM_FLAGS="' .. asflags .. '"') + end + return configs +end + +-- enter environments +function _enter_envs(package) + + -- get old environments + local envs = {} + envs.CMAKE_PREFIX_PATH = os.getenv("CMAKE_PREFIX_PATH") + + -- set new environments + for _, dep in ipairs(package:orderdeps()) do + os.addenv("CMAKE_PREFIX_PATH", dep:installdir()) + end + return envs +end + +-- leave environments +function _leave_envs(package, envs) + for k, v in pairs(envs) do + os.setenv(k, v) + end +end + -- install package function install(package, configs) @@ -39,7 +92,9 @@ function install(package, configs) table.insert(argv, "-A") table.insert(argv, "x64") end - for name, value in pairs(configs) do + + -- pass configurations + for name, value in pairs(_get_configs(package, configs)) do value = tostring(value):trim() if type(name) == "number" then if value ~= "" then @@ -51,6 +106,9 @@ function install(package, configs) end table.insert(argv, '..') + -- enter environments + local envs = _enter_envs(package) + -- generate build file os.vrunv("cmake", argv) @@ -74,6 +132,9 @@ function install(package, configs) os.cp("install/lib", package:installdir()) os.cp("install/include", package:installdir()) end + + -- leave environments + _leave_envs(package, envs) os.cd(oldir) end diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index 042b0c468..cc0fe0d45 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -25,11 +25,40 @@ -- imports import("core.base.option") +-- get configs +function _get_configs(package, configs) + local configs = configs or {} + local cflags = package:config("cflags") + local cxflags = package:config("cxflags") + local cxxflags = package:config("cxxflags") + local asflags = package:config("asflags") + if package:plat() == "windows" then + local vs_runtime = package:config("vs_runtime") + if vs_runtime then + cxflags = (cxflags or "") .. " /" .. vs_runtime .. (package:debug() and "d" or "") + end + end + table.insert(configs, "--mode=" .. (package:debug() and "debug" or "release")) + if cflags then + table.insert(configs, '--cflags="' .. cflags .. '"') + end + if cxflags then + table.insert(configs, '--cxflags="' .. cxflags .. '"') + end + if cxxflags then + table.insert(configs, '--cxxflags="' .. cxxflags .. '"') + end + if asflags then + table.insert(configs, '--asflags="' .. asflags .. '"') + end + return configs +end + -- install package function install(package, configs) -- inherit builtin configs - local argv = {"f", "-y"} + local argv = {"f", "-y"} local names = {"plat", "arch", "ndk", "ndk_sdkver", "vs", "sdk", "bin", "cross", "ld", "sh", "ar", "cc", "cxx", "mm", "mxx"} for _, name in ipairs(names) do local value = get_config(name) @@ -37,11 +66,17 @@ function install(package, configs) table.insert(argv, "--" .. name .. "=" .. tostring(value)) end end - table.insert(argv, "--mode=" .. (package:debug() and "debug" or "release")) - -- inherit require and option configs - for name, value in pairs(table.join(package:configs() or {}, configs or {})) do - table.insert(argv, "--" .. name .. "=" .. tostring(value)) + -- pass configurations + for name, value in pairs(_get_configs(package, configs)) do + value = tostring(value):trim() + if type(name) == "number" then + if value ~= "" then + table.insert(argv, value) + end + else + table.insert(argv, "--" .. name .. "=" .. value) + end end if option.get("verbose") then table.insert(argv, "-v") |
