[2/2] Makefile: Avoid installing libtool control files

Message ID 20260624133915.434197-2-valter.jansons@gmail.com
State Superseded
Headers
Series [1/2] Makefile: Install Lua in `exec` stage, not `data` |

Commit Message

Valters Jansons 24 Jun 2026, 1:39 p.m. UTC
This project currently uses autoconf, automake, and libtool for
building. During build process, libtool creates `.la` control files
with metadata about the `.so` library. On modern systems, shipping
these files is now strongly discouraged.

The `.la` files are generally not used on live systems. The only
scenario where they would be used is if someone loads the library using
libltdl (libtool's `dlopen` wrapper). However, both Python and Lua just
load the library directly using a `dlopen("location.so")` instead of
calling `lt_dlopen("location.la")`. This project does not reference
`lt_dlopen` or `ltdl` as such.

Moreover, the `.la` files include redundant dependency chain
information. For example, the Lua module depends on libloc. Even though
OpenSSL is a transitive dependency (`src/database.c` and `src/writer.c`,
not `src/lua/`), libtool anyway adds `-lssl` (as well as `-lcrypto
-lresolv`) directly to `dependency_libs` of Lua's `location.la`.
Listing these transitive dependencies muddies the chain. If someone is
consuming the Lua module downstream, then libtool would force the full
dependency chain onto them directly, which is not needed.

Additionally, due to hardcoded dependencies, rebuild propagation is
a concern. An upstream library updating their soname requires all
downstream `.la` files to be rebuilt, even if libloc's ABI has not
changed. This is especially painful at distro packaging scale.

As a result, modern packaging is pushing towards removing these `.la`
files. In cases where some libltdl consumers exist, the fallback route
is emptying out the dependency_libs metadata field. This is visible in
Debian Lintian as error `non-empty-dependency_libs-in-la-file`.

We can go the whole way and drop these files outright. The `.la` files
reference each other; therefore, when one is being removed, all of them
should be removed, to avoid dangling references.

Ref: https://wiki.debian.org/ReleaseGoals/LAFileRemoval
Ref: https://fedoraproject.org/wiki/Changes/RemoveLaFiles

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
---
Note: This commit adds the removal logic in `install-exec-hook`. This
depends on the parent commit in this series, ensuring Lua is installed
in `exec` instead of `data`.

 Makefile.am | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Patch

diff --git a/Makefile.am b/Makefile.am
index a64a20a..735e07a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -359,6 +359,20 @@  CLEANFILES += \
 
 # ------------------------------------------------------------------------------
 
+install-exec-hook:
+	# Avoid installing .la files, as we do not use libltdl.
+	@for la in $(lib_LTLIBRARIES); do \
+	  rm -f "$(DESTDIR)$(libdir)/`basename $$la`"; \
+	done
+	@for la in $(pyexec_LTLIBRARIES); do \
+	  rm -f "$(DESTDIR)$(pyexecdir)/`basename $$la`"; \
+	done
+	@for la in $(luaexec_LTLIBRARIES); do \
+	  rm -f "$(DESTDIR)$(luaexecdir)/`basename $$la`"; \
+	done
+
+# ------------------------------------------------------------------------------
+
 # Use systemd timers if available
 if HAVE_SYSTEMD
 systemdsystemunit_DATA = \