RFC: FreeBSD DB Port Reform

Matthias Andree matthias.andree at gmx.de
Thu Nov 6 06:19:28 PST 2003

On Thu, 06 Nov 2003, Oliver Eikemeier wrote:

> >    2. bsd.ports.mk should be extended to support WITH_BDB_VER,
> >       USE_BDB_VER or WANT_BDB_VER or something that presets a set of
> >       variables, for instance BDB_VERSION, BDB_INCLUDES, BDB_LIBNAME,
> >       BDB_LIBPATH and LIB_DEPENDS, to lift shared code out of the
> >       individual ports into bsd.ports.mk.
> No WITH_* options in bsd.ports.mk, they are supposed to use as make 
> arguments
> to communicate user => port.

WITH_BDB_VER was removed from the draft.

> >    3. for db3, db4 and db41, the following changes are made:
> >         1. all programs move into $PREFIX/BerkeleyDB.N.M/bin/db_*
> That violates hier(7). How about moving them to libexec?

It's a bit difficult. We have three db_dump variants that all link
against different libraries, but that have the same name. We could,
alternatively, symlink those from $PREFIX/BerkeleyDB.N.M/bin/db_* to

> >         4. all libraries move into $PREFIX/BerkeleyDB.N.M/lib, because
> >            BerkeleyDB installs not only libdb-N.M* but also libdb-N* and
> >            libdb* (where * is .so.N, .so or .a), which cannot work in
> >            the same path.
> Same as above. How about lib/db-N.M?

Berkeley documentation recommends including db.h (so the port adds
-I...) and linking with -ldb (so the port adds

My ultimate goal is to get rid of all FreeBSD-specific patches. If we
don't have a libdb.so in a distinct directory, we'll again need to patch
or ${REINPLACE_CMD} Makefiles, which this reform is trying to address.

> >         6. documentation moves into $PREFIX/share/doc/BerkeleyDB.N.M and
> >            is symlinked from $PREFIX/BerkeleyDB.N.M/docs
> The symlink should not be necessary.

Documentation will remain in the default $PREFIX/share/doc/${PORTNAME}
for compatibility.

> Could you explain stupid people like me again what you gain by not simply
> renaming the libraries to libdb-3.3, libdb-4.0 and libdb-4.1 and leaving
> the other stuff as it is now?

That is what we'll see in /usr/local/lib/: the SONAMEs. The
documentation however suggests linking against libdb.so, by using -ldb.

We'd need some mechanism to allow applications (remember, they are
provided by third parties) continue to use -ldb, by just adding
LDFLAGS=-L/usr/local/BerkeleyDB-N.M/lib. Using LIBS=-ldb-4.1 doesn't
work universally.

> IMHO ports that expect a BerkeleyDB.N.M directory under /usr/local violate
> hier(7), and does this approach work with the ldconfig -r LIB_DEPENDS 
> checking
> we have in bsd.port.mk?

The /usr/local/BerkeleyDB.N.M/lib directory's use is relevant at build

Of course, we can drop support for db2, db3, db4 instead and mark all
ports that don't support db41 as broken. But that's even more intrusive
than my suggestion.

Thanks for your comments. A new 0.2 version of the document has been
posted, the ports are unchanged from the first draft.

Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95

More information about the freebsd-ports mailing list