diff options
Diffstat (limited to 'xmake/plugins/pack/xpack.lua')
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 8af36cdd9..89ee5a54b 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -206,6 +206,24 @@ function xpack:inputkind() return inputkind end +-- get the output kind +function xpack:outputkind() + local outputkinds = { + wix = "binary", + nsis = "binary", + zip = "binary", + targz = "binary", + srczip = "source", + srctargz = "source", + runself = "source", + deb = "binary", + srpm = "source", + rpm = "binary" + } + local outputkind = outputkinds[self:format()] or "binary" + return outputkind +end + -- pack from source files? function xpack:from_source() return self:inputkind() == "source" @@ -216,6 +234,16 @@ function xpack:from_binary() return self:inputkind() == "binary" end +-- pack with source files? +function xpack:with_source() + return self:outputkind() == "source" +end + +-- pack with binary files? +function xpack:with_binary() + return self:outputkind() == "binary" +end + -- get the build directory function xpack:buildir() return path.join(config.buildir(), ".xpack", self:name()) @@ -235,7 +263,7 @@ function xpack:basename() local basename = option.get("basename") or self:get("basename") if basename == nil then basename = self:name() - if self:from_source() then + if self:with_source() then basename = basename .. "-src" end local version = self:version() @@ -319,19 +347,6 @@ function xpack:specvars() return specvars end --- get the specfile path -function xpack:specfile() - local extensions = { - wix = ".wxs", - nsis = ".nsi", - srpm = ".spec", - rpm = ".spec", - runself = ".lsm" - } - local extension = extensions[self:format()] or ".spec" - return self:get("specfile") or path.join(self:buildir(), self:basename() .. extension) -end - -- get the extension function xpack:extension() local extension = self:get("extension") |
