summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-15 10:16:11 +0800
committerruki <[email protected]>2017-06-15 10:16:11 +0800
commit1e907d9090e6e5cbd4013d997f2d14d37e313d2f (patch)
treebd69005637ef0e39832cc055612c417363640fae
parenta9ed35ab83f46ba4117292a6b94a7264351f4c22 (diff)
add find_gccgo and find_gdc
-rw-r--r--xmake/modules/detect/tool/find_gccgo.lua57
-rw-r--r--xmake/modules/detect/tool/find_gdc.lua57
-rw-r--r--xmake/modules/detect/tool/find_rustc.lua2
3 files changed, 115 insertions, 1 deletions
diff --git a/xmake/modules/detect/tool/find_gccgo.lua b/xmake/modules/detect/tool/find_gccgo.lua
new file mode 100644
index 000000000..eaff5e3ea
--- /dev/null
+++ b/xmake/modules/detect/tool/find_gccgo.lua
@@ -0,0 +1,57 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_gogccgo.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find gccgo
+--
+-- @param opt the argument options, .e.g {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local gccgo = find_gccgo()
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "gccgo")
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program, "--version", function (output) return output:match("%s(%d+%.?%d+%.?%d+)%s") end)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_gdc.lua b/xmake/modules/detect/tool/find_gdc.lua
new file mode 100644
index 000000000..a094cf7ee
--- /dev/null
+++ b/xmake/modules/detect/tool/find_gdc.lua
@@ -0,0 +1,57 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_gdc.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find gdc
+--
+-- @param opt the argument options, .e.g {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local gdc = find_gdc()
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "gdc")
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program, "--version", function (output) return output:match("%s(%d+%.?%d+%.?%d+)%s") end)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_rustc.lua b/xmake/modules/detect/tool/find_rustc.lua
index 9f3c992ef..938c6c180 100644
--- a/xmake/modules/detect/tool/find_rustc.lua
+++ b/xmake/modules/detect/tool/find_rustc.lua
@@ -19,7 +19,7 @@
-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
--
-- @author ruki
--- @file find_gorustc.lua
+-- @file find_rustc.lua
--
-- imports