From 34aee077ffcfd441f3cb100cc2f997904d6e2615 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 25 Jul 2023 23:53:53 +0800 Subject: clean soname files --- xmake/rules/linker/soname/xmake.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) -- cgit v1.3.1