summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-27 00:29:13 +0800
committerruki <[email protected]>2022-07-27 00:29:13 +0800
commit5559d30a41da6b7e7a305cb7c239776ea646bbd7 (patch)
treea200e8157fcff5f14ea4ee0f448ccfbafb65e1de
parent15523799e55e04e8421c9a61da413d2a1814a0b2 (diff)
add pkg_cachedir
-rw-r--r--xmake/actions/global/xmake.lua1
-rw-r--r--xmake/core/package/package.lua2
2 files changed, 2 insertions, 1 deletions
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index 224bf06fd..ab8fa1366 100644
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -76,6 +76,7 @@ task("global")
{nil, "pkg_searchdirs", "kv", nil , "The search directories of the remote package."
, " e.g."
, " - xmake g --pkg_searchdirs=/dir1" .. path.envsep() .. "/dir2"},
+ {nil, "pkg_cachedir", "kv", nil , "The cache root directory of the remote package."},
{nil, "pkg_installdir", "kv", nil , "The install root directory of the remote package."},
-- show platform menu options
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 08a6846a7..94dd88b61 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2054,7 +2054,7 @@ function package.cachedir(opt)
opt = opt or {}
local cachedir = package._CACHEDIR
if not cachedir then
- cachedir = os.getenv("XMAKE_PKG_CACHEDIR") or path.join(global.cachedir(), "packages")
+ cachedir = os.getenv("XMAKE_PKG_CACHEDIR") or global.get("pkg_cachedir") or path.join(global.cachedir(), "packages")
package._CACHEDIR = cachedir
end
if opt.rootonly then