summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-17 23:30:30 +0800
committerruki <[email protected]>2023-11-17 23:30:30 +0800
commit0accb1d4f09cc780bbb16ea510f791f8354ee741 (patch)
tree786529a1229992b92ac59a05f7bf48f4e46e6450 /xmake/plugins
parent42030c6ef77d2cdb5dfd1e809eff448f761d36a7 (diff)
add pack archive stub
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/pack/archive.lua33
-rw-r--r--xmake/plugins/pack/nsis/main.lua10
-rw-r--r--xmake/plugins/pack/xpack.lua3
-rw-r--r--xmake/plugins/pack/zip/main.lua26
4 files changed, 69 insertions, 3 deletions
diff --git a/xmake/plugins/pack/archive.lua b/xmake/plugins/pack/archive.lua
new file mode 100644
index 000000000..c6b30c941
--- /dev/null
+++ b/xmake/plugins/pack/archive.lua
@@ -0,0 +1,33 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file archive.lua
+--
+
+-- imports
+import("core.base.option")
+import("utils.archive")
+
+-- pack archive package
+function _pack_archive(package)
+end
+
+function main(package, format)
+ cprint("packing %s", package:outputfile())
+ _pack_archive(package)
+end
+
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index 22d63eb30..bb1da6a7a 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -586,7 +586,7 @@ function _get_specvars(package)
end
-- pack nsis package
-function _pack_nsis(makensis, package, opt)
+function _pack_nsis(makensis, package)
-- install the initial specfile
local specfile = package:specfile()
@@ -618,13 +618,19 @@ function _pack_nsis(makensis, package, opt)
end
function main(package)
+
+ -- only for windows
+ if not is_host("windows") then
+ return
+ end
+
cprint("packing %s", package:outputfile())
-- get makensis
local makensis, oldenvs = _get_makensis()
-- pack nsis package
- _pack_nsis(makensis.program, package, opt)
+ _pack_nsis(makensis.program, package)
-- done
os.setenvs(oldenvs)
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index 745d8f9f7..4d32d6c08 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -323,7 +323,8 @@ end
-- get the output filename
function xpack:filename()
local extensions = {
- nsis = ".exe"
+ nsis = ".exe",
+ zip = ".zip"
}
local extension = extensions[self:format()] or ""
return self:basename() .. extension
diff --git a/xmake/plugins/pack/zip/main.lua b/xmake/plugins/pack/zip/main.lua
new file mode 100644
index 000000000..b54e6bf8a
--- /dev/null
+++ b/xmake/plugins/pack/zip/main.lua
@@ -0,0 +1,26 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file main.lua
+--
+
+-- imports
+import(".archive")
+
+function main(package)
+ archive(package, "zip")
+end