summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-28 22:52:38 +0800
committerruki <[email protected]>2018-09-28 11:15:48 +0800
commit619eda909993a3ed64816b53b860a9c559a77fed (patch)
tree3a313eac9f5459eefc4583d5b2b7100fde6c9912 /xmake/modules/package/tools/xmake.lua
parent27cf709dda7b6626822534a7e2d18b41cf315c4f (diff)
remove build scripts for package
Diffstat (limited to 'xmake/modules/package/tools/xmake.lua')
-rw-r--r--xmake/modules/package/tools/xmake.lua56
1 files changed, 56 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
new file mode 100644
index 000000000..300b3f5e1
--- /dev/null
+++ b/xmake/modules/package/tools/xmake.lua
@@ -0,0 +1,56 @@
+--!A cross-platform 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 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+-- imports
+import("core.base.option")
+
+-- install package
+function install(package, configs)
+
+ -- inherit builtin configs
+ local argv = {"f", "-y"}
+ local names = {"plat", "arch", "ndk", "ndk_sdkver", "vs", "sdk", "bin", "cross", "ld", "sh", "ar", "cc", "cxx", "mm", "mxx"}
+ for _, name in ipairs(names) do
+ local value = get_config(name)
+ if value ~= nil then
+ if value:find(" ", 1, true) then
+ value = '"' .. value .. '"'
+ end
+ table.insert(argv, "--" .. name .. "=" .. value)
+ end
+ end
+ table.insert(argv, "--mode=" .. (package:debug() and "debug" or "release"))
+
+ -- inherit require and option configs
+ for name, value in pairs(table.join(package:configs() or {}, configs or {})) do
+ value = tostring(value)
+ if value:find(" ", 1, true) then
+ value = '"' .. value .. '"'
+ end
+ table.insert(argv, "--" .. name .. "=" .. value)
+ end
+ os.vrunv("xmake", argv)
+ os.vrun("xmake" .. (option.get("verbose") and " -v" or ""))
+ os.vrunv("xmake", {"install", "-o", package:installdir()})
+end