summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/autoconf.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-31 21:00:02 +0800
committerGitHub <[email protected]>2024-03-31 21:00:02 +0800
commitdee0d869c5630bbbf464be28ca62331be36aff3d (patch)
tree39f81f838d6b397277137122760a9cdad525b6e3 /xmake/modules/package/tools/autoconf.lua
parentcec09d4b59cb5b872bb91469a9bfaa731eff77dd (diff)
parent7b1058df4ae787b9a5df4a96edf0dc8fc30910b0 (diff)
Merge pull request #4903 from SirLynix/patch-7
ndk: use unix path even on Windows
Diffstat (limited to 'xmake/modules/package/tools/autoconf.lua')
-rw-r--r--xmake/modules/package/tools/autoconf.lua42
1 files changed, 22 insertions, 20 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 9f4181b0b..f7a847ce0 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -28,8 +28,8 @@ import("core.cache.memcache")
import("lib.detect.find_tool")
-- translate paths
-function _translate_paths(package, paths)
- if paths and is_host("windows") and package:is_plat("mingw", "msys", "cygwin") then
+function _translate_paths(paths)
+ if paths and is_host("windows") then
if type(paths) == "string" then
return path.unix(paths)
elseif type(paths) == "table" then
@@ -123,7 +123,7 @@ function _get_configs(package, configs)
-- add prefix
local configs = configs or {}
- table.insert(configs, "--prefix=" .. _translate_paths(package, package:installdir()))
+ table.insert(configs, "--prefix=" .. _translate_paths(package:installdir()))
-- add host for cross-complation
if not configs.host and _is_cross_compilation(package) then
@@ -188,8 +188,8 @@ function _get_cflags_from_packagedeps(package, opt)
local fetchinfo = dep:fetch({external = false})
if fetchinfo then
table.join2(result, _map_compflags(package, "cxx", "define", fetchinfo.defines))
- table.join2(result, _translate_paths(package, _map_compflags(package, "cxx", "includedir", fetchinfo.includedirs)))
- table.join2(result, _translate_paths(package, _map_compflags(package, "cxx", "sysincludedir", fetchinfo.sysincludedirs)))
+ table.join2(result, _translate_paths(_map_compflags(package, "cxx", "includedir", fetchinfo.includedirs)))
+ table.join2(result, _translate_paths(_map_compflags(package, "cxx", "sysincludedir", fetchinfo.sysincludedirs)))
end
end
end
@@ -204,9 +204,9 @@ function _get_ldflags_from_packagedeps(package, opt)
if dep then
local fetchinfo = dep:fetch({external = false})
if fetchinfo then
- table.join2(result, _translate_paths(package, _map_linkflags(package, "binary", {"cxx"}, "linkdir", fetchinfo.linkdirs)))
+ table.join2(result, _translate_paths(_map_linkflags(package, "binary", {"cxx"}, "linkdir", fetchinfo.linkdirs)))
table.join2(result, _map_linkflags(package, "binary", {"cxx"}, "link", fetchinfo.links))
- table.join2(result, _translate_paths(package, _map_linkflags(package, "binary", {"cxx"}, "syslink", fetchinfo.syslinks)))
+ table.join2(result, _translate_paths(_map_linkflags(package, "binary", {"cxx"}, "syslink", fetchinfo.syslinks)))
table.join2(result, _map_linkflags(package, "binary", {"cxx"}, "framework", fetchinfo.frameworks))
end
end
@@ -243,11 +243,6 @@ function buildenvs(package, opt)
table.join2(cxxflags, _get_cflags_from_packagedeps(package, opt))
table.join2(cppflags, _get_cflags_from_packagedeps(package, opt))
table.join2(ldflags, _get_ldflags_from_packagedeps(package, opt))
- envs.CFLAGS = table.concat(cflags, ' ')
- envs.CXXFLAGS = table.concat(cxxflags, ' ')
- envs.CPPFLAGS = table.concat(cppflags, ' ')
- envs.ASFLAGS = table.concat(asflags, ' ')
- envs.LDFLAGS = table.concat(ldflags, ' ')
else
cross = true
cppflags = {}
@@ -314,18 +309,26 @@ function buildenvs(package, opt)
table.join2(cxxflags, package:_generate_sanitizer_configs("address", "cxx").cxxflags)
table.join2(ldflags, package:_generate_sanitizer_configs("address").ldflags)
end
- envs.CFLAGS = table.concat(cflags, ' ')
- envs.CXXFLAGS = table.concat(cxxflags, ' ')
- envs.CPPFLAGS = table.concat(cppflags, ' ')
- envs.ASFLAGS = table.concat(asflags, ' ')
+ if cflags then
+ envs.CFLAGS = table.concat(_translate_paths(cflags), ' ')
+ end
+ if cxxflags then
+ envs.CXXFLAGS = table.concat(_translate_paths(cxxflags), ' ')
+ end
+ if cppflags then
+ envs.CPPFLAGS = table.concat(_translate_paths(cppflags), ' ')
+ end
+ if asflags then
+ envs.ASFLAGS = table.concat(_translate_paths(asflags), ' ')
+ end
if arflags then
- envs.ARFLAGS = table.concat(arflags, ' ')
+ envs.ARFLAGS = table.concat(_translate_paths(arflags), ' ')
end
if ldflags then
- envs.LDFLAGS = table.concat(ldflags, ' ')
+ envs.LDFLAGS = table.concat(_translate_paths(ldflags), ' ')
end
if shflags then
- envs.SHFLAGS = table.concat(shflags, ' ')
+ envs.SHFLAGS = table.concat(_translate_paths(shflags), ' ')
end
-- cross-compilation? pass the full build environments
@@ -575,4 +578,3 @@ function install(package, configs, opt)
end
make(package, argv, opt)
end
-