[openwrt/openwrt] libcrypt-compat: introduce package

LEDE Commits lede-commits at lists.infradead.org
Mon Jun 23 02:19:11 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/e3cf7088f14cac1b58ac6bf8738e9b26eb81bbfa

commit e3cf7088f14cac1b58ac6bf8738e9b26eb81bbfa
Author: Konstantin Demin <rockdrilla at gmail.com>
AuthorDate: Tue Jun 17 02:51:20 2025 +0300

    libcrypt-compat: introduce package
    
    glibc 2.39 has removed libcrypt completely.
    solution: build libxcrypt with glibc compatibility.
    
    Signed-off-by: Konstantin Demin <rockdrilla at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/19160
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/libs/xcrypt/Makefile | 70 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 64 insertions(+), 6 deletions(-)

diff --git a/package/libs/xcrypt/Makefile b/package/libs/xcrypt/Makefile
index 20417cc346..e0cb6a1e86 100644
--- a/package/libs/xcrypt/Makefile
+++ b/package/libs/xcrypt/Makefile
@@ -15,16 +15,33 @@ PKG_LICENSE_FILES:=COPYING.LIB
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 
+PKG_CONFIG_DEPENDS:= \
+	CONFIG_USE_GLIBC \
+	CONFIG_PACKAGE_libcrypt-compat \
+	CONFIG_PACKAGE_libxcrypt
+
 include $(INCLUDE_DIR)/package.mk
 
-define Package/libxcrypt
+define Package/libxcrypt/Default
   SECTION:=libs
   CATEGORY:=Libraries
   URL:=https://github.com/besser82/libxcrypt
   TITLE:=Extended crypt library
+endef
+
+define Package/libxcrypt
+$(Package/libxcrypt/Default)
+  VARIANT:=regular
   BUILDONLY:=1
 endef
 
+define Package/libcrypt-compat
+$(Package/libxcrypt/Default)
+  VARIANT:=compat
+  TITLE+= - libc compatibility
+  DEPENDS:=@USE_GLIBC
+endef
+
 define Package/libxcrypt/description
   libxcrypt is a modern library for one-way hashing of passwords. It supports
   a wide variety of both modern and historical hashing methods: yescrypt,
@@ -35,21 +52,62 @@ define Package/libxcrypt/description
   crypt_gensalt_rn, and crypt_gensalt_ra.
 endef
 
+Package/libcrypt-compat/description=$(Package/libxcrypt/description)
+
 CONFIGURE_ARGS += \
+	--with-pic \
+	--enable-year2038 \
+	--disable-xcrypt-compat-files
+
+ifeq ($(BUILD_VARIANT),regular)
+  CONFIGURE_ARGS += \
 	--disable-shared \
 	--disable-failure-tokens \
-	--disable-xcrypt-compat-files \
 	--disable-obsolete-api \
-	--enable-hashes=solaris \
-	--with-pic
+	--enable-hashes=solaris
+endif
 
-define Build/InstallDev
+ifeq ($(BUILD_VARIANT),compat)
+  CONFIGURE_ARGS += \
+	--enable-obsolete-api=glibc \
+	--enable-hashes=glibc
+endif
+
+define Package/libxcrypt/install
+	true
+endef
+
+define Package/libcrypt-compat/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcrypt.so.* $(1)/usr/lib/
+endef
+
+define Build/libxcrypt/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
 	$(INSTALL_DIR) $(1)/usr/lib/libxcrypt
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcrypt.{a,la} $(1)/usr/lib/libxcrypt
 	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*crypt.pc $(1)/usr/lib/pkgconfig/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libxcrypt.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Build/libcrypt-compat/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcrypt.{a,la,so*} $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+	# libcrypt.pc is symlink to libxcrypt.pc
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libxcrypt.pc $(1)/usr/lib/pkgconfig/libcrypt.pc
 endef
 
+ifeq ($(BUILD_VARIANT),regular)
+  Build/InstallDev=$(Build/libxcrypt/InstallDev)
+endif
+
+ifeq ($(BUILD_VARIANT),compat)
+  Build/InstallDev=$(Build/libcrypt-compat/InstallDev)
+endif
+
+$(eval $(call BuildPackage,libcrypt-compat))
 $(eval $(call BuildPackage,libxcrypt))




More information about the lede-commits mailing list