summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-02 23:16:24 +0800
committerruki <[email protected]>2021-06-02 23:16:24 +0800
commit76a7ac04e4a1a07347fd1fb6bc43374e2ff88dc6 (patch)
tree5144d821fdca1f3df22c477a2bc48263a4b9311a
parent50a79cc6fcece9b826d60ccd54998176df5db43e (diff)
add more package options
-rw-r--r--xmake/actions/package/local/main.lua14
-rw-r--r--xmake/actions/package/remote/main.lua18
-rw-r--r--xmake/actions/package/xmake.lua6
3 files changed, 31 insertions, 7 deletions
diff --git a/xmake/actions/package/local/main.lua b/xmake/actions/package/local/main.lua
index 33aed24b7..28d235126 100644
--- a/xmake/actions/package/local/main.lua
+++ b/xmake/actions/package/local/main.lua
@@ -53,7 +53,12 @@ function _package_binary(target)
table.insert(deps, dep:name())
end
file:print("package(\"%s\")", packagename)
- file:print(" set_description(\"%s\")", "The " .. packagename .. " package")
+ local homepage = option.get("homepage")
+ if homepage then
+ file:print(" set_homepage(\"%s\")", homepage)
+ end
+ local description = option.get("description") or ("The " .. packagename .. " package")
+ file:print(" set_description(\"%s\")", description)
if target:license() then
file:print(" set_license(\"%s\")", target:license())
end
@@ -130,7 +135,12 @@ function _package_library(target)
table.insert(deps, dep:name())
end
file:print("package(\"%s\")", packagename)
- file:print(" set_description(\"%s\")", "The " .. packagename .. " package")
+ local homepage = option.get("homepage")
+ if homepage then
+ file:print(" set_homepage(\"%s\")", homepage)
+ end
+ local description = option.get("description") or ("The " .. packagename .. " package")
+ file:print(" set_description(\"%s\")", description)
if target:license() then
file:print(" set_license(\"%s\")", target:license())
end
diff --git a/xmake/actions/package/remote/main.lua b/xmake/actions/package/remote/main.lua
index 3d46d10ba..6b108e60e 100644
--- a/xmake/actions/package/remote/main.lua
+++ b/xmake/actions/package/remote/main.lua
@@ -49,7 +49,12 @@ function _package_remote(target)
if target:is_binary() then
file:print(" set_kind(\"binary\")")
end
- file:print(" set_description(\"%s\")", "The " .. packagename .. " package")
+ local homepage = option.get("homepage")
+ if homepage then
+ file:print(" set_homepage(\"%s\")", homepage)
+ end
+ local description = option.get("description") or ("The " .. packagename .. " package")
+ file:print(" set_description(\"%s\")", description)
if target:license() then
file:print(" set_license(\"%s\")", target:license())
end
@@ -57,10 +62,13 @@ function _package_remote(target)
file:print(" set_deps(\"%s\")", table.concat(deps, "\", \""))
end
file:print("")
+ local url = option.get("url") or "https://github.com/myrepo/foo.git"
+ local version = option.get("version") or target:version() and (target:version()) or "1.0"
+ local shasum = option.get("shasum") or "<shasum256 or gitcommit>"
+ file:print(" add_urls(\"%s\")", url)
+ file:print(" add_versions(\"%s\", \"%s\")", version, shasum)
+ file:print("")
file:print([[
- add_urls("https://github.com/myrepo/foo.git")
- add_versions("%s", "<shasum256 or gitcommit>")
-
on_install(function (package)
local configs = {}
if package:config("shared") then
@@ -72,7 +80,7 @@ function _package_remote(target)
on_test(function (package)
-- TODO check includes and interfaces
-- assert(package:has_cfuncs("foo", {includes = "foo.h"})
- end)]], target:version() and (target:version()) or "1.0")
+ end)]])
file:close()
end
diff --git a/xmake/actions/package/xmake.lua b/xmake/actions/package/xmake.lua
index 0a757a1eb..dd7b1846f 100644
--- a/xmake/actions/package/xmake.lua
+++ b/xmake/actions/package/xmake.lua
@@ -28,8 +28,14 @@ task("package")
options = {
{'o', "outputdir", "kv", nil, "Set the output directory."},
{'a', "all", "k", nil, "Package all targets."},
+ {},
{'f', "format", "kv", "local", "Set the package format.",
values = {"oldpkg", "local", "remote"}},
+ {nil, "homepage", "kv", nil, "Set the homepage of package."},
+ {nil, "description","kv", nil, "Set the description of package."},
+ {nil, "url", "kv", nil, "Set the url of remote package."},
+ {nil, "version", "kv", nil, "Set the version of remove package."},
+ {nil, "shasum", "kv", nil, "Set the sha256 or commit of remote package."},
{},
{nil, "target", "v", nil, "The target name. It will package all default targets if this parameter is not specified.",
values = function (complete, opt)