summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-07-25 23:53:53 +0800
committerruki <[email protected]>2023-07-25 23:53:53 +0800
commit34aee077ffcfd441f3cb100cc2f997904d6e2615 (patch)
tree6fca52a6627817f1b3d7c49983065d63fe346c69
parent9054abfc5bf357f6b29391332309956a526264b1 (diff)
clean soname files
-rw-r--r--xmake/rules/linker/soname/xmake.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/xmake/rules/linker/soname/xmake.lua b/xmake/rules/linker/soname/xmake.lua
index 3bacb721d..d271fba0b 100644
--- a/xmake/rules/linker/soname/xmake.lua
+++ b/xmake/rules/linker/soname/xmake.lua
@@ -32,6 +32,7 @@ rule("linker.soname")
end
end
end)
+
after_link(function (target)
local soname = target:soname()
if target:is_shared() and soname and target:data("soname.enabled") then
@@ -56,3 +57,19 @@ rule("linker.soname")
end
end)
+ after_clean(function (target)
+ import("private.action.clean.remove_files")
+ local soname = target:soname()
+ if target:is_shared() and soname then
+ local version = target:version()
+ local filename = target:filename()
+ local extension = path.extension(filename)
+ local targetfile_with_version = path.join(target:targetdir(), filename .. "." .. version)
+ if extension == ".dylib" then
+ targetfile_with_version = path.join(target:targetdir(), path.basename(filename) .. "." .. version .. extension)
+ end
+ local targetfile_with_soname = path.join(target:targetdir(), soname)
+ remove_files(targetfile_with_soname)
+ remove_files(targetfile_with_version)
+ end
+ end)