From dafa53ffa7449b635bbd72d1489ed430674e5af4 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 15 Nov 2023 00:05:14 +0800 Subject: add bindir and libdir --- xmake/includes/xpack/xmake.lua | 6 +++++- xmake/plugins/pack/xpack.lua | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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} -- cgit v1.3.1