Sunday, September 03, 2023

Re: check-lib-depends and modules' *_WANTLIB

diff /usr/src
commit - 0471d1f4946d93e99e0ad752bdf577b3349209b8
path + /usr/src
blob - 5e50f5a082c11cc78b47ab379a1f5b9b5083ec96
file + share/man/man5/bsd.port.mk.5
--- share/man/man5/bsd.port.mk.5
+++ share/man/man5/bsd.port.mk.5
@@ -1246,6 +1246,13 @@ as this can be a big performance hit.
Defaults to
.Sq \&No ,
as this can be a big performance hit.
+.It Ev CHECK_LIB_DEPENDS_ARGS
+List of arguments for
+.Xr check-lib-depends 1 .
+Useful for
+.Xr port-modules 5
+to substitute list of libraries with a variable in
+.Ev WANTLIB .
.It Ev CHECKSUMFILES
List of all files that need to be retrieved by
.Cm fetch ,
Index: infrastructure/mk/bsd.port.mk
===================================================================
RCS file: /home/cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1600
diff -u -p -r1.1600 bsd.port.mk
--- infrastructure/mk/bsd.port.mk 22 Aug 2023 17:02:29 -0000 1.1600
+++ infrastructure/mk/bsd.port.mk 1 Sep 2023 15:58:35 -0000
@@ -247,6 +247,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"
@@ -1941,12 +1943,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}
(+cc semarie@ for cargo.port.mk)

On 2023/08/21 14:57:04 +0200, Marc Espie <marc.espie.openbsd@gmail.com> wrote:
> [...]
> > > On 2023/03/07 14:05:19 +0100, Omar Polo <op@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.
>
> [...]
>
> Write corresponding documentation bits for bsd.port.mk.5, and I'll consider
> it.

sorry for the delay.

Here's the diff again with a tiny bit of wording in bsd.port.mk(5).
I'm not sure really how to better describe this in the manpage,
suggestions appreciated! :)

(since i'm using got for src/ and cvs for ports/, I'm attaching two
diffs.)

`ports.diff' contains the diff for bsd.port.mk and example usage for
the lua and cargo modules (that I intend to commit together with
this.) It can be trivially expanded to other modules.

I considered making the variable more like SUBST_VARS (i.e. just a
list of variable names) but then we loose the ability to express -F
which can be handy. Or maybe I'm overthinking it.


Thanks,

Omar Polo

No comments:

Post a Comment