diff options
| author | ruki <[email protected]> | 2017-03-28 22:14:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-03-28 22:14:38 +0800 |
| commit | e6ddfd06269948f11d27191bd2cb30c5b0aee132 (patch) | |
| tree | c0f9475d0484750953a828955ece45eb49b1f8dd | |
| parent | 8e0c711fb2ea0fb3a54b9f2b41d1907fc4be8b02 (diff) | |
add installing and uninstalling tips
| -rw-r--r-- | xmake/actions/install/main.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/uninstall/main.lua | 4 | ||||
| -rw-r--r-- | xmake/core/platform/platform.lua | 1 | ||||
| -rw-r--r-- | xmake/platforms/installer.lua | 13 | ||||
| -rw-r--r-- | xmake/platforms/linux/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/platforms/macosx/xmake.lua | 3 |
6 files changed, 24 insertions, 4 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua index 4b47ff7f0..8923a7b86 100644 --- a/xmake/actions/install/main.lua +++ b/xmake/actions/install/main.lua @@ -25,6 +25,7 @@ -- imports import("core.base.option") import("core.project.task") +import("core.platform.platform") import("install") -- main @@ -36,6 +37,9 @@ function main() -- build it first task.run("build", {target = targetname}) + -- trace + print("installing to %s ...", option.get("installdir") or platform.get("installdir")) + -- attempt to install directly try { diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua index bc57156ac..69f96fc87 100644 --- a/xmake/actions/uninstall/main.lua +++ b/xmake/actions/uninstall/main.lua @@ -25,6 +25,7 @@ -- imports import("core.base.option") import("core.project.task") +import("core.platform.platform") import("uninstall") -- main @@ -36,6 +37,9 @@ function main() -- config it first task.run("config", {target = targetname}) + -- trace + print("uninstalling from %s ...", option.get("installdir") or platform.get("installdir")) + -- attempt to uninstall directly try { diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index ac2f87a0a..c8bf71346 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -148,6 +148,7 @@ function platform._interpreter() , "platform.set_archs" , "platform.set_menu" , "platform.set_tooldirs" + , "platform.set_installdir" } , script = { diff --git a/xmake/platforms/installer.lua b/xmake/platforms/installer.lua index 0a0d90456..0cc388edb 100644 --- a/xmake/platforms/installer.lua +++ b/xmake/platforms/installer.lua @@ -24,12 +24,14 @@ -- imports import("core.base.option") +import("core.platform.platform") -- install binary function install_binary_on_unix(target) -- the install directory - local installdir = option.get("installdir") or "/usr/local" + local installdir = option.get("installdir") or platform.get("installdir") + assert(installdir, "unknown install directory!") -- the binary directory local binarydir = path.join(installdir, "bin") @@ -45,7 +47,8 @@ end function install_library_on_unix(target) -- the install directory - local installdir = option.get("installdir") or "/usr/local" + local installdir = option.get("installdir") or platform.get("installdir") + assert(installdir, "unknown install directory!") -- the library directory local librarydir = path.join(installdir, "lib") @@ -86,7 +89,8 @@ end function uninstall_binary_on_unix(target) -- the install directory - local installdir = option.get("installdir") or "/usr/local" + local installdir = option.get("installdir") or platform.get("installdir") + assert(installdir, "unknown install directory!") -- the binary directory local binarydir = path.join(installdir, "bin") @@ -99,7 +103,8 @@ end function uninstall_library_on_unix(target) -- the install directory - local installdir = option.get("installdir") or "/usr/local" + local installdir = option.get("installdir") or platform.get("installdir") + assert(installdir, "unknown install directory!") -- the library directory local librarydir = path.join(installdir, "lib") diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua index a2cb0cf01..85756709e 100644 --- a/xmake/platforms/linux/xmake.lua +++ b/xmake/platforms/linux/xmake.lua @@ -37,6 +37,9 @@ platform("linux") -- set tooldirs set_tooldirs("/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin") + -- set installdir + set_installdir("/usr/local") + -- on install on_install("install") diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua index fba2b2334..b7185eea4 100644 --- a/xmake/platforms/macosx/xmake.lua +++ b/xmake/platforms/macosx/xmake.lua @@ -37,6 +37,9 @@ platform("macosx") -- set tooldirs set_tooldirs("/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin") + -- set installdir + set_installdir("/usr/local") + -- on check on_check("check") |
