Subject: Re: BUILDLINK_LDADD linker flags in db*/buildlink3.mk
To: grant beattie <grant@NetBSD.org>
From: Johnny Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 07/13/2005 11:50:45
grant beattie wrote:
> I've noticed that packages which need a bdb implementation don't
> know where to look for the library provided by mk/bdb.buildlink3.mk,
> because BUILDLINK_LDADD in db*/buildlink3.mk only has -ldb, -ldb3,
> etc., but no linker flags.
> 
> this causes issues for packages which use these buildlink3.mk files,
> eg. mail/exim3 which uses ${BDB_LIBS}:
> 
> .include "../../mk/bdb.buildlink3.mk"
> DBMLIB+=		${BDB_LIBS}
> 
> the value of ${BDB_LIBS} is "-ldb3" in this case, so the executable is
> unable to find libdb3 at runtime. mail/exim4 has a conditional dance
> which adds the right -R argument, but this doesn't seem the best way
> of handling this, the db*/buildlink3.mk should provide everything
> needed to link against the library.
> 
> the following patch addresses this.. any objections to committing it?
> with this patch, any pkg which .include's bdb.buildlink3.mk and uses
> ${BDB_LIBS} will build correctly without any additional logic.

No, if you want to do this, then provide new variables BDB_CPPFLAGS and 
BDB_LDFLAGS in bdb.buildlink3.mk that has the appropriate -D, -I, -L and 
-R options.  Don't add to BUILDLINK_LDADD.* in this way because those 
variables should only contain library options.

However, I don't think we should even be providing those variables.  Why 
do mail/exim* even need those variables?  Why aren't they just using 
${CPPFLAGS} and ${LDFLAGS}, which provide all of the compiler  and 
linker options that they'll need?  The "dance" that's done in those 
packages strikes me as being completely unnecessary, especially since 
the exim packages don't use configure scripts -- the entire configure 
step consists of doing a sed replacement of some makefile in the 
distribution.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>