summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-23 22:43:15 +0800
committerruki <[email protected]>2020-04-23 10:19:31 +0800
commita8598427d2d0253083b5413df333631d0b3a02c5 (patch)
tree62e8558fd2f7e86e521dd9f92f5dceb78ea99eb9
parentd41e6aeb8aa516742895d64f36025db50e8f857f (diff)
improve xmake.cli rule
-rw-r--r--xmake/rules/xmake_cli/xmake.lua37
1 files changed, 17 insertions, 20 deletions
diff --git a/xmake/rules/xmake_cli/xmake.lua b/xmake/rules/xmake_cli/xmake.lua
index 455a67365..a3aad786b 100644
--- a/xmake/rules/xmake_cli/xmake.lua
+++ b/xmake/rules/xmake_cli/xmake.lua
@@ -25,37 +25,34 @@ rule("xmake.cli")
assert(target:pkg("libxmake"), 'please add_packages("libxmake") to target(%s) first!', target:name())
end)
after_install(function (target)
- -- install xmake/cli program
+
+ -- install xmake-core lua scripts first
+ local libxmake = target:pkg("libxmake")
+ local programdir = path.join(path.directory(libxmake:get("linkdirs")), "share", "xmake")
+ local installdir = path.join(target:installdir(), "share", target:name())
+ assert(os.isdir(programdir), "%s not found!", programdir)
+ if not os.isdir(installdir) then
+ os.mkdir(installdir)
+ end
+ os.vcp(path.join(programdir, "*"), installdir)
+
+ -- install xmake/cli lua scripts
--
-- - bin
-- - hello
-- - share
-- - hello
- -- - lua
- -- - main.lua
- -- - core
- -- - ..
+ -- - modules
+ -- - lua
+ -- - main.lua
--
+
local scriptdir = path.join(target:scriptdir(), "src")
if not os.isfile(path.join(scriptdir, "lua", "main.lua")) then
import("lib.detect.find_path")
scriptdir = assert(find_path("lua/main.lua", path.join(target:scriptdir(), "**")), "lua/main.lua not found!")
end
- local installdir = path.join(target:installdir(), "share", target:name())
- if not os.isdir(installdir) then
- os.mkdir(installdir)
- end
- os.vcp(path.join(scriptdir, "lua"), installdir)
-
- -- install xmake-core lua scripts
- local libxmake = target:pkg("libxmake")
- local programdir = path.join(path.directory(libxmake:get("linkdirs")), "share", "xmake")
- assert(os.isdir(programdir), "%s not found!", programdir)
- local coredir = path.join(installdir, "core")
- if not os.isdir(coredir) then
- os.mkdir(coredir)
- end
- os.vcp(path.join(programdir, "*"), coredir)
+ os.vcp(path.join(scriptdir, "lua"), path.join(installdir, "modules"))
end)
before_run(function (target)
local scriptdir = path.join(target:scriptdir(), "src")