1 { stdenv, lib, fetchurl }:
3 isCross = stdenv.buildPlatform != stdenv.hostPlatform;
4 cross = "${stdenv.hostPlatform.config}";
5 static = stdenv.hostPlatform.isStatic;
7 cc = if !isCross then "cc" else "${cross}-cc";
8 ar = if !isCross then "ar" else "${cross}-ar";
9 ranlib = if !isCross then "ranlib" else "${cross}-ranlib";
10 in stdenv.mkDerivation rec {
12 sed -i 's,set --, set -x; set --,' Makefile
16 # In general, static library (.a) goes to "dev", shared (.so) to
17 # "lib". In case of static build, there is no .so library, so "lib"
18 # output is useless and empty.
19 outputs = [ "out" "dev" "man" ] ++ lib.optional (!static) "lib";
20 separateDebugInfo = true;
22 [ "prefix=$(out)" "CC=${cc}" "AR=${ar}" "RANLIB=${ranlib}" "static"
23 ] ++ lib.optional (!static) "shared";
25 mkdir -p $dev/lib $out/bin
26 mv $out/lib/libcdb.a $dev/lib
28 '' + (if static then ''
32 cp libcdb.so* $lib/lib
33 cp cdb-shared $out/bin/cdb
37 url = "http://www.corpit.ru/mjt/tinycdb/${pname}-${version}.tar.gz";
38 sha256 = "sha256-wyG5BekCwsqZo/+Kjd39iCMkf+Ht7IpLuF+Dhpxjn7g=";
43 description = "utility to manipulate constant databases (cdb)";
46 tinycdb is a small, fast and reliable utility and subroutine
47 library for creating and reading constant databases. The database
48 structure is tuned for fast reading.
51 homepage = "https://www.corpit.ru/mjt/tinycdb.html";
52 license = licenses.publicDomain;
53 platforms = platforms.linux;