nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchurl,
4 stdenv,
5 testers,
6 updateAutotoolsGnuConfigScriptsHook,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "gdbm";
11 version = "1.26";
12
13 src = fetchurl {
14 url = "mirror://gnu/gdbm/gdbm-${finalAttrs.version}.tar.gz";
15 hash = "sha256-aiRQShTeSnRBA9y5Nr6Xbfb76IzP8mBl5UwcR5RvSl4=";
16 };
17
18 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
19
20 hardeningDisable = [ "strictflexarrays3" ];
21
22 configureFlags = [ (lib.enableFeature true "libgdbm-compat") ];
23
24 outputs = [
25 "out"
26 "dev"
27 "info"
28 "lib"
29 "man"
30 ];
31
32 doCheck = true;
33
34 enableParallelBuilding = true;
35
36 # 1. Linking static stubs on cygwin requires correct ordering. Consider
37 # upstreaming this.
38 #
39 # 2. Disable dbmfetch03.at test because it depends on unlink() failing on a
40 # link in a chmod -w directory, which cygwin apparently allows.
41 postPatch = lib.optionalString stdenv.buildPlatform.isCygwin ''
42 substituteInPlace tests/Makefile.in \
43 --replace-fail '_LDADD = ../src/libgdbm.la ../compat/libgdbm_compat.la' \
44 '_LDADD = ../compat/libgdbm_compat.la ../src/libgdbm.la'
45 substituteInPlace tests/testsuite.at
46 --replace-fail 'm4_include([dbmfetch03.at])' ""
47 '';
48
49 # create symlinks for compatibility
50 postInstall = ''
51 install -dm755 ''${!outputDev}/include/gdbm
52 pushd ''${!outputDev}/include/gdbm
53 ln -s ../dbm.h dbm.h
54 ln -s ../gdbm.h gdbm.h
55 ln -s ../ndbm.h ndbm.h
56 popd
57 '';
58
59 passthru = {
60 tests.version = testers.testVersion {
61 package = finalAttrs.finalPackage;
62 command = "gdbmtool --version";
63 };
64 };
65
66 meta = {
67 homepage = "https://www.gnu.org/software/gdbm/";
68 description = "GNU dbm key/value database library";
69 longDescription = ''
70 GNU dbm (or GDBM, for short) is a library of database functions that use
71 extensible hashing and work similar to the standard UNIX dbm. These
72 routines are provided to a programmer needing to create and manipulate a
73 hashed database.
74
75 The basic use of GDBM is to store key/data pairs in a data file. Each
76 key must be unique and each key is paired with only one data item.
77
78 The library provides primitives for storing key/data pairs, searching and
79 retrieving the data by its key and deleting a key along with its data.
80 It also support sequential iteration over all key/data pairs in a
81 database.
82
83 For compatibility with programs using old UNIX dbm function, the package
84 also provides traditional dbm and ndbm interfaces.
85 '';
86 license = lib.licenses.gpl3Plus;
87 mainProgram = "gdbmtool";
88 maintainers = [ ];
89 platforms = lib.platforms.all;
90 };
91})