Recently I tried to turn on LTO during the compilation which failed on package/utils/lua compile. Which surprised me because my image doesn't include the package/utils/lua. That's when I noticed other unused packages are being compiled. Is this controlled by an option? How do I stop it? It's a little annoying to not be able to test a feature (LTO) for packages that I'm not even using.
This is on the openwrt-23.05 branch. For Atheros ATH79 router.
Various core libraries (libubox, libubus, libuci, …) provide Lua bindings, hence the Lua build prerequisite. Iirc the packaging is not fine grained enough to allow disabling Lua but I might misremember.
But I don't have any of those bindings installed. So for example libubox can't be compiled without liblua even though I'm not using libubox-lua? I have absolutely no lua libraries or bindings installed. It's no longer necessary for LuCI (or at least not for the apps I use). How do I find which package is the prerequisite?
Doesn‘t matter, unless dependencies are declared conditionally (which they aren’t in this case), a source package build will depend on all prerequisites of all its optional components.
Solution is to fix the packaging to make the Lua dependencies optional.
So I looked into one instance. The specific case of fstools. There is a dependency for the header file blkid/blkid.h and for the dependency it uses PKG_BUILD_DEPENDS:=util-linux which I guess does a Package/util-linux/Default? I'm not sure. Which would pull in all it's dependencies is that correct? So for the one header file we are building a tree of sources that will never be used. Do I have that correct? Or does it stop somehow? It seems incredibly wasteful but I understand the human resource constraints and maybe that's just the way it has to be. My question is if this sequence of events sound correct. Is there value in having a PKG_BUILD_DEPENDS or equivalent that is source only with no compile?