From owner-freebsd-ports@FreeBSD.ORG Thu Nov 6 03:44:21 2003 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E546516A4CE for ; Thu, 6 Nov 2003 03:44:21 -0800 (PST) Received: from mail.dt.e-technik.uni-dortmund.de (mail.dt.e-technik.Uni-Dortmund.DE [129.217.163.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7BB1843F75 for ; Thu, 6 Nov 2003 03:44:20 -0800 (PST) (envelope-from ma@dt.e-technik.uni-dortmund.de) Received: from m2a2.dyndns.org (krusty.dt.e-technik.uni-dortmund.de [129.217.163.1])7290313EC0 for ; Thu, 6 Nov 2003 12:44:19 +0100 (CET) Received: by merlin.emma.line.org (Postfix, from userid 500) id 227CF9A180; Thu, 6 Nov 2003 12:44:18 +0100 (CET) To: freebsd-ports@freebsd.org From: Matthias Andree Date: Thu, 06 Nov 2003 12:44:18 +0100 Message-ID: User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: RFC: FreeBSD DB Port Reform X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2003 11:44:22 -0000 Hi, I am planning to reform the way the BerkeleyDB 3, 4 and 4.1 ports are currently laid out, to reduce the mess that a BDB dependent port leaves in Makefile and files/patch-*. This will involve changes to all BerkeleyDB dependent ports! I have a web site on this topic with preview tarballs of the new ports, http://mandree.home.pages.de/freebsd-db-reform/ Here is the lynx dump of the web site: ---------------------------------------------------------------------------- The FreeBSD BerkeleyDB Port Reform [1]Matthias Andree Revision: $Id: index.html,v 0.1 2003/11/06 11:24:33 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. Remove db2 port (move it into the Attic). According to INDEX, not a single port depends on it. 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. 3. for db3, db4 and db41, the following changes are made: 1. all programs move into $PREFIX/BerkeleyDB.N.M/bin/db_* 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 or 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. 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. 6. documentation moves into $PREFIX/share/doc/BerkeleyDB.N.M and is symlinked from $PREFIX/BerkeleyDB.N.M/docs 7. 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. 4. Dependent ports will have to be updated and recompiled, this will need the help of original maintainers. 5. db2 references will be removed, the WITH_BDB_VER stuff will be updated to the new port directory layout, will be unified across all ports (so no WITH_BDB4 games as some Ruby ports do) so that it can move into Mk/bsd.ports.mk 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 [2]Port tarballs for preview are here. Comments are solicited. References 1. mailto:matthias.andree@gmx.de?subject=FreeBSD+BDB+reform 2. http://mandree.home.pages.de/freebsd-db-reform/ports/ ---------------------------------------------------------------------------- -- Matthias Andree Encrypt your mail: my GnuPG key ID is 0x052E7D95