Subject: BUILDLINK_LDADD linker flags in db*/buildlink3.mk
To: None <tech-pkg@NetBSD.org>
From: grant beattie <grant@NetBSD.org>
List: tech-pkg
Date: 07/12/2005 15:31:13
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.
I'm unsure whether there are other packages affected by the same
issue, but given the nature of it, I suspect there are.
grant.
Index: db/buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/databases/db/buildlink3.mk,v
retrieving revision 1.19
diff -u -r1.19 buildlink3.mk
--- db/buildlink3.mk 15 Nov 2004 17:54:49 -0000 1.19
+++ db/buildlink3.mk 12 Jul 2005 05:26:08 -0000
@@ -17,7 +17,7 @@
BUILDLINK_RECOMMENDED.db2+= db>=2.7.7nb2
BUILDLINK_PKGSRCDIR.db2?= ../../databases/db
BUILDLINK_INCDIRS.db2?= include/db2
-BUILDLINK_LDADD.db2= -ldb2
+BUILDLINK_LDADD.db2= -ldb2 -L${BUILDLINK_PREFIX.db}/lib ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.db}/lib
. if defined(USE_DB185) && !empty(USE_DB185:M[yY][eE][sS])
BUILDLINK_LIBS.db2= ${BUILDLINK_LDADD.db2}
Index: db3/buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/databases/db3/buildlink3.mk,v
retrieving revision 1.16
diff -u -r1.16 buildlink3.mk
--- db3/buildlink3.mk 15 Nov 2004 17:54:49 -0000 1.16
+++ db3/buildlink3.mk 12 Jul 2005 05:26:08 -0000
@@ -17,7 +17,7 @@
BUILDLINK_RECOMMENDED.db3+= db3>=3.11.2nb3
BUILDLINK_PKGSRCDIR.db3?= ../../databases/db3
BUILDLINK_INCDIRS.db3?= include/db3
-BUILDLINK_LDADD.db3= -ldb3
+BUILDLINK_LDADD.db3= -ldb3 -L${BUILDLINK_PREFIX.db3}/lib ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.db3}/lib
BUILDLINK_TRANSFORM+= l:db-3:db3
. if defined(USE_DB185) && !empty(USE_DB185:M[yY][eE][sS])
Index: db4/buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/databases/db4/buildlink3.mk,v
retrieving revision 1.23
diff -u -r1.23 buildlink3.mk
--- db4/buildlink3.mk 17 Nov 2004 18:47:19 -0000 1.23
+++ db4/buildlink3.mk 12 Jul 2005 05:26:08 -0000
@@ -17,7 +17,7 @@
BUILDLINK_RECOMMENDED.db4+= db4>=4.2.52nb7
BUILDLINK_PKGSRCDIR.db4?= ../../databases/db4
BUILDLINK_INCDIRS.db4?= include/db4
-BUILDLINK_LDADD.db4= -ldb4
+BUILDLINK_LDADD.db4= -ldb4 -L${BUILDLINK_PREFIX.db4}/lib ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.db4}/lib
BUILDLINK_TRANSFORM+= l:db-4:db4
. if defined(USE_DB185) && !empty(USE_DB185:M[yY][eE][sS])