8.47. GDBM-1.24

The GDBM package contains the GNU Database Manager. It is a library of database functions that uses extensible hashing and works like the standard UNIX dbm. The library provides primitives for storing key/data pairs, searching and retrieving the data by its key and deleting a key along with its data.

Approximate build time: less than 0.1 SBU
Required disk space: 13 MB

8.47.1. Installation of GDBM

Create the PKGBUILD for the GDBM package with the following commands:

mkdir /sources/gdbm
cd /sources/gdbm
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="gdbm"
pkgver="1.24"
pkgrel="1"
pkgdesc="The GDBM package contains the GNU Database Manager."
arch=('x86'
      'x86_64')
url="https://www.gnu.org/software/gdbm/"
license=('GPLv3')
groups=('core')
depends=('bash'
         'glibc'
         'readline'
         'rootfs')
makedepends=('binutils'
             'coreutils'
             'diffutils'
             'gcc'
             'grep'
             'make'
             'sed')
source=('https://ftp.gnu.org/gnu/gdbm/gdbm-1.24.tar.gz')
md5sums=('c780815649e52317be48331c1773e987')
    
build(){
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr    \
              --disable-static \
              --enable-libgdbm-compat
  make
}

check(){
  cd ${pkgname}-${pkgver}
  make check
}

package(){
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
REALEOF

The meaning of the configure option:

--enable-libgdbm-compat

This switch enables building the libgdbm compatibility library. Some packages outside of LFS may require the older DBM routines it provides.

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp gdbm-1.24-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/gdbm-1.24-1-$(uname -m).pkg.tar.xz

Update the local cache and install the GDBM package:

pacman -Syu
pacman -S gdbm --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/gdbm
cp PKGBUILD /srv/pacman/source/LFS/gdbm
cd /sources
rm -rf gdbm

8.47.2. Contents of GDBM

Installed programs: gdbm_dump, gdbm_load, and gdbmtool
Installed libraries: libgdbm.so and libgdbm_compat.so

Short Descriptions

gdbm_dump

Dumps a GDBM database to a file

gdbm_load

Recreates a GDBM database from a dump file

gdbmtool

Tests and modifies a GDBM database

libgdbm

Contains functions to manipulate a hashed database

libgdbm_compat

Compatibility library containing older DBM functions