diff options
| author | ruki <[email protected]> | 2017-06-06 18:41:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-06 18:41:05 +0800 |
| commit | 2309c5ec03eb09842814bcf03fffa8fa93999acf (patch) | |
| tree | d0e796ee7eff59a38eae6979b069a574eb51fe40 /xmake/modules | |
| parent | b62c9a1a532058db12fb73cdfeb0e174c8cbf2f2 (diff) | |
add find_library and remove some old codes
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/detect/tool/find_7z.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_ccache.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_curl.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_doxygen.lua | 55 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_gdb.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_git.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_gzip.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_lipo.lua | 45 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_lldb.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_pkg_config.lua | 55 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_sudo.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_tar.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_unzip.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_wget.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tool/find_zip.lua | 55 |
15 files changed, 221 insertions, 11 deletions
diff --git a/xmake/modules/detect/tool/find_7z.lua b/xmake/modules/detect/tool/find_7z.lua index f6a39c325..58a4ea24e 100644 --- a/xmake/modules/detect/tool/find_7z.lua +++ b/xmake/modules/detect/tool/find_7z.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("7z", { "/usr/bin", "/usr/local/bin"}, "--help") + local program = find_program("7z", {}, "--help") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_ccache.lua b/xmake/modules/detect/tool/find_ccache.lua index e3a5a8313..faf45da53 100644 --- a/xmake/modules/detect/tool/find_ccache.lua +++ b/xmake/modules/detect/tool/find_ccache.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("ccache", { "/usr/bin", "/usr/local/bin"}) + local program = find_program("ccache") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_curl.lua b/xmake/modules/detect/tool/find_curl.lua index bf23d6bdf..3b49247ef 100644 --- a/xmake/modules/detect/tool/find_curl.lua +++ b/xmake/modules/detect/tool/find_curl.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("curl", { "/usr/bin", "/usr/local/bin"}) + local program = find_program("curl") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_doxygen.lua b/xmake/modules/detect/tool/find_doxygen.lua new file mode 100644 index 000000000..3b3a6bee4 --- /dev/null +++ b/xmake/modules/detect/tool/find_doxygen.lua @@ -0,0 +1,55 @@ +--!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_doxygen.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find doxygen +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local doxygen = find_doxygen() +-- local doxygen, version = find_doxygen({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- find program + local program = find_program("doxygen", { "/usr/bin", "/usr/local/bin"}) + + -- find program version + local version = nil + if program and opt and opt.version then + version = find_programver(program) + end + + -- ok? + return program, version +end diff --git a/xmake/modules/detect/tool/find_gdb.lua b/xmake/modules/detect/tool/find_gdb.lua index 37b84e647..ff206288c 100644 --- a/xmake/modules/detect/tool/find_gdb.lua +++ b/xmake/modules/detect/tool/find_gdb.lua @@ -46,7 +46,7 @@ function main(opt) opt = opt or {} -- find program - local program = find_program(opt.program or "gdb", { "/usr/bin", "/usr/local/bin"}) + local program = find_program(opt.program or "gdb") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_git.lua b/xmake/modules/detect/tool/find_git.lua index 666d79d25..12f08978d 100644 --- a/xmake/modules/detect/tool/find_git.lua +++ b/xmake/modules/detect/tool/find_git.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("git", { "/usr/bin", "/usr/local/bin"}) + local program = find_program("git") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_gzip.lua b/xmake/modules/detect/tool/find_gzip.lua index 744c1878a..d1b286bba 100644 --- a/xmake/modules/detect/tool/find_gzip.lua +++ b/xmake/modules/detect/tool/find_gzip.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("gzip", { "/usr/bin", "/usr/local/bin"}) + local program = find_program("gzip") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_lipo.lua b/xmake/modules/detect/tool/find_lipo.lua new file mode 100644 index 000000000..621bb80d5 --- /dev/null +++ b/xmake/modules/detect/tool/find_lipo.lua @@ -0,0 +1,45 @@ +--!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_lipo.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find lipo +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local lipo = find_lipo() +-- +-- @endcode +-- +function main(opt) + + -- find program + return find_program("lipo", {}, function (program) os.run("%s -info %s", program, os.programfile()) end) +end diff --git a/xmake/modules/detect/tool/find_lldb.lua b/xmake/modules/detect/tool/find_lldb.lua index 32d4ff735..3c15c2fb1 100644 --- a/xmake/modules/detect/tool/find_lldb.lua +++ b/xmake/modules/detect/tool/find_lldb.lua @@ -46,7 +46,7 @@ function main(opt) opt = opt or {} -- find program - local program = find_program(opt.program or "lldb", { "/usr/bin", "/usr/local/bin"}) + local program = find_program(opt.program or "lldb") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_pkg_config.lua b/xmake/modules/detect/tool/find_pkg_config.lua new file mode 100644 index 000000000..8bbad9f3f --- /dev/null +++ b/xmake/modules/detect/tool/find_pkg_config.lua @@ -0,0 +1,55 @@ +--!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_pkg_config.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find pkg_config +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local pkg_config = find_pkg_config() +-- local pkg_config, version = find_pkg_config({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- find program + local program = find_program("pkg-config") + + -- find program version + local version = nil + if program and opt and opt.version then + version = find_programver(program) + end + + -- ok? + return program, version +end diff --git a/xmake/modules/detect/tool/find_sudo.lua b/xmake/modules/detect/tool/find_sudo.lua index 968746020..3d0082b17 100644 --- a/xmake/modules/detect/tool/find_sudo.lua +++ b/xmake/modules/detect/tool/find_sudo.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("sudo", { "/usr/bin", "/usr/local/bin"}, "-h") + local program = find_program("sudo", {}, "-h") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_tar.lua b/xmake/modules/detect/tool/find_tar.lua index 24a3743ec..e091d3204 100644 --- a/xmake/modules/detect/tool/find_tar.lua +++ b/xmake/modules/detect/tool/find_tar.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("tar", { "/usr/bin", "/usr/local/bin"}) + local program = find_program("tar") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_unzip.lua b/xmake/modules/detect/tool/find_unzip.lua index c0a6a88a0..19c30f517 100644 --- a/xmake/modules/detect/tool/find_unzip.lua +++ b/xmake/modules/detect/tool/find_unzip.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("unzip", { "/usr/bin", "/usr/local/bin"}, "-v") + local program = find_program("unzip", {}, "-v") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_wget.lua b/xmake/modules/detect/tool/find_wget.lua index ff22f31d4..59a9c7d63 100644 --- a/xmake/modules/detect/tool/find_wget.lua +++ b/xmake/modules/detect/tool/find_wget.lua @@ -42,7 +42,7 @@ import("lib.detect.find_programver") function main(opt) -- find program - local program = find_program("wget", { "/usr/bin", "/usr/local/bin"}) + local program = find_program("wget") -- find program version local version = nil diff --git a/xmake/modules/detect/tool/find_zip.lua b/xmake/modules/detect/tool/find_zip.lua new file mode 100644 index 000000000..b424d6e99 --- /dev/null +++ b/xmake/modules/detect/tool/find_zip.lua @@ -0,0 +1,55 @@ +--!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_zip.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find zip +-- +-- @param opt the argument options, .e.g {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local zip = find_zip() +-- local zip, version = find_zip({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- find program + local program = find_program("zip", {}, "-v") + + -- find program version + local version = nil + if program and opt and opt.version then + version = find_programver(program, "-v") + end + + -- ok? + return program, version +end |
