summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-16 23:05:56 +0800
committerruki <[email protected]>2023-11-16 23:05:56 +0800
commit41de52de7a82e4ed8ef7e0b86ebed344e69820ea (patch)
treeefc47095943cb54e64289d565a2243ea920e1272
parentd7cac5b8d0cde98ab4979c6e7602042511a27833 (diff)
add xpack to xmake/core
-rw-r--r--core/xmake.lua8
-rw-r--r--core/xpack.lua26
-rw-r--r--xmake/plugins/pack/main.lua4
-rw-r--r--xmake/plugins/pack/xmake.lua1
-rw-r--r--xmake/plugins/pack/xpack.lua7
5 files changed, 44 insertions, 2 deletions
diff --git a/core/xmake.lua b/core/xmake.lua
index 0c667af7c..a2029cff2 100644
--- a/core/xmake.lua
+++ b/core/xmake.lua
@@ -5,7 +5,7 @@ set_project("xmake")
set_version("2.8.5", {build = "%Y%m%d"})
-- set xmake min version
-set_xmakever("2.2.3")
+set_xmakever("2.8.5")
-- set all warnings as errors
set_warnings("all", "error")
@@ -111,3 +111,9 @@ end
if is_plat("windows") then
includes("src/pdcurses")
end
+
+-- add xpack
+includes("@builtin/xpack")
+if xpack then
+ includes("xpack.lua")
+end
diff --git a/core/xpack.lua b/core/xpack.lua
new file mode 100644
index 000000000..6da1680a4
--- /dev/null
+++ b/core/xpack.lua
@@ -0,0 +1,26 @@
+xpack("xmake")
+ set_formats("nsis")
+ set_description("A cross-platform build utility based on Lua. https://xmake.io")
+ set_licensefile("../LICENSE.md")
+ add_targets("demo")
+ set_bindir(".")
+ set_iconfile("src/demo/xmake.ico")
+
+ on_load(function (package)
+ local arch = package:arch()
+ if package:is_plat("windows") then
+ if arch == "x64" then
+ arch = "win64"
+ elseif arch == "x86" then
+ arch = "win32"
+ end
+ end
+ package:set("basename", "xmake-v$(version)." .. arch)
+ end)
+
+ add_nsis_installcmds("Enable Long Path", [[
+ ${If} $NoAdmin == "false"
+ ; Enable long path
+ WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
+ ${EndIf}]], {description = "Increases the maximum path length limit, up to 32,767 characters (before 256)."})
+
diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua
index 09160fda0..dfaac68d8 100644
--- a/xmake/plugins/pack/main.lua
+++ b/xmake/plugins/pack/main.lua
@@ -81,7 +81,9 @@ function main()
local oldir = os.cd(project.directory())
-- build targets first
- _build_targets()
+ if option.get("autobuild") then
+ _build_targets()
+ end
-- do pack
_pack_packages()
diff --git a/xmake/plugins/pack/xmake.lua b/xmake/plugins/pack/xmake.lua
index 4bbd7f4bf..ce2a6e701 100644
--- a/xmake/plugins/pack/xmake.lua
+++ b/xmake/plugins/pack/xmake.lua
@@ -26,6 +26,7 @@ task("pack")
description = "Pack binary installation packages.",
options = {
{'o', "outputdir", "kv", nil, "The output directory. (default: build/xpack)"},
+ {nil, "autobuild", "kv", true, "Build targets automatically."},
{'f', "formats", "kv", "all", "Pack the given package formats.",
"e.g.",
" - xmake pack -f nsis,deb,rpm",
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index c925a9af1..9e747cc0a 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -43,6 +43,13 @@ function xpack:get(name)
end
end
+-- set value
+function xpack:set(name, ...)
+ if self._info then
+ self._info:set(name, ...)
+ end
+end
+
-- get the extra configuration
function xpack:extraconf(name, item, key)
if self._info then