diff options
| author | ruki <[email protected]> | 2018-12-12 00:48:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-12-11 22:49:50 +0800 |
| commit | bdfab7b2180fd0652c135b735019b43b5dabc6db (patch) | |
| tree | 1e539aa11f65718853247082e958ace983cdf2da /xmake/actions/install/main.lua | |
| parent | e429d90d867a8919b0480d1838f0d7d2bab94f27 (diff) | |
add target:installdir() and set_installdir
Diffstat (limited to 'xmake/actions/install/main.lua')
| -rw-r--r-- | xmake/actions/install/main.lua | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua index c119e4ce4..60ff38ff5 100644 --- a/xmake/actions/install/main.lua +++ b/xmake/actions/install/main.lua @@ -30,26 +30,6 @@ import("core.base.privilege") import("privilege.sudo") import("install") --- get install directory -function _installdir() - - -- the install directory - -- - -- DESTDIR: be compatible with https://www.gnu.org/prep/standards/html_node/DESTDIR.html - -- - local installdir = option.get("installdir") or os.getenv("INSTALLDIR") or os.getenv("DESTDIR") or platform.get("installdir") - assert(installdir, "unknown install directory!") - - -- append prefix - local prefix = option.get("prefix") or os.getenv("PREFIX") - if prefix then - installdir = path.join(installdir, prefix) - end - - -- ok - return installdir -end - -- main function main() @@ -59,19 +39,13 @@ function main() -- build it first task.run("build", {target = targetname, all = option.get("all")}) - -- get install directory - local installdir = _installdir() - - -- trace - print("installing to %s ...", installdir) - -- attempt to install directly try { function () -- install target - install(targetname or ifelse(option.get("all"), "__all", "__def"), installdir) + install(targetname or ifelse(option.get("all"), "__all", "__def")) -- trace cprint("${bright}install ok!${clear}${ok_hand}") @@ -89,7 +63,7 @@ function main() function () -- install target - install(targetname or ifelse(option.get("all"), "__all", "__def"), installdir) + install(targetname or ifelse(option.get("all"), "__all", "__def")) -- trace cprint("${bright}install ok!${clear}${ok_hand}") @@ -132,7 +106,7 @@ function main() if confirm then -- install target with administrator permission - sudo.runl(path.join(os.scriptdir(), "install_admin.lua"), {targetname or ifelse(option.get("all"), "__all", "__def"), installdir}) + sudo.runl(path.join(os.scriptdir(), "install_admin.lua"), {targetname or ifelse(option.get("all"), "__all", "__def"), option.get("installdir"), option.get("prefix")}) -- trace cprint("${bright}install ok!${clear}${ok_hand}") |
