git: d53991856704 - main - Mk/Scripts: qa resolve LIB_DEPENDS using sonames

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 07 Sep 2026 07:26:00 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d5399185670435361c9d3f6217438704ed0aa878

commit d5399185670435361c9d3f6217438704ed0aa878
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-09-07 07:21:20 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-09-07 07:25:08 +0000

    Mk/Scripts: qa resolve LIB_DEPENDS using sonames
    
    PR:     274012
    Reported by:    yuri
---
 Mk/Scripts/qa.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh
index 2556395ff3eb..bc69aa034cb5 100644
--- a/Mk/Scripts/qa.sh
+++ b/Mk/Scripts/qa.sh
@@ -667,7 +667,8 @@ proxydeps_suggest_uses() {
 }
 
 proxydeps() {
-	local file dep_file dep_file_pkg already rc dep_lib_file dep_lib_files
+	local file dep_file dep_file_pkg already rc dep_lib_file dep_lib_files \
+		_checklib _soname
 
 	rc=0
 
@@ -734,7 +735,14 @@ proxydeps() {
 
 	# Check whether all files in LIB_DEPENDS are actually linked against
 	for _library in ${WANTED_LIBRARIES} ; do
-		if ! listcontains ${_library%%.so*}.so "${dep_lib_files}" ; then
+		# Resolve the LIB_DEPENDS library to its actual SONAME
+		_checklib=${_library}
+		if [ -f "${LOCALBASE}/lib/${_library}" ]; then
+			_soname=$(readelf -d "${LOCALBASE}/lib/${_library}" 2>/dev/null | \
+				awk '/SONAME/ {gsub(/[\[\]]/, "", $NF); print $NF}')
+			[ -n "${_soname}" ] && _checklib=${_soname}
+		fi
+		if ! listcontains ${_checklib%%.so*}.so "${dep_lib_files}" ; then
 			warn "you might not need LIB_DEPENDS on ${_library}"
 		fi
 	done