diff --git a/libs/sqlite3/Makefile b/libs/sqlite3/Makefile index bf002d4cc6..484669cca1 100644 --- a/libs/sqlite3/Makefile +++ b/libs/sqlite3/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sqlite PKG_VERSION:=3.51.0 PKG_SRC_VERSION:=3510000 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-autoconf-$(PKG_SRC_VERSION).tar.gz PKG_SOURCE_URL:=https://www.sqlite.org/2025/ @@ -137,7 +137,7 @@ endef define Package/libsqlite3/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite3.so.{$(PKG_VERSION),$(ABI_VERSION)} $(1)/usr/lib endef define Package/sqlite3-cli/install diff --git a/libs/sqlite3/test.sh b/libs/sqlite3/test.sh index 13af478333..ef84adcc6f 100755 --- a/libs/sqlite3/test.sh +++ b/libs/sqlite3/test.sh @@ -2,6 +2,44 @@ # # SPDX-License-Identifier: GPL-2.0-only -if [ "$1" = 'sqlite3-cli' ]; then - sqlite3 -version | grep -F "$PKG_VERSION" -fi +case "$PKG_NAME" in + libsqlite3) + apk add binutils + + readelf_out=$(readelf --dynamic "/usr/lib/libsqlite3.so.$PKG_VERSION") + if [ $? -ne 0 ]; then + echo "readelf failed for /usr/lib/libsqlite3.so.$PKG_VERSION" >&2 + exit 1 + fi + + soname=$(echo "$readelf_out" \ + | grep -F '(SONAME)' \ + | sed -E 's/.*\[(.*)\]/\1/') + + if [ -z "$soname" ]; then + echo "soname not found in /usr/lib/libsqlite3.so.$PKG_VERSION" >&2 + exit 1 + fi + + link_target=$(readlink "/usr/lib/$soname") + if [ $? -ne 0 ]; then + echo "Failed to read soname link /usr/lib/$soname" >&2 + exit 1 + fi + + expected_target="libsqlite3.so.$PKG_VERSION" + if [ "$link_target" != "$expected_target" ]; then + echo "soname link /usr/lib/$soname points to '$link_target', expected '$expected_target'" >&2 + exit 1 + fi + + if [ -f '/usr/lib/libsqlite3.so' ]; then + echo "/usr/lib/libsqlite3.so shouldn't be installed" >&2 + exit 1 + fi + ;; + + sqlite3-cli) + sqlite3 -version | grep -F "$PKG_VERSION" + ;; +esac