Files
openwrt-packages/libs/sqlite3/test.sh
George Sapkin 0d384d4b89 sqlite3: don't install ABI-less library
Don't install the ABI-less library to support potential multiple ABIs
side by side.

Add a matching tests to check the soname and ensure the ABI-less library
is not installed.

Fixes: aebfd49 ("sqlite3: bump to 3.49.1")
Signed-off-by: George Sapkin <george@sapk.in>
2025-11-22 18:54:34 +02:00

46 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
#
# SPDX-License-Identifier: GPL-2.0-only
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