summaryrefslogtreecommitdiff
path: root/xmake/modules/detect
diff options
context:
space:
mode:
authorLingfeng Fu <[email protected]>2023-06-09 23:17:41 +0800
committerLingfeng Fu <[email protected]>2023-06-09 23:17:41 +0800
commita6c95c916e566de85a5620904d0db5728d781a7d (patch)
tree0ede76ec352314497f21f93f183db8ca4b80169e /xmake/modules/detect
parente13615bd53b985222986cbe01e4eb6d7fe69f47e (diff)
add zypper support
Diffstat (limited to 'xmake/modules/detect')
-rw-r--r--xmake/modules/detect/tools/find_rpm.lua54
-rw-r--r--xmake/modules/detect/tools/find_zypper.lua54
2 files changed, 108 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_rpm.lua b/xmake/modules/detect/tools/find_rpm.lua
new file mode 100644
index 000000000..02c59b5e3
--- /dev/null
+++ b/xmake/modules/detect/tools/find_rpm.lua
@@ -0,0 +1,54 @@
+--!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, Lingfeng Fu
+-- @file find_rpm.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find rpm
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local rpm = find_rpm()
+-- local rpm, version = find_rpm({version = true})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "rpm", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program, opt)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tools/find_zypper.lua b/xmake/modules/detect/tools/find_zypper.lua
new file mode 100644
index 000000000..cc0fb0445
--- /dev/null
+++ b/xmake/modules/detect/tools/find_zypper.lua
@@ -0,0 +1,54 @@
+--!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, Lingfeng Fu
+-- @file find_zypper.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find zypper
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local zypper = find_zypper()
+-- local zypper, version = find_zypper({version = true})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "zypper", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program, opt)
+ end
+
+ -- ok?
+ return program, version
+end \ No newline at end of file