1{ stdenv, lib, buildPlatform, fetchurl }:
2
3stdenv.mkDerivation rec {
4 name = "gdbm-1.14";
5
6 src = fetchurl {
7 url = "mirror://gnu/gdbm/${name}.tar.gz";
8 sha256 = "02dakgrq93xwgln8qfv3vs5jyz5yvds5nyzkx6rhg9v585x478dd";
9 };
10
11 doCheck = true; # not cross;
12
13 # Linking static stubs on cygwin requires correct ordering.
14 # Consider upstreaming this.
15
16 # Disable dbmfetch03.at test because it depends on unlink()
17 # failing on a link in a chmod -w directory, which cygwin
18 # apparently allows.
19 postPatch = lib.optionalString buildPlatform.isCygwin ''
20 substituteInPlace tests/Makefile.in --replace \
21 '_LDADD = ../src/libgdbm.la ../compat/libgdbm_compat.la' \
22 '_LDADD = ../compat/libgdbm_compat.la ../src/libgdbm.la'
23 substituteInPlace tests/testsuite.at --replace \
24 'm4_include([dbmfetch03.at])' ""
25 '';
26 configureFlags = [ "--enable-libgdbm-compat" ];
27
28 postInstall = ''
29 # create symlinks for compatibility
30 install -dm755 $out/include/gdbm
31 (
32 cd $out/include/gdbm
33 ln -s ../gdbm.h gdbm.h
34 ln -s ../ndbm.h ndbm.h
35 ln -s ../dbm.h dbm.h
36 )
37 '';
38
39 meta = with lib; {
40 description = "GNU dbm key/value database library";
41
42 longDescription =
43 '' GNU dbm (or GDBM, for short) is a library of database functions that
44 use extensible hashing and work similar to the standard UNIX dbm.
45 These routines are provided to a programmer needing to create and
46 manipulate a hashed database.
47
48 The basic use of GDBM is to store key/data pairs in a data file.
49 Each key must be unique and each key is paired with only one data
50 item.
51
52 The library provides primitives for storing key/data pairs,
53 searching and retrieving the data by its key and deleting a key
54 along with its data. It also support sequential iteration over all
55 key/data pairs in a database.
56
57 For compatibility with programs using old UNIX dbm function, the
58 package also provides traditional dbm and ndbm interfaces.
59 '';
60
61 homepage = http://www.gnu.org/software/gdbm/;
62 license = licenses.gpl3Plus;
63 platforms = platforms.all;
64 maintainers = [ maintainers.vrthra ];
65 };
66}