summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-07-31 23:38:38 +0800
committerruki <[email protected]>2025-07-31 23:38:38 +0800
commit9a69715ad0b6d1f92bed9766178185ccf090ff6f (patch)
treed8a31214e4ae300a3461a1f81ee7085b69b23256
parentcf59b0d2890715666ff1a30631f7541cebf5f48e (diff)
improve to xmake.install to copy ported xmake.lua
-rw-r--r--xmake/modules/package/tools/xmake.lua19
1 files changed, 14 insertions, 5 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index f8b48bb41..17cf48a2e 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -487,9 +487,18 @@ end
-- install package
function install(package, configs, opt)
+ opt = opt or {}
+
+ -- copy the ported xmake.lua in the default position if it's missing
+ local xmakefile = path.join(opt.curdir or os.curdir(), "xmake.lua")
+ if not os.isfile(xmakefile) then
+ local xmakefile_port = path.join(package:scriptdir(), "port", "xmake.lua")
+ if os.isfile(xmakefile_port) then
+ os.cp(xmakefile_port, xmakefile)
+ end
+ end
-- get build environments
- opt = opt or {}
local envs = opt.envs or buildenvs(package)
-- pass local repositories
@@ -497,7 +506,7 @@ function install(package, configs, opt)
local repo_argv = {"repo"}
_set_builtin_argv(package, repo_argv)
table.join2(repo_argv, {"--add", repo:name(), repo:directory()})
- os.vrunv(os.programfile(), repo_argv, {envs = envs})
+ os.vrunv(os.programfile(), repo_argv, {envs = envs, curdir = opt.curdir})
end
-- pass configurations
@@ -518,7 +527,7 @@ function install(package, configs, opt)
end
-- do configure
- os.vrunv(os.programfile(), argv, {envs = envs})
+ os.vrunv(os.programfile(), argv, {envs = envs, curdir = opt.curdir})
-- do build
argv = {"build"}
@@ -531,7 +540,7 @@ function install(package, configs, opt)
if #targets ~= 0 then
table.join2(argv, targets)
end
- os.vrunv(os.programfile(), argv, {envs = envs})
+ os.vrunv(os.programfile(), argv, {envs = envs, curdir = opt.curdir})
-- do install
argv = {"install", "-y", "--nopkgs", "-o", package:installdir()}
@@ -540,5 +549,5 @@ function install(package, configs, opt)
if #targets ~= 0 then
table.join2(argv, targets)
end
- os.vrunv(os.programfile(), argv, {envs = envs})
+ os.vrunv(os.programfile(), argv, {envs = envs, curdir = opt.curdir})
end