Bug 256654

Summary: x11-wm/plasma5-kwin: trim overlinking via -Wl,--as-needed
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: freebsd-kde (Team) <kde>
Status: New ---    
Severity: Affects Only Me CC: probono
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (kde)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
v0 (draft: direct LDFLAGS, _DEPENDS not adjusted)
none
v1 (draft: direct LDFLAGS) none

Description Jan Beich freebsd_committer 2021-06-16 18:32:55 UTC
Created attachment 225866 [details]
v0 (draft: direct LDFLAGS, _DEPENDS not adjusted)

-Wl,--as-needed is opt-out in Meson (-Db_asneeded=false) but opt-in CMake (-DCMAKE_LINK_WHAT_YOU_USE=ON). When subpackaging (review D16457) arrives kwin_x11 and kwin_wayland can be in separate packages but for now -Wl,--as-needed shaves unused libraries.

--- kwin_x11	before
+++ kwin_x11	after
@@ -1,63 +1,17 @@
  0x0000000000000001 NEEDED               Shared library: [libkwin.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libkwin4_effect_builtins.so.1]
- 0x0000000000000001 NEEDED               Shared library: [libkwineffects.so.13]
- 0x0000000000000001 NEEDED               Shared library: [libkwinglutils.so.13]
- 0x0000000000000001 NEEDED               Shared library: [libKF5GlobalAccelPrivate.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Plasma.so.5]
  0x0000000000000001 NEEDED               Shared library: [libKF5QuickAddons.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libQt5Quick.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libQt5QmlModels.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libQt5Qml.so.5]
  0x0000000000000001 NEEDED               Shared library: [libKF5Crash.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Service.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5WaylandClient.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libkdecorations2.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libkdecorations2private.so.8]
- 0x0000000000000001 NEEDED               Shared library: [libKScreenLocker.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Notifications.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Package.so.5]
  0x0000000000000001 NEEDED               Shared library: [libKF5WindowSystem.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5GlobalAccel.so.5]
  0x0000000000000001 NEEDED               Shared library: [libQt5X11Extras.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5ConfigWidgets.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Codecs.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5ConfigGui.so.5]
  0x0000000000000001 NEEDED               Shared library: [libKF5ConfigCore.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libQt5Xml.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Auth.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5AuthCore.so.5]
  0x0000000000000001 NEEDED               Shared library: [libKF5CoreAddons.so.5]
  0x0000000000000001 NEEDED               Shared library: [libKF5I18n.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKF5WidgetsAddons.so.5]
  0x0000000000000001 NEEDED               Shared library: [libQt5Widgets.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libQt5Network.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libQt5Concurrent.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libKWaylandServer.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libwayland-server.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-composite.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-damage.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-glx.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-icccm.so.4]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-keysyms.so.1]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-randr.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-shm.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-sync.so.1]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-xfixes.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-render.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxcb-shape.so.0]
  0x0000000000000001 NEEDED               Shared library: [libxcb.so.1]
- 0x0000000000000001 NEEDED               Shared library: [libinput.so.10]
- 0x0000000000000001 NEEDED               Shared library: [libudev.so.0]
- 0x0000000000000001 NEEDED               Shared library: [libxkbcommon.so.0]
  0x0000000000000001 NEEDED               Shared library: [libQt5Gui.so.5]
  0x0000000000000001 NEEDED               Shared library: [libQt5Core.so.5]
- 0x0000000000000001 NEEDED               Shared library: [libGL.so.1]
- 0x0000000000000001 NEEDED               Shared library: [libepoxy.so.0]
- 0x0000000000000001 NEEDED               Shared library: [liblcms2.so.2]
- 0x0000000000000001 NEEDED               Shared library: [libKF5Activities.so.5]
  0x0000000000000001 NEEDED               Shared library: [libQt5DBus.so.5]
  0x0000000000000001 NEEDED               Shared library: [libc++.so.1]
  0x0000000000000001 NEEDED               Shared library: [libcxxrt.so.1]
- 0x0000000000000001 NEEDED               Shared library: [libm.so.5]
  0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
  0x0000000000000001 NEEDED               Shared library: [libc.so.7]
Comment 1 Jan Beich freebsd_committer 2021-06-16 20:24:08 UTC
Created attachment 225873 [details]
v1 (draft: direct LDFLAGS)

Total gain is minor due to indirect dependencies and plugins.

$ pkg upgrade -qy
$ pkg autoremove -n
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 2 packages:

Installed packages to be REMOVED:
        kf5-krunner: 5.82.0
        kf5-threadweaver: 5.82.0

Number of packages to be removed: 2

$ pkg rquery %n:\ %sh kf5-krunner kf5-threadweaver
kf5-krunner: 422KiB
kf5-threadweaver: 273KiB
Comment 2 Jan Beich freebsd_committer 2021-06-16 20:24:42 UTC
Comment on attachment 225873 [details]
v1 (draft: direct LDFLAGS)

poudriere log: https://reviews.freebsd.org/P510