When regenerating WANTLIBs I usually comment/remove the WANTLIB from a port' Makefile, run `make port-lib-depends-check' and copy its output back into the makefile. This does not work "properly" for some ports, for e.g. the ones that use a *_WANTLIB variable defined by a module.
Diff below adds a variable CHECK_LIB_DEPENDS_ARGS that modules can use to pass flags to check-lib-depends, and a example usage for the lua module. A sample output now is: % mpldc boswars-2.7p4(games/boswars): Missing: GL.17 (/usr/local/bin/boswars) (system lib) ... Missing: z.7 (/usr/local/bin/boswars) (system lib) WANTLIB += ${COMPILER_LIBCXX} ${MODLUA_WANTLIB} GL SDL X11 Xau WANTLIB += Xdmcp c m ogg png theora vorbis xcb z *** Error 1 in target 'port-lib-depends-check' (ignored) that is handier for copy-pasting back into hte makefile. Could be trivially expanded for MODRUBY_WANTLIB, MODPHP_WANTLIB & friends. Thoughts/comments/ok? Index: infrastructure/mk//bsd.port.mk =================================================================== RCS file: /home/cvs/ports/infrastructure/mk/bsd.port.mk,v retrieving revision 1.1585 diff -u -p -r1.1585 bsd.port.mk --- infrastructure/mk//bsd.port.mk 6 Mar 2023 13:32:42 -0000 1.1585 +++ infrastructure/mk//bsd.port.mk 7 Mar 2023 12:59:22 -0000 @@ -289,6 +289,8 @@ NO_TEST ?= No INSTALL_TARGET ?= install USE_GROFF ?= No +CHECK_LIB_DEPENDS_ARGS = + .if !defined(_ARCH_DEFINES_INCLUDED) _ARCH_DEFINES_INCLUDED = Done . include "${PORTSDIR}/infrastructure/mk/arch-defines.mk" @@ -1908,12 +1910,13 @@ _check_lib_depends = ${_CHECK_LIB_DEPEND _check_lib_depends =: .endif +CHECK_LIB_DEPENDS_ARGS += -S COMPILER_LIBCXX="${COMPILER_LIBCXX}" +CHECK_LIB_DEPENDS_ARGS += -S LIBECXX="${LIBECXX}" +CHECK_LIB_DEPENDS_ARGS += -S LIBCXX="${LIBCXX}" +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 += -S COMPILER_LIBCXX="${COMPILER_LIBCXX}" -_CHECK_LIB_DEPENDS += -S LIBECXX="${LIBECXX}" -_CHECK_LIB_DEPENDS += -S LIBCXX="${LIBCXX}" -_CHECK_LIB_DEPENDS += -F pthread +_CHECK_LIB_DEPENDS += -d ${_PKG_REPO} -B ${WRKINST} ${CHECK_LIB_DEPENDS_ARGS} .for _s in ${MULTI_PACKAGES} . if ${STATIC_PLIST${_s}:L} == "no" Index: lang/lua/lua.port.mk =================================================================== RCS file: /home/cvs/ports/lang/lua/lua.port.mk,v retrieving revision 1.37 diff -u -p -r1.37 lua.port.mk --- lang/lua/lua.port.mk 25 Dec 2022 13:40:19 -0000 1.37 +++ lang/lua/lua.port.mk 7 Mar 2023 13:01:31 -0000 @@ -58,6 +58,8 @@ MODLUA_DEP = lua${MODLUA_DEP_VERSION} MODLUA_WANTLIB = lua${MODLUA_VERSION} MODLUA_LIB = -l${MODLUA_WANTLIB} +CHECK_LIB_DEPENDS_ARGS += -S MODLUA_WANTLIB="${MODLUA_WANTLIB}" + _MODLUA_RUN_DEPENDS = lang/lua/${MODLUA_VERSION} MODLUA_LIB_DEPENDS = ${_MODLUA_RUN_DEPENDS}