summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-03-19 23:59:44 +0800
committerruki <[email protected]>2019-03-19 17:58:29 +0800
commit568e0263260ca2c3f81bc842c273181c00e0b4f4 (patch)
treeb1cca7d9a9a96cf87d91bb9af3b826e9d577c387
parent5b409ef365114ccf02c1c8297fe338518a6e2ad0 (diff)
fix package PATH
-rw-r--r--xmake/actions/require/impl/action/install.lua12
-rw-r--r--xmake/core/package/package.lua4
-rw-r--r--xmake/modules/detect/tools/find_cmake.lua2
3 files changed, 13 insertions, 5 deletions
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua
index 9150e30a4..75e07d033 100644
--- a/xmake/actions/require/impl/action/install.lua
+++ b/xmake/actions/require/impl/action/install.lua
@@ -162,8 +162,16 @@ function main(package)
-- leave the package environments
package:envs_leave()
- -- remove the invalid package directory
- os.tryrm(package:installdir())
+ -- copy the invalid package directory to cache
+ local installdir = package:installdir()
+ if os.isdir(installdir) then
+ local installdir_failed = path.join(package:cachedir(), "installdir.failed")
+ os.tryrm(installdir_failed)
+ if not os.isdir(installdir_failed) then
+ os.cp(installdir, installdir_failed)
+ end
+ end
+ os.tryrm(installdir)
-- failed
if not package:requireinfo().optional then
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 84003d9cc..36f4ce3d4 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -322,7 +322,7 @@ function _instance:envs()
if not envs then
envs = {}
if self:kind() == "binary" then
- envs = {"bin"}
+ envs.PATH = {"bin"}
end
self._ENVS = envs
end
@@ -618,7 +618,7 @@ end
--
-- @param opt the fetch option, .e.g {force = true, system = false}
--
--- @return {packageinfo}, fetchfrom (.e.g global/system)
+-- @return {packageinfo}, fetchfrom (.e.g xmake/system)
--
function _instance:fetch(opt)
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