Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
check_syms from bsd.port.mk (Re: graphics/ffmpeg: update to 8.0.2 (-stable) and 8.1.1 (-current)
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
ports@openbsd.org, marc.espie.openbsd@gmail.com
Date:
Fri, 8 May 2026 13:02:32 +0200

Download raw body.

Thread
+espie

On Fri, May 08, 2026 at 04:13:40AM +0200, Kirill A. Korinsky wrote:
> On Fri, 08 May 2026 02:39:57 +0200,
> Theo Buehler <tb@theobuehler.org> wrote:
> > 
> > It's late and I haven't looked at the makefile parts. The manual
> > describes exactly what I'd like to have.
> > 
> > What I don't like about the approach of copying a version of the
> > guenther magic into ports is that it reintroduces the issue of keeping
> > the two in sync. I'd rather avoid that.
> > 
> > I think it would be okay to error if ${BSDSRCDIR}/lib/check_sym doesn't
> > exist (or even /usr/src/lib/check_sym if BSDSRCDIR is unavailable).
> > Then it should be possible reuse a pretty dumb wrapper like the script
> > sthen shared. Maybe I miss a subtlety.
> > 
> 
> Actually we don't need wrapper, or I need sleep.

Before you go too far, you want espie's input and hopefully he has time
and motivation to look... kirill's original mail is

https://marc.info/?l=openbsd-ports&m=177820647125766&w=2

Embedding the script into bsd.port.mk seems an option and it does not
look too terrible to me...

I think check-diffsyms is not a great name since check_syms doesn't
really diff... Can the target simply be called check-syms?

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...


> 
> I had tested it a bit and it works as expected.
> 
> 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 02:11:59 -0000
> @@ -158,6 +158,14 @@ Essentially invoke
>  env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \e
>  	-f ${MAKE_FILE} ${ALL_TARGET}
>  .Ed
> +.It Cm check-diffsyms
> +Compare exported dynamic symbols for
> +.Ev PLIST
> +shared libraries after
> +.Cm fake ,
> +against matching installed libraries.
> +Requires the package to be installed; skips libraries with no installed
> +counterpart.
>  .It Cm check-register
>  Introspection target.
>  Verify from the ports tree, without building anything, that the current
> 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 02:07:20 -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-diffsyms update-patches:
>  .  if !defined(IGNORE_SILENT)
>  	@${ECHO_MSG} "===>  ${FULLPKGNAME${SUBPACKAGE}}${_MASTER} ${IGNORE${SUBPACKAGE}} ${_EXTRA_IGNORE}."
>  .  endif
> @@ -2560,6 +2561,27 @@ port-lib-depends-check: ${WRKINST}/.save
>  			${_CHECK_LIB_DEPENDS} -i -s ${WRKINST}/.saved_libs; \
>  	done
>  
> +check-diffsyms: ${_FAKE_COOKIE}
> +.for _S in ${BUILD_PACKAGES}
> +	@b=$$(cd ${.CURDIR} && SUBPACKAGE=${_S} ${MAKE} print-plist|sed -ne '/^@pkgpath /s,,-e ,p'); \
> +	a=$$(${PKG_INFO} -e ${FULLPKGPATH${_S}} $$b 2>/dev/null |sort -u); \
> +	case $$a in \
> +		'') echo 1>&2 "Fatal: no installed package for ${FULLPKGPATH${_S}}"; exit 1;; \
> +		*) [ -x ${_CHECK_SYM} ] || { echo 1>&2 "Fatal: ${_CHECK_SYM} doesn't exist"; exit 1; }; \
> +		   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" ] || continue; \
> +				${_CHECK_SYM} "$$old" "$$new" || exit 1; \
> +			done;; \
> +	esac
> +.endfor
> +
>  # 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',
> @@ -3857,7 +3879,7 @@ _all_phony = ${_recursive_depends_target
>  	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 \
> -	peek-ftp port-lib-depends-check post-build post-configure \
> +	peek-ftp port-lib-depends-check check-diffsyms post-build post-configure \
>  	post-distpatch post-extract post-install \
>  	post-patch post-test pre-build pre-configure pre-extract pre-fake \
>  	pre-install pre-patch pre-test prepare \
> 
> 
> 
> -- 
> wbr, Kirill