2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, lib, fetchurl }:
|
2020-10-11 12:50:04 +00:00
|
|
|
let
|
|
|
|
isCross = stdenv.buildPlatform != stdenv.hostPlatform;
|
|
|
|
cross = "${stdenv.hostPlatform.config}";
|
|
|
|
static = stdenv.hostPlatform.isStatic;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-11 12:50:04 +00:00
|
|
|
cc = if !isCross then "cc" else "${cross}-cc";
|
|
|
|
ar = if !isCross then "ar" else "${cross}-ar";
|
|
|
|
ranlib = if !isCross then "ranlib" else "${cross}-ranlib";
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's,set --, set -x; set --,' Makefile
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "tinycdb";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "0.80";
|
2020-10-11 12:50:04 +00:00
|
|
|
# In general, static library (.a) goes to "dev", shared (.so) to
|
|
|
|
# "lib". In case of static build, there is no .so library, so "lib"
|
|
|
|
# output is useless and empty.
|
|
|
|
outputs = [ "out" "dev" "man" ] ++ lib.optional (!static) "lib";
|
2020-04-24 23:36:52 +00:00
|
|
|
separateDebugInfo = true;
|
2020-10-11 12:50:04 +00:00
|
|
|
makeFlags =
|
|
|
|
[ "prefix=$(out)" "CC=${cc}" "AR=${ar}" "RANLIB=${ranlib}" "static"
|
|
|
|
] ++ lib.optional (!static) "shared";
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
2020-10-11 12:50:04 +00:00
|
|
|
mkdir -p $dev/lib $out/bin
|
2020-04-24 23:36:52 +00:00
|
|
|
mv $out/lib/libcdb.a $dev/lib
|
|
|
|
rmdir $out/lib
|
2020-10-11 12:50:04 +00:00
|
|
|
'' + (if static then ''
|
|
|
|
cp cdb $out/bin/cdb
|
|
|
|
'' else ''
|
|
|
|
mkdir -p $lib/lib
|
|
|
|
cp libcdb.so* $lib/lib
|
|
|
|
cp cdb-shared $out/bin/cdb
|
|
|
|
'');
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.corpit.ru/mjt/tinycdb/${pname}-${version}.tar.gz";
|
2023-10-19 13:55:26 +00:00
|
|
|
sha256 = "sha256-wyG5BekCwsqZo/+Kjd39iCMkf+Ht7IpLuF+Dhpxjn7g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
|
|
|
|
description = "utility to manipulate constant databases (cdb)";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "cdb";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
tinycdb is a small, fast and reliable utility and subroutine
|
|
|
|
library for creating and reading constant databases. The database
|
|
|
|
structure is tuned for fast reading.
|
2020-10-11 12:50:04 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
homepage = "https://www.corpit.ru/mjt/tinycdb.html";
|
|
|
|
license = licenses.publicDomain;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|