summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-10 00:51:35 +0800
committerruki <[email protected]>2020-10-11 11:08:21 +0800
commit6d6420ebc14c3ec019e5b1c71a10ad24a712511e (patch)
tree8e59a3b9f39a5404e09f57ca76f55425caa3f026
parentdf375449368d5d6b03ed70f5fdeaa4256319b985 (diff)
improve autoconf
-rw-r--r--xmake/modules/package/tools/autoconf.lua32
1 files changed, 29 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index f9c64e44b..48e219e13 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -22,12 +22,29 @@
import("core.base.option")
import("core.project.config")
+-- translate path
+function _translate_path(package, p)
+ if p and is_host("windows") and package:is_plat("mingw") then
+ p = p:gsub("\\", "/")
+ end
+ return p
+end
+
+-- translate windows bin path
+function _translate_windows_bin_path(bin_path)
+ if bin_path then
+ local argv = os.argv(bin_path)
+ argv[1] = argv[1]:gsub("\\", "/") .. ".exe"
+ return os.args(argv)
+ end
+end
+
-- get configs
function _get_configs(package, configs)
-- add prefix
local configs = configs or {}
- table.insert(configs, "--prefix=" .. package:installdir())
+ table.insert(configs, "--prefix=" .. _translate_path(package, package:installdir()))
-- add host for cross-complation
if not configs.host and not package:is_plat(os.subhost()) then
@@ -113,11 +130,20 @@ function buildenvs(package)
local ld = envs.LD
if ld then
if ld:endswith("x86_64-w64-mingw32-g++") then
- envs.LD = path.join(path.directory(ld), "x86_64-w64-mingw32-ld")
+ envs.LD = path.join(path.directory(ld), is_host("windows") and "ld" or "x86_64-w64-mingw32-ld")
elseif ld:endswith("i686-w64-mingw32-g++") then
- envs.LD = path.join(path.directory(ld), "i686-w64-mingw32-ld")
+ envs.LD = path.join(path.directory(ld), is_host("windows") and "ld" or "i686-w64-mingw32-ld")
end
end
+ if is_host("windows") then
+ envs.CC = _translate_windows_bin_path(envs.CC)
+ envs.AS = _translate_windows_bin_path(envs.AS)
+ envs.AR = _translate_windows_bin_path(envs.AR)
+ envs.LD = _translate_windows_bin_path(envs.LD)
+ envs.LDSHARED = _translate_windows_bin_path(envs.LDSHARED)
+ envs.CPP = _translate_windows_bin_path(envs.CPP)
+ envs.RANLIB = _translate_windows_bin_path(envs.RANLIB)
+ end
end
end
local ACLOCAL_PATH = {}