From: Daniel Golle Date: Tue, 18 Aug 2026 00:10:27 +0000 (+0100) Subject: libdht: give the shared library a soname X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=502da457ccb6201dafaf666a5822f5b001c9eea4;p=openwrt-packages.git libdht: give the shared library a soname The library installed as a bare libdht.so with no SONAME, so consumers recorded the filename as their DT_NEEDED and there was no way to express an ABI break. Build it as libdht.so.0 with a matching soname and declare ABI_VERSION, so the package is versioned like any other shared library. jech/dht makes no ABI promise of its own, so 0 is a packaged ABI epoch: bump PKG_ABI_VERSION if the exported surface changes. That epoch is now a single variable referenced from ABI_VERSION, the soname, the output filename and the symlink target, rather than repeated literally in all four places, matching the pattern already used by libcurl-gnutls. Also pass TARGET_CFLAGS/TARGET_CPPFLAGS/TARGET_LDFLAGS to the compile and link, which the hand-written rules had skipped, and fix PKG_LICENSE_FILES: jech/dht ships LICENCE, not LICENSE, so the declared file was never found. Signed-off-by: Daniel Golle --- diff --git a/libs/libdht/Makefile b/libs/libdht/Makefile index 692960072..718732aff 100644 --- a/libs/libdht/Makefile +++ b/libs/libdht/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libdht -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/jech/dht @@ -10,33 +10,44 @@ PKG_SOURCE_VERSION:=0bbb8f4a5bd914b60de5e9fbb51573aa33a1cf18 PKG_MIRROR_HASH:=4a24bd406dd0ac9e69d75f062b45bc0d660f1f8bed9672afc35a7afe4b13acf4 PKG_LICENSE:=MIT -PKG_LICENSE_FILES:=LICENSE +PKG_LICENSE_FILES:=LICENCE PKG_MAINTAINER:=Daniel Golle include $(INCLUDE_DIR)/package.mk +# Upstream ships a plain Makefile that builds only a test binary, so the +# shared object is built here -- and given a soname, since a bare libdht.so +# leaves no way to express an ABI break. jech/dht offers no ABI guarantee of +# its own, so this is a packaged ABI epoch: bump PKG_ABI_VERSION if the +# exported surface changes. +PKG_ABI_VERSION:=0 + define Package/libdht SECTION:=libs CATEGORY:=Libraries TITLE:=Kademlia Distributed Hash Table (DHT) library DEPENDS:= +USE_GLIBC:libcrypt-compat + ABI_VERSION:=$(PKG_ABI_VERSION) endef define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/dht $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/dht.h $(1)/usr/include/dht - $(CP) $(PKG_BUILD_DIR)/libdht.so $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/libdht.so* $(1)/usr/lib/ endef define Package/libdht/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libdht.so $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/libdht.so.$(PKG_ABI_VERSION) $(1)/usr/lib/ endef define Build/Compile - $(TARGET_CC) $(FPIC) -Wall -c -o $(PKG_BUILD_DIR)/dht.o $(PKG_BUILD_DIR)/dht.c - $(TARGET_CC) -shared -lcrypt -o $(PKG_BUILD_DIR)/libdht.so $(PKG_BUILD_DIR)/dht.o + $(TARGET_CC) $(FPIC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -Wall \ + -c -o $(PKG_BUILD_DIR)/dht.o $(PKG_BUILD_DIR)/dht.c + $(TARGET_CC) $(TARGET_LDFLAGS) -shared -Wl,-soname,libdht.so.$(PKG_ABI_VERSION) \ + -o $(PKG_BUILD_DIR)/libdht.so.$(PKG_ABI_VERSION) $(PKG_BUILD_DIR)/dht.o -lcrypt + ln -sf libdht.so.$(PKG_ABI_VERSION) $(PKG_BUILD_DIR)/libdht.so endef $(eval $(call BuildPackage,libdht))