diff options
| author | ruki <[email protected]> | 2024-09-13 21:02:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-09-13 21:02:12 +0800 |
| commit | 252dbbe8a9c57e096f44c964d2b4dae2ea822c26 (patch) | |
| tree | 4c896d44761df896c3b1ed5e01e3ae35d5eda736 /xmake/modules | |
| parent | decc680dfd4f703b072664433e177673c027c903 (diff) | |
add install.strip_packagelibs
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/target/action/install/main.lua | 11 | ||||
| -rw-r--r-- | xmake/modules/target/action/uninstall/main.lua | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/xmake/modules/target/action/install/main.lua b/xmake/modules/target/action/install/main.lua index 257bdcedc..45f43a7cb 100644 --- a/xmake/modules/target/action/install/main.lua +++ b/xmake/modules/target/action/install/main.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.hashset") +import("core.project.project") import("utils.binary.deplibs", {alias = "get_depend_libraries"}) import("utils.binary.rpath", {alias = "rpath_utils"}) @@ -60,10 +61,12 @@ function _get_target_package_libfiles(target, opt) end end -- we can only reserve used libraries - if target:is_binary() or target:is_shared() then - local depends = hashset.new() - _get_target_package_deplibs(target, depends, libfiles, target:targetfile()) - table.remove_if(libfiles, function (_, libfile) return not depends:has(path.filename(libfile)) end) + if project.policy("install.strip_packagelibs") then + if target:is_binary() or target:is_shared() then + local depends = hashset.new() + _get_target_package_deplibs(target, depends, libfiles, target:targetfile()) + table.remove_if(libfiles, function (_, libfile) return not depends:has(path.filename(libfile)) end) + end end return libfiles end diff --git a/xmake/modules/target/action/uninstall/main.lua b/xmake/modules/target/action/uninstall/main.lua index ab2333207..912e5140f 100644 --- a/xmake/modules/target/action/uninstall/main.lua +++ b/xmake/modules/target/action/uninstall/main.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.hashset") +import("core.project.project") import("utils.binary.deplibs", {alias = "get_depend_libraries"}) import("private.action.clean.remove_files") @@ -61,10 +62,12 @@ function _get_target_package_libfiles(target, opt) end end -- we can only reserve used libraries - if target:is_binary() or target:is_shared() then - local depends = hashset.new() - _get_target_package_deplibs(target, depends, libfiles, target:targetfile()) - table.remove_if(libfiles, function (_, libfile) return not depends:has(path.filename(libfile)) end) + if project.policy("install.strip_packagelibs") then + if target:is_binary() or target:is_shared() then + local depends = hashset.new() + _get_target_package_deplibs(target, depends, libfiles, target:targetfile()) + table.remove_if(libfiles, function (_, libfile) return not depends:has(path.filename(libfile)) end) + end end return libfiles end |
