On Fri, 08 May 2026 13:02:32 +0200,
Theo Buehler <[email protected]> wrote:
>
> I think check-diffsyms is not a great name since check_syms doesn't
> really diff... Can the target simply be called check-syms?
>
After some thinking about name I think the right one is: check-shlib-syms
Why? It checks only shlib symbols.
> I'm not a bsd.port.mk hacker at all... I think you want a
>
> _CHECKSYMS_COOKIE${S}:
>
> dance and benefit from the already existing .for _S in ${BUILD_PACKAGES}
> at line 693 of bsd.port.mk and let yourself inspire from the vicinity,
> but espie is really the person who can tell you how to do it the right
> way...
>
What makes it cacheble in the state target. I think it is wrong move because
it should behave like port-lib-depends-check.
Am I wrong?
To avoid caching and reuse existed _S in ${BUILD_PACKAGES} leads to call
target per package which needs to be made phony... It is possible, but...
I've tried and it looks messy. I think that current approach with one more
loop is cleaner, or at least more localized.
I had played with that code and relaized that all my pkgpath checks are
complicated and actually has many edge cases.
So, here simplified and renamed version:
Index: /usr/src/share/man/man5/bsd.port.mk.5
===================================================================
RCS file: /home/cvs/src/share/man/man5/bsd.port.mk.5,v
diff -u -p -r1.654 bsd.port.mk.5
--- /usr/src/share/man/man5/bsd.port.mk.5 4 Nov 2025 12:52:28 -0000
1.654
+++ /usr/src/share/man/man5/bsd.port.mk.5 8 May 2026 15:26:52 -0000
@@ -172,6 +172,13 @@ Apply
to all subpackages of the current port.
.It Cm checkpatch
Check that patches would apply cleanly, but do not modify anything.
+.It Cm check-shlib-syms
+Compare exported dynamic symbols for
+.Ev PLIST
+shared libraries after
+.Cm fake ,
+against matching installed libraries.
+Libraries with no installed counterpart are reported and skipped.
.It Cm checksum
Compute a
.Xr sha256 1
Index: /usr/ports/infrastructure/mk/bsd.port.mk
===================================================================
RCS file: /home/cvs/ports/infrastructure/mk/bsd.port.mk,v
diff -u -p -r1.1649 bsd.port.mk
--- /usr/ports/infrastructure/mk/bsd.port.mk 1 Apr 2026 15:14:57 -0000
1.1649
+++ /usr/ports/infrastructure/mk/bsd.port.mk 8 May 2026 15:28:07 -0000
@@ -2026,6 +2026,7 @@ CHECK_LIB_DEPENDS_ARGS += -F pthread
_CHECK_LIB_DEPENDS = PORTSDIR=${PORTSDIR} ${_PERLSCRIPT}/check-lib-depends
_CHECK_LIB_DEPENDS += -d ${_PKG_REPO} -B ${WRKINST} ${CHECK_LIB_DEPENDS_ARGS}
+_CHECK_SYM = ${BSDSRCDIR}/lib/check_sym
.for _s in ${MULTI_PACKAGES}
. if ${STATIC_PLIST${_s}:L} == "no"
@@ -2536,7 +2537,7 @@ _internal-all _internal-build _internal-
_internal-subpackage _internal-subupdate _internal-uninstall \
_internal-update _internal-update-or-install _internal-generate-readmes
\
_internal-update-or-install-all _internal-update-plist \
- lib-depends-check port-lib-depends-check update-patches:
+ lib-depends-check port-lib-depends-check check-shlib-syms
update-patches:
. if !defined(IGNORE_SILENT)
@${ECHO_MSG} "===> ${FULLPKGNAME${SUBPACKAGE}}${_MASTER}
${IGNORE${SUBPACKAGE}} ${_EXTRA_IGNORE}."
. endif
@@ -2560,6 +2561,21 @@ port-lib-depends-check: ${WRKINST}/.save
${_CHECK_LIB_DEPENDS} -i -s ${WRKINST}/.saved_libs; \
done
+check-shlib-syms: ${_FAKE_COOKIE}
+ @[ -x ${_CHECK_SYM} ] || { echo "check-shlib-syms: ${_CHECK_SYM}
doesn't exist"; exit 1; }; \
+ for s in ${BUILD_PACKAGES}; do \
+ cd ${.CURDIR} && SUBPACKAGE=$$s ${MAKE} print-plist-libs |
while read _l; do \
+ case $$_l in */lib*.so.*|lib*.so.*) ;; *) continue;;
esac; \
+ case $$_l in \
+ /*) oldpat=$${_l%.so.*}.so.*; new=${WRKINST}$$_l;; \
+ *) oldpat=${PREFIX}/$${_l%.so.*}.so.*;
new=${WRKINST}${PREFIX}/$$_l;; \
+ esac; \
+ old=$$(ls -rt $$oldpat 2>/dev/null | tail -1); \
+ [ -n "$$old" ] || { echo "check-shlib-syms: no
installed library for $$_l"; continue; }; \
+ ${_CHECK_SYM} "$$old" "$$new"; \
+ done; \
+ done
+
# Most standard port targets create a cookie to avoid being re-run.
#
# fetch is an exception, as it uses the files it fetches as `cookies',
@@ -3853,7 +3869,7 @@ _all_phony = ${_recursive_depends_target
print-package-args _print-package-signature-lib \
_print-package-signature-run _print-packagename
_recurse-all-dir-depends \
_recurse-test-dir-depends _recurse-run-dir-depends \
- build-depends-list checkpatch clean clean-depends \
+ build-depends-list checkpatch check-shlib-syms clean clean-depends \
delete-package distpatch do-build do-configure do-distpatch \
do-gen do-extract do-install do-test fetch-all \
install-all lib-depends lib-depends-list \
--
wbr, Kirill