diff options
| author | ruki <[email protected]> | 2015-06-26 10:16:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-26 10:16:58 +0800 |
| commit | cd530f704a361fecba459bc8e3dc27cb1c6522c8 (patch) | |
| tree | 4ffdbc365ac2b61561873bdc17a971f0f8ff04f2 /xmake/scripts | |
| parent | 73a91c19b7c306ef2d2056914f285e1588985534 (diff) | |
add package for base
Diffstat (limited to 'xmake/scripts')
| -rw-r--r-- | xmake/scripts/action/_package.lua | 24 | ||||
| -rw-r--r-- | xmake/scripts/base/package.lua | 45 |
2 files changed, 53 insertions, 16 deletions
diff --git a/xmake/scripts/action/_package.lua b/xmake/scripts/action/_package.lua index 759ec3be3..fcaa658d6 100644 --- a/xmake/scripts/action/_package.lua +++ b/xmake/scripts/action/_package.lua @@ -31,6 +31,7 @@ local config = require("base/config") local global = require("base/global") local string = require("base/string") local project = require("base/project") +local package = require("base/package") local platform = require("platform/platform") -- need access to the given file? @@ -104,6 +105,10 @@ function _package._makeconf(target_name, target) -- check assert(target_name and target) + -- the options + local options = xmake._OPTIONS + assert(options) + -- the configs local configs = _package._CONFIGS assert(configs) @@ -134,7 +139,7 @@ function _package._makeconf(target_name, target) configs_arch.targetfile = _package._backup(configs_arch.rootdir, rule.targetfile(target_name, target)) -- save the target directory - configs_arch.targetdir = target.targetdir + configs_arch.targetdir = options.outputdir or target.targetdir or config.get("buildir") -- save the header files configs_arch.headerfiles = rule.headerfiles(target) @@ -233,20 +238,6 @@ function _package._build_all(archs, target_name) return true end --- done package from the configure -function _package._done() - - -- the configs - local configs = _package._CONFIGS - assert(configs) - - -- dump - utils.dump(configs) - - -- ok - return true -end - -- done function _package.done() @@ -289,7 +280,7 @@ function _package.done() configs.projectdir = xmake._PROJECT_DIR -- done package - if not _package._done() then + if not package.done(configs) then -- errors utils.error("package: failed!") return false @@ -345,6 +336,7 @@ function _package.menu() , " 1. The Given Command Argument" , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR" , " 3. The Current Directory" } + , {'o', "outputdir", "kv", nil, "Set the output directory." } , {} , {'v', "verbose", "k", nil, "Print lots of verbose information." } diff --git a/xmake/scripts/base/package.lua b/xmake/scripts/base/package.lua new file mode 100644 index 000000000..d07f6590a --- /dev/null +++ b/xmake/scripts/base/package.lua @@ -0,0 +1,45 @@ +--!The Automatic Cross-platform Build Tool +-- +-- XMake is free software; you can redistribute it and/or modify +-- it under the terms of the GNU Lesser General Public License as published by +-- the Free Software Foundation; either version 2.1 of the License, or +-- (at your option) any later version. +-- +-- XMake is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public License +-- along with XMake; +-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file package.lua +-- + +-- define module: package +local package = package or {} + +-- load modules +local os = require("base/os") +local path = require("base/path") +local utils = require("base/utils") + +-- done package from the configure +function package.done(configs) + + -- check + assert(configs) + + -- dump + utils.dump(configs) + + -- ok + return true +end + +-- return module: package +return package |
