ping (+cc espie)

On 2023/03/07 14:05:19 +0100, Omar Polo <o...@omarpolo.com> wrote:
> 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.

I still think something like this could be useful to automatically
generate WANTLIBs entries.  I'm attaching a rebased diff that includes
the bits for cargo.port.mk too.

I'm not happy with the naming, and I'm passing the flags because it
was easier and allows to specify -F also, should it be needed.  No
documentation either yet since I'm not sure this will be the final
naming / syntax.


Index: infrastructure/mk/bsd.port.mk
===================================================================
RCS file: /home/cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1598
diff -u -p -r1.1598 bsd.port.mk
--- infrastructure/mk/bsd.port.mk       14 Aug 2023 18:12:50 -0000      1.1598
+++ infrastructure/mk/bsd.port.mk       18 Aug 2023 07:44:17 -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"
@@ -1940,12 +1942,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: devel/cargo/cargo.port.mk
===================================================================
RCS file: /home/cvs/ports/devel/cargo/cargo.port.mk,v
retrieving revision 1.37
diff -u -p -r1.37 cargo.port.mk
--- devel/cargo/cargo.port.mk   26 Jul 2023 07:56:18 -0000      1.37
+++ devel/cargo/cargo.port.mk   18 Aug 2023 07:45:12 -0000
@@ -36,6 +36,8 @@ MODCARGO_WANTLIB +=   c++abi
 MODCARGO_WANTLIB +=
 .endif
 
+CHECK_LIB_DEPENDS_ARGS += -S MODCARGO_WANTLIB="${MODCARGO_WANTLIB}"
+
 # Define MASTER_SITES_CRATESIO for crates.io
 MASTER_SITES_CRATESIO =        https://crates.io/api/v1/crates/
 
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}

Reply via email to