diff options
| author | ruki <[email protected]> | 2023-11-16 23:36:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-16 23:36:15 +0800 |
| commit | d0f5f984219c480112a941d9de520254a844757a (patch) | |
| tree | 00095948c674cd339c6b40cba691f9218d14b6f5 | |
| parent | 2013ee491dbc719aa674d4d8be5d40a2408b5213 (diff) | |
install winenv
| -rw-r--r-- | core/src/demo/xmake.lua | 2 | ||||
| -rw-r--r-- | core/xpack.lua | 14 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 3 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 24 |
4 files changed, 39 insertions, 4 deletions
diff --git a/core/src/demo/xmake.lua b/core/src/demo/xmake.lua index 0d8e00866..02466b31f 100644 --- a/core/src/demo/xmake.lua +++ b/core/src/demo/xmake.lua @@ -65,6 +65,6 @@ target("demo") add_installfiles("$(projectdir)/../(xmake/**.lua)", {prefixdir = "share"}) add_installfiles("$(projectdir)/../(xmake/scripts/**)", {prefixdir = "share"}) add_installfiles("$(projectdir)/../(xmake/templates/**)", {prefixdir = "share"}) - add_installfiles("$(projectdir)/../scripts/xrepo.sh", {prefixdir = "bin"}) -- TODO rename xrepo.sh to xrepo + add_installfiles("$(projectdir)/../scripts/xrepo.sh", {prefixdir = "bin", filename = "xrepo"}) end diff --git a/core/xpack.lua b/core/xpack.lua index 6da1680a4..c41220dc2 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -18,6 +18,20 @@ xpack("xmake") package:set("basename", "xmake-v$(version)." .. arch) end) + before_package(function (package) + import("net.http") + import("utils.archive") + local format = package:format() + if package:is_plat("windows") and (format == "nsis" or format == "zip") then + local winenv = path.join(os.programdir(), "winenv") + if os.isdir(winenv) then + package:add("installfiles", path.join(winenv, "**"), {rootdir = path.directory(winenv)}) + else + -- TODO download + end + end + end) + add_nsis_installcmds("Enable Long Path", [[ ${If} $NoAdmin == "false" ; Enable long path diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 54e5c03ab..455d0c7cf 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -216,6 +216,9 @@ function _instance:_copiedfiles(filetype, outputdir, pathfilter) -- get the prefix directory local prefixdir = fileinfo.prefixdir + if fileinfo.rootdir then + rootdir = fileinfo.rootdir + end -- add the destinate copied files for _, srcpath in ipairs(srcpaths) do diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 9e747cc0a..ce81cba8a 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -36,17 +36,24 @@ function xpack:name() return self._name end --- get value +-- get values function xpack:get(name) if self._info then return self._info:get(name) end end --- set value +-- set values function xpack:set(name, ...) if self._info then - self._info:set(name, ...) + self._info:apival_set(name, ...) + end +end + +-- add values +function xpack:add(name, ...) + if self._info then + self._info:apival_add(name, ...) end end @@ -167,6 +174,14 @@ function xpack:targets() return targets end +-- get the given target +function xpack:target(name) + local targetnames = self:get("targets") + if targetnames and table.contains(table.wrap(targetnames), name) then + return project.target(name) + end +end + -- get formats function xpack:formats() local formats = self._formats @@ -386,6 +401,9 @@ function xpack:_copiedfiles(filetype, outputdir) -- get the prefix directory local prefixdir = fileinfo.prefixdir + if fileinfo.rootdir then + rootdir = fileinfo.rootdir + end -- add the destinate copied files for _, srcpath in ipairs(srcpaths) do |
