Date: Thu, 06 Nov 2003 15:33:22 +0100 From: Matthias Andree <ma@dt.e-technik.uni-dortmund.de> To: Oliver Eikemeier <eikemeier@fillmore-labs.com> Cc: freebsd-ports@freebsd.org Subject: Re: RFC: FreeBSD DB Port Reform - rev. 0.4 Message-ID: <m3ekwlpnwt.fsf_-_@merlin.emma.line.org> In-Reply-To: <3FAA3B77.7090002@fillmore-labs.com> (Oliver Eikemeier's message of "Thu, 06 Nov 2003 13:15:51 %2B0100") References: <m365hxoh65.fsf@merlin.emma.line.org> <3FAA3B77.7090002@fillmore-labs.com>
next in thread | previous in thread | raw e-mail | index | archive | help
The FreeBSD BerkeleyDB Port Reform Matthias Andree Revision: $Id: index.html,v 0.4 2003/11/06 14:30:55 emma Exp emma $ Introduction The current databases/db* ports are a mess. They use nonstandard library names that require porters to ship a lot of FreeBSD files/patch-* patches to make the port compile with the non-canonical layout. I believe the layout has historical reasons in a.out. ELF, with its SONAME feature, allows for a more elegant and standard-conforming layout that allows us to drop FreeBSD specific patches from the ports. Background information * Any ELF shared object (library), seen as .so file, bears an "SONAME" tag that can be made visible with "readelf -d FILENAME" and that needs not match the file name (it often does, see below). * Any ELF executable that links against shared object bears a corresponding "NEEDED" tag. A link time, here is recorded the SONAME of the .so file linked against, not the file name. Example: Linking a program with -L/usr/local/BerkeleyDB.4.1 -ldb will insert a "NEEDED: libdb-4.1.so.1" trait into the program. The program will, at run time, automatically choose /usr/local/lib/libdb-4.1.so.1. This NEEDED information is also visible in "readelf -d FILENAME". * An ELF executable MAY have one or more "RPATH" tag that specifies exactly one shared object search path element. It allows to specify the link path in an executable, and saves the end user the hassle of editing ld.so.conf or LD_LIBRARY_PATH for non-default library paths. This is, you guessed it, visible in "readelf -d FILENAME". Action Plan 1. bsd.ports.mk should be extended to support 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. 2. for db3, db4 and db41, the following changes are made: 1. all programs move into $PREFIX/BerkeleyDB.N.M/bin/db_*. We will need to accomodate different versions with the same name. All other systems use $PREFIX/BerkeleyDB.N.M/bin. 2. programs will no longer be renamed to db41_* db4_* or db3_*. 3. all libraries maintain their official SleepyCat names, libdb-3.3, libdb-4.0, libdb-4.1, and will not be renamed to libdb3, libdb4 or libdb41 - this removes the need for a good deal of REINPLACE_CMD or patches. 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. Sleepycat recommends linking against -ldb or libdb.so, see http://www.sleepycat.com/docs/ref/build_unix/shlib.html. These libaries are relevant at link time. 5. a relative symbolic link from $PREFIX/lib/libdb-N.M.so.M to ../BerkeleyDB.N.M/lib/libdb-N.M.so.M (the SONAME, see above) is maintained. These are relevant at run time. 6. All BerkeleyDB distributions will be compiled with --with-uniquename, so that the same application can link two different DB versions without conflicts. It's not too common, but can happen indirectly through other libraries. See http://www.sleepycat.com/docs/ref/install/multiple.html for rationale. NOTE: This changes the ABI (but not the API), which means all applications will have to be recompiled and relinked. 7. documentation remains in $PREFIX/share/doc/dbNM (M omitted when 0). 3. Dependent ports will have to be updated and recompiled, this will need the help of original maintainers. 4. DB-2.7.7 ("databases/db2") will be subject to further discussion. Few ports depend on it (some of them are marked BROKEN on FreeBSD 5-CURRENT), some offer it as an alternative to db3, and it's generally viewed as "vintage" (Sleepycat wording) version and slow. Advantages * no more makefile file patching for the arcane layout. -ldb with proper LDFLAGS will "just work". * ports that use the official library names such as -ldb-3.3, ldb-4.0, ldb-4.1, will also "just work". * ports that have --with-db switches and expect a standard BerkeleyDB.N.M directory under /usr/local will also "just work". * Fewer FreeBSD-specific patches in the ports tree will be needed. Disadvantages All ports that depend on DB will have to be updated once. Preview Port tarballs for preview are here. Comments are solicited. These currently correspond to Revision 0.1 of this draft. History of this suggestion (from RCS) $Log: index.html,v $ Revision 0.4 2003/11/06 14:30:55 emma Fix up RCS tags in history :-( Revision 0.3 2003/11/06 14:28:16 emma Fix up RCS error of last version. No longer suggest DB-2 removal as some ports DO depend on it, but leave it for further discussion. Mention port tarballs correspond to version 0.1. Revision 0.2 2003/11/06 14:10:40 emma Remove WITH_BDB_VER, that is user <-> port communication namespace. Clarify why we need $PREFIX/BerkeleyDB.N.M/bin/db_*, link to http://www.sleepycat.com/docs/ref/build_unix/shlib.html. Mention $PREFIX/lib/libdb-N.M* are relevant at run time. Turn http://www.sleepycat.com/docs/ref/install/multiple.html into a link. Mention that documentation remains in $PREFIX/share/doc/dbNM. Add History section as <pre>$log</pre>. Turn RCS Id tag into <PRE>to avoid tidy from word wrapping it.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m3ekwlpnwt.fsf_-_>