libyang-legacy: split a v3 ABI compat package from libyang

Build a second package from the same libyang 3.13.6 tarball, so
consumers bound to the v3 ABI keep working once libyang moves to 5.x.
It ships only /usr/lib/libyang.so.3* and stages its headers, library
and .pc under /usr/lib/libyang-legacy to avoid colliding with libyang.

All in-tree consumers are switched to it here; the commits that follow
move libnetconf2, sysrepo and netopeer2 back to +libyang as their
upstream releases gain v5 support. frr stays on the legacy ABI.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
Alexandru Ardelean authored and Alexandru Ardelean committed 2026-10-07 16:12:29 +03:00
1 parent a7de9a5ba3
commit f1e040104b
6 files changed
+110 -11

No files matched your search

+3 -2
View File
@@ -25,14 +25,15 @@ include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_OPTIONS += \
-DENABLE_PAM=OFF
-DENABLE_PAM=OFF \
-DCMAKE_PREFIX_PATH=$(STAGING_DIR)/usr/lib/libyang-legacy
define Package/libnetconf2
SECTION:=libs
CATEGORY:=Libraries
TITLE:=NETCONF library
URL:=https://github.com/CESNET/libnetconf2
DEPENDS:= +libyang +libcurl +libssh +libopenssl +libpthread
DEPENDS:=+libyang-legacy +libcurl +libssh +libopenssl +libpthread
endef
define Package/libnetconf2/description
+71
View File
@@ -0,0 +1,71 @@
#
# Copyright (C) 2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libyang-legacy
PKG_VERSION:=3.13.6
PKG_RELEASE:=1
PKG_SOURCE:=libyang-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/CESNET/libyang/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=5cd5018f39c830f97d70616c003990287ce5e820ae2792763a49e2a1f63af8d6
PKG_BUILD_DIR:=$(BUILD_DIR)/libyang-$(PKG_VERSION)
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:cesnet:libyang
CMAKE_INSTALL:=1
CMAKE_BINARY_SUBDIR:=build
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libyang-legacy
SECTION:=libs
CATEGORY:=Libraries
TITLE:=YANG data modeling language library (legacy v3 ABI)
URL:=https://github.com/CESNET/libyang
DEPENDS:=+libpcre2 +libpthread +libxxhash
endef
define Package/libyang-legacy/description
libyang-legacy ships the libyang 3.x runtime (libyang.so.3) for binaries
still linked against the legacy ABI. It is install-time co-installable
with libyang 5.x (libyang.so.5), whose SONAME differs.
Build-time consumers should point CMAKE_PREFIX_PATH (or PKG_CONFIG_PATH)
at $$$$(STAGING_DIR)/usr/lib/libyang-legacy so that the legacy headers,
library and pkg-config file are picked up in preference to libyang 5.x.
endef
# Staged under a self-contained /usr/lib/libyang-legacy prefix, with a
# sysroot-relative .pc prefix so pkg-config does not double-prepend.
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib/libyang-legacy/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/libyang \
$(1)/usr/lib/libyang-legacy/include/
$(INSTALL_DIR) $(1)/usr/lib/libyang-legacy/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libyang.so* \
$(1)/usr/lib/libyang-legacy/lib/
$(INSTALL_DIR) $(1)/usr/lib/libyang-legacy/lib/pkgconfig
sed -e 's|^prefix=.*|prefix=/usr/lib/libyang-legacy|' \
-e 's|^libdir=.*|libdir=$${prefix}/lib|' \
-e 's|^includedir=.*|includedir=$${prefix}/include|' \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libyang.pc \
> $(1)/usr/lib/libyang-legacy/lib/pkgconfig/libyang.pc
endef
define Package/libyang-legacy/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libyang.so.3* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libyang-legacy))
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
case "$1" in
libyang-legacy)
# Runtime-only; the unversioned symlink belongs to libyang 5.x.
[ -e /usr/lib/libyang.so.3 ] || {
echo "libyang.so.3 not found" >&2
exit 1
}
;;
*)
echo "Unsupported test target: $1" >&2
exit 1
;;
esac
+13 -3
View File
@@ -74,13 +74,14 @@ define Package/frr/Default
CATEGORY:=Network
SUBMENU:=Routing and Redirection
URL:=https://www.frrouting.org/
DEPENDS:=frr
# Spelled out: apk's soname resolution would pick libyang 5.x.
DEPENDS:=frr +libyang-legacy
endef
define Package/frr
$(call Package/frr/Default)
DEPENDS:=+librt +libatomic +libcap +libncurses +libjson-c +libreadline \
+libyang +libprotobuf-c +FRR_OPENSSL:libopenssl +FRR_SNMP:libnetsnmp +more
+libyang-legacy +libprotobuf-c +FRR_OPENSSL:libopenssl +FRR_SNMP:libnetsnmp +more
TITLE:=The FRRouting (FRR) Software Routing Suite
MENU:=1
endef
@@ -153,7 +154,16 @@ define Package/frr/conffiles
/etc/frr/vtysh.conf
endef
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -latomic
# frr needs the v3 ABI; its configure looks libyang up three ways
# (PKG_CHECK_MODULES, pkg-config --modversion, AC_CHECK_LIB), so all of
# LDFLAGS, LIBYANG_* and PKG_CONFIG_PATH point at the legacy prefix.
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -latomic \
-L$(STAGING_DIR)/usr/lib/libyang-legacy/lib
CONFIGURE_VARS += \
LIBYANG_CFLAGS="-I$(STAGING_DIR)/usr/lib/libyang-legacy/include" \
LIBYANG_LIBS="-L$(STAGING_DIR)/usr/lib/libyang-legacy/lib -lyang" \
PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/libyang-legacy/lib/pkgconfig:$$$$PKG_CONFIG_PATH"
define Host/Configure
$(Host/Configure/Default)
+4 -3
View File
@@ -29,7 +29,7 @@ define Package/netopeer2-server
CATEGORY:=Utilities
TITLE:=NETCONF server
URL:=https://github.com/CESNET/Netopeer2
DEPENDS:=+libcurl +libpthread +libyang +libnetconf2 +libsysrepo +sysrepocfg +sysrepoctl +sysrepo
DEPENDS:=+libcurl +libpthread +libyang-legacy +libnetconf2 +libsysrepo +sysrepocfg +sysrepoctl +sysrepo
MENU:=1
endef
@@ -38,7 +38,7 @@ define Package/netopeer2-cli
CATEGORY:=Utilities
TITLE:=Netopeer2 cli tool
URL:=https://github.com/CESNET/Netopeer2
DEPENDS:=+libpthread +libyang +libnetconf2 +libopenssl
DEPENDS:=+libpthread +libyang-legacy +libnetconf2 +libopenssl
endef
define Package/netopeer2/description
@@ -51,7 +51,8 @@ endef
CMAKE_OPTIONS += \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DSYSREPO_SETUP:BOOL=OFF
-DSYSREPO_SETUP:BOOL=OFF \
-DCMAKE_PREFIX_PATH=$(STAGING_DIR)/usr/lib/libyang-legacy
define Package/netopeer2-server/install
$(INSTALL_DIR) $(1)/usr/bin
+4 -3
View File
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=sysrepo
PKG_VERSION:=3.7.11
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/sysrepo/sysrepo/tar.gz/v$(PKG_VERSION)?
@@ -29,7 +29,7 @@ define Package/libsysrepo
CATEGORY:=Libraries
TITLE:=YANG-based data store library
URL:=https://www.sysrepo.org/
DEPENDS:=+libyang $(ATOMIC64_DEPENDS) +libprotobuf-c +libev +librt +libpthread
DEPENDS:=+libyang-legacy $(ATOMIC64_DEPENDS) +libprotobuf-c +libev +librt +libpthread
endef
define Package/sysrepo
@@ -71,7 +71,8 @@ CMAKE_OPTIONS += \
-DCMAKE_BUILD_TYPE="Package" \
-DREPOSITORY_LOC:PATH=/etc/sysrepo \
-DCALL_TARGET_BINS_DIRECTLY=OFF \
-DGEN_LANGUAGE_BINDINGS:BOOL=TRUE
-DGEN_LANGUAGE_BINDINGS:BOOL=TRUE \
-DCMAKE_PREFIX_PATH=$(STAGING_DIR)/usr/lib/libyang-legacy
define Package/libsysrepo/install
$(INSTALL_DIR) $(1)/usr/lib