Re: cyrus-sasl dependency in bsd.ldap.mk

From: Xin LI <delphij_at_gmail.com>
Date: Wed, 10 Nov 2021 18:27:58 UTC
+Mathieu Arnold <mat@freebsd.org> and Yuri, please see the discussion
below.

On Mon, Nov 8, 2021 at 9:28 AM Juraj Lutter <otis@freebsd.org> wrote:

>
>
> > On 8 Nov 2021, at 18:17, Xin Li <delphij@delphij.net> wrote:
> >
> > On 11/8/21 05:39, Juraj Lutter wrote:
> >> Hi Delphij,
> >> you seem to be the most active in bsd.ldap.mk :-)
> >> I’ve found that since openldap-client also depends on cyrus-sasl
> unconditionally, bsd.ldap.mk requires this:
> >> otis@b13:/usr/ports/Mk % git diff -- bsd.ldap.mk
> >> diff --git a/Mk/bsd.ldap.mk b/Mk/bsd.ldap.mk
> >> index a6f37dd99b10..7acbc9c660bb 100644
> >> --- a/Mk/bsd.ldap.mk
> >> +++ b/Mk/bsd.ldap.mk
> >> @@ -77,6 +77,7 @@ IGNORE=               cannot install: doesn't work
> with OpenLDAP version: ${OPENLDAP_VER} (Do
> >>  .      endfor
> >>  .endif # IGNORE_WITH_OPENLDAP
> >>  LIB_DEPENDS+=
> ${OPENLDAP${OPENLDAP_VER}_LIB}:net/openldap${OPENLDAP_VER}-client
> >> +LIB_DEPENDS+=  libsasl2.so:security/cyrus-sasl2
> >>  .else
> >>  IGNORE=                cannot install: unknown OpenLDAP version:
> ${OPENLDAP_VER}
> >>  .endif # Check for correct libs
> >> What are you thought about it?
> >
> > Could you provide an example that shows the breakage or elaborate more
> about why libsasl2.so needs to be listed as a direct library dependency for
> ports that depends on OpenLDAP?  It's already listed as LIB_DEPENDS in
> openldap*-{server,client} and installing the library should automatically
> bring in cyrus-sasl as needed, no?
>
> In fact, I was only looking for a solution to silence this:
>
> ====> Running Q/A tests (stage-qa)
> Error: /usr/local/lib/postfix/postfix-ldap.so is linked to
> /usr/local/lib/libsasl2.so.3 from security/cyrus-sasl2 but it is not
> declared as a dependency
> Warning: you need LIB_DEPENDS+=libsasl2.so:security/cyrus-sasl2
>
> And even when LDAP is being pulled in via LIB_DEPENDS in bsd.ldap.mk,
> there is no explicit dependency on cyrus-sasl2.
>
> What would be the better approach? Given that bsd.ldap.mk is not the
> right place.
>

It looks like this was requested in bug 195203
<https://bugs.freebsd.org/195203> and implemented here
<https://cgit.freebsd.org/ports/commit/Mk/Scripts/qa.sh?id=6596903add1b5bc0c6587894569b3530a2fc8e6a>
.

I wonder if it's possible to only check for DT_NEEDED libraries instead of
all of these libraries?  E.g. if an executable or shared library is
depending on library A and library A depends on library B, library B should
only be considered as a true dependency iff the executable/library is
calling symbols in library B directly.