summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-15 00:05:14 +0800
committerruki <[email protected]>2023-11-15 00:05:14 +0800
commitdafa53ffa7449b635bbd72d1489ed430674e5af4 (patch)
tree78b727c180ebee7544731f8cefee75decbd76eab
parent9a5ca6742079c85d78d84f0bcecfae577628e201 (diff)
add bindir and libdir
-rw-r--r--xmake/includes/xpack/xmake.lua6
-rw-r--r--xmake/plugins/pack/xpack.lua18
2 files changed, 23 insertions, 1 deletions
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index 5227c360a..d2e6e4a07 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -45,7 +45,11 @@ local apis = {
-- set the base name of the output file
"xpack.set_basename",
-- add targets to be packaged
- "xpack.add_targets"
+ "xpack.add_targets",
+ -- set installed binary directory, e.g. bin
+ "xpack.set_bindir",
+ -- set installed library directory, e.g. lib
+ "xpack.set_libdir"
},
paths = {
-- set the spec file path, support the custom variable pattern, e.g. set_specfile("", {pattern = "%${([^\n]-)}"})
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index b0a7b7394..bb8f0b8c9 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -418,6 +418,24 @@ function xpack:installfiles(outputdir)
return self:_copiedfiles("installfiles", outputdir)
end
+-- get the binary directory
+function xpack:bindir()
+ local bindir = self:get("bindir")
+ if bindir == nil then
+ bindir = "bin"
+ end
+ return bindir
+end
+
+-- get the library directory
+function xpack:libdir()
+ local libdir = self:get("libdir")
+ if libdir == nil then
+ libdir = "lib"
+ end
+ return libdir
+end
+
-- new a xpack
function _new(name, info)
return xpack {name, info}