summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-12 00:55:12 +0800
committerruki <[email protected]>2024-07-15 12:21:42 +0800
commitfd5e83fd340b9d610392d6432cd652813819c7d3 (patch)
tree0e2e6f47621e8f1f76b6b78f3a836ae08df68b81
parent370950a092310a934b37bc853fe0587286422159 (diff)
improve uninstall dir
-rw-r--r--xmake/modules/target/action/uninstall/unix.lua10
-rw-r--r--xmake/modules/target/action/uninstall/windows.lua10
2 files changed, 10 insertions, 10 deletions
diff --git a/xmake/modules/target/action/uninstall/unix.lua b/xmake/modules/target/action/uninstall/unix.lua
index ce14c2c7b..835197228 100644
--- a/xmake/modules/target/action/uninstall/unix.lua
+++ b/xmake/modules/target/action/uninstall/unix.lua
@@ -23,7 +23,7 @@ import("private.action.clean.remove_files")
-- uninstall headers
function _uninstall_headers(target, opt)
- local includedir = path.join(target:installdir(), opt and opt.includedir or "include")
+ local includedir = target:includedir()
local _, dstheaders = target:headerfiles(includedir, {installonly = true})
for _, dstheader in ipairs(dstheaders) do
remove_files(dstheader, {emptydir = true})
@@ -69,12 +69,12 @@ end
function uninstall_binary(target, opt)
-- remove the target file
- local binarydir = path.join(target:installdir(), opt and opt.bindir or "bin")
+ local binarydir = target:bindir()
os.vrm(path.join(binarydir, path.filename(target:targetfile())))
-- remove the dependent shared (*.so) target
-- @see https://github.com/xmake-io/xmake/issues/961
- local librarydir = path.join(target:installdir(), opt and opt.libdir or "lib")
+ local librarydir = target:libdir()
for _, dep in ipairs(target:orderdeps()) do
if dep:kind() == "shared" then
os.vrm(path.join(librarydir, path.filename(dep:targetfile())))
@@ -90,7 +90,7 @@ end
function uninstall_shared(target, opt)
-- remove the target file
- local librarydir = path.join(target:installdir(), opt and opt.libdir or "lib")
+ local librarydir = target:libdir()
local targetfile = path.join(librarydir, path.filename(target:targetfile()))
if os.islink(targetfile) then
local targetfile_with_soname = os.readlink(targetfile)
@@ -119,7 +119,7 @@ end
function uninstall_static(target, opt)
-- remove the target file
- local librarydir = path.join(target:installdir(), opt and opt.libdir or "lib")
+ local librarydir = target:libdir()
os.vrm(path.join(librarydir, path.filename(target:targetfile())))
-- remove headers from the include directory
diff --git a/xmake/modules/target/action/uninstall/windows.lua b/xmake/modules/target/action/uninstall/windows.lua
index 338f8c707..5dcc01b5e 100644
--- a/xmake/modules/target/action/uninstall/windows.lua
+++ b/xmake/modules/target/action/uninstall/windows.lua
@@ -20,7 +20,7 @@
-- uninstall headers
function _uninstall_headers(target, opt)
- local includedir = path.join(target:installdir(), opt and opt.includedir or "include")
+ local includedir = target:includedir()
local _, dstheaders = target:headerfiles(includedir, {installonly = true})
for _, dstheader in ipairs(dstheaders) do
os.vrm(dstheader)
@@ -54,7 +54,7 @@ end
function uninstall_binary(target, opt)
-- remove the target file
- local binarydir = path.join(target:installdir(), opt and opt.bindir or "bin")
+ local binarydir = target:bindir()
os.vrm(path.join(binarydir, path.filename(target:targetfile())))
os.tryrm(path.join(binarydir, path.filename(target:symbolfile())))
@@ -75,14 +75,14 @@ end
function uninstall_shared(target, opt)
-- remove the target file
- local binarydir = path.join(target:installdir(), opt and opt.bindir or "bin")
+ local binarydir = target:bindir()
os.vrm(path.join(binarydir, path.filename(target:targetfile())))
os.tryrm(path.join(binarydir, path.filename(target:symbolfile())))
-- remove *.lib for shared/windows (*.dll) target
-- @see https://github.com/xmake-io/xmake/issues/714
local targetfile = target:targetfile()
- local librarydir = path.join(target:installdir(), opt and opt.libdir or "lib")
+ local librarydir = target:libdir()
os.vrm(path.join(librarydir, path.basename(targetfile) .. (target:is_plat("mingw") and ".dll.a" or ".lib")))
-- remove headers from the include directory
@@ -96,7 +96,7 @@ end
function uninstall_static(target, opt)
-- remove the target file
- local librarydir = path.join(target:installdir(), opt and opt.libdir or "lib")
+ local librarydir = target:libdir()
os.vrm(path.join(librarydir, path.filename(target:targetfile())))
os.tryrm(path.join(librarydir, path.filename(target:symbolfile())))