summaryrefslogtreecommitdiff
path: root/xmake/scripts/action
diff options
context:
space:
mode:
authorruki <[email protected]>2015-07-10 16:59:16 +0800
committerruki <[email protected]>2015-07-10 16:59:16 +0800
commite2b2d08d459dc0c3459befb443c9c76520bcf61d (patch)
tree5a031da80823f8aade87c7d9896170d6202310c0 /xmake/scripts/action
parentebd3cf08de2fea05bbf32d095f5a5c5a3c38a4f1 (diff)
add install for macosx
Diffstat (limited to 'xmake/scripts/action')
-rw-r--r--xmake/scripts/action/_install.lua29
-rw-r--r--xmake/scripts/action/_package.lua16
2 files changed, 37 insertions, 8 deletions
diff --git a/xmake/scripts/action/_install.lua b/xmake/scripts/action/_install.lua
index 5223da678..b7e392bb3 100644
--- a/xmake/scripts/action/_install.lua
+++ b/xmake/scripts/action/_install.lua
@@ -29,6 +29,7 @@ local config = require("base/config")
local global = require("base/global")
local install = require("base/install")
local package = require("base/package")
+local project = require("base/project")
local platform = require("platform/platform")
-- need access to the given file?
@@ -91,6 +92,33 @@ function _install.done()
return false
end
+ -- reload configure
+ local errors = config.reload()
+ if errors then
+ -- error
+ utils.error(errors)
+ return false
+ end
+
+ -- make the platform configure
+ if not platform.make() then
+ utils.error("make platform configure: %s failed!", config.get("plat"))
+ return false
+ end
+
+ -- reload project
+ local errors = project.reload()
+ if errors then
+ -- error
+ utils.error(errors)
+ return false
+ end
+
+ -- update the outputdir
+ for _, target in pairs(configs) do
+ target.outputdir = options.installdir
+ end
+
-- done package
if not install.done(configs) then
-- errors
@@ -127,6 +155,7 @@ function _install.menu()
, " 1. The Given Command Argument"
, " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
, " 3. The Current Directory" }
+ , {'o', "installdir", "kv", nil, "Set the install directory." }
, {}
, {'v', "verbose", "k", nil, "Print lots of verbose information." }
diff --git a/xmake/scripts/action/_package.lua b/xmake/scripts/action/_package.lua
index 1860b931b..e39604a33 100644
--- a/xmake/scripts/action/_package.lua
+++ b/xmake/scripts/action/_package.lua
@@ -150,24 +150,24 @@ function _package._makeconf(target_name, target)
configs_arch.targetfile = _package._backup(configs_arch.targetdir, rule.targetfile(target_name, target))
-- save the package script
- local pkgscript = target.pkgscript
- if type(pkgscript) == "string" and os.isfile(pkgscript) then
- local script, errors = loadfile(pkgscript)
+ local packagescript = target.packagescript
+ if type(packagescript) == "string" and os.isfile(packagescript) then
+ local script, errors = loadfile(packagescript)
if script then
- pkgscript = script()
- if type(pkgscript) == "table" and pkgscript.main then
- pkgscript = pkgscript.main
+ packagescript = script()
+ if type(packagescript) == "table" and packagescript.main then
+ packagescript = packagescript.main
end
else
utils.error(errors)
return false
end
end
- if target.pkgscript and type(pkgscript) ~= "function" then
+ if target.packagescript and type(packagescript) ~= "function" then
utils.error("invalid package script!")
return false
end
- configs_target.pkgscript = pkgscript
+ configs_target.packagescript = packagescript
-- ok
return true