summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-04-27 00:37:26 +0800
committerruki <[email protected]>2019-04-26 21:44:37 +0800
commitaf03058084d45e4d1c437a2f43205cf69c2b93ec (patch)
treebc73231a9d4b04169228a2630396bc1d0ca7ad73
parent600fb4fab529ae55a44ccdfd6045046309db8f4f (diff)
rename path.sep
-rw-r--r--xmake/core/base/path.lua7
-rw-r--r--xmake/core/sandbox/modules/import/core/sandbox/module.lua4
-rw-r--r--xmake/modules/package/tools/autoconf.lua38
3 files changed, 13 insertions, 36 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index 2748b446b..489f6b702 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -93,10 +93,15 @@ function path.split(p)
end
-- get the path seperator
-function path.seperator()
+function path.sep()
return xmake._HOST == "windows" and '\\' or '/'
end
+-- get the path seperator of environment variable
+function path.envsep()
+ return xmake._HOST == "windows" and ';' or ':'
+end
+
-- the last character is the path seperator?
function path.islastsep(p)
local sep = p:sub(#p, #p)
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
index 3c30b982b..a4915f1aa 100644
--- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua
+++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
@@ -43,9 +43,9 @@ function core_sandbox_module._modulepath(name)
local modulepath = name:gsub(".", function(c)
if c == '.' then
if startdots then
- return ".." .. path.seperator()
+ return ".." .. path.sep()
else
- return path.seperator()
+ return path.sep()
end
else
startdots = false
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index c97ba705b..1ff42da48 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -68,27 +68,12 @@ function _get_configs(package, configs)
return configs
end
--- enter environments
-function _enter_envs(package, opt)
+-- get the build environments
+function _get_build_envs(package, opt)
+ -- TODO construct environments
-- get old environments
- local envs = {}
- envs.CC = os.getenv("CC")
- envs.AS = os.getenv("AS")
- envs.AR = os.getenv("AR")
- envs.LD = os.getenv("LD")
- envs.CPP = os.getenv("CPP")
- envs.LDSHARED = os.getenv("LDSHARED")
- envs.RANLIB = os.getenv("RANLIB")
- envs.CFLAGS = os.getenv("CFLAGS")
- envs.CXXFLAGS = os.getenv("CXXFLAGS")
- envs.ASFLAGS = os.getenv("ASFLAGS")
- envs.LDFLAGS = os.getenv("LDFLAGS")
- envs.ARFLAGS = os.getenv("ARFLAGS")
- envs.SHFLAGS = os.getenv("SHFLAGS")
- envs.TOOLCHAIN = os.getenv("TOOLCHAIN")
- envs.ACLOCAL_PATH = os.getenv("ACLOCAL_PATH")
- envs.PKG_CONFIG_PATH = os.getenv("PKG_CONFIG_PATH")
+ local envs = {}
-- set new environments
if package:is_plat(os.host()) then
@@ -127,13 +112,6 @@ function _enter_envs(package, opt)
return envs
end
--- leave environments
-function _leave_envs(package, envs)
- for k, v in pairs(envs) do
- os.setenv(k, v)
- end
-end
-
-- configure package
function configure(package, configs, opt)
@@ -162,14 +140,8 @@ function configure(package, configs, opt)
end
end
- -- enter environments
- local envs = _enter_envs(package, opt)
-
-- do configure
- os.vrunv("./configure", argv)
-
- -- leave environments
- _leave_envs(package, envs)
+ os.vrunv("./configure", argv, {envs = _get_build_envs(package, opt)})
end
-- install package