Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchurl }: 2let 3 isCross = stdenv.buildPlatform != stdenv.hostPlatform; 4 cross = "${stdenv.hostPlatform.config}"; 5 static = stdenv.hostPlatform.isStatic; 6 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"; 10in stdenv.mkDerivation rec { 11 postPatch = '' 12 sed -i 's,set --, set -x; set --,' Makefile 13 ''; 14 pname = "tinycdb"; 15 version = "0.78"; 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; 21 makeFlags = 22 [ "prefix=$(out)" "CC=${cc}" "AR=${ar}" "RANLIB=${ranlib}" "static" 23 ] ++ lib.optional (!static) "shared"; 24 postInstall = '' 25 mkdir -p $dev/lib $out/bin 26 mv $out/lib/libcdb.a $dev/lib 27 rmdir $out/lib 28 '' + (if static then '' 29 cp cdb $out/bin/cdb 30 '' else '' 31 mkdir -p $lib/lib 32 cp libcdb.so* $lib/lib 33 cp cdb-shared $out/bin/cdb 34 ''); 35 36 src = fetchurl { 37 url = "http://www.corpit.ru/mjt/tinycdb/${pname}-${version}.tar.gz"; 38 sha256 = "0g6n1rr3lvyqc85g6z44lw9ih58f2k1i3v18yxlqvnla5m1qyrsh"; 39 }; 40 41 meta = with lib; { 42 43 description = "utility to manipulate constant databases (cdb)"; 44 45 longDescription = '' 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. 49 ''; 50 51 homepage = "https://www.corpit.ru/mjt/tinycdb.html"; 52 license = licenses.publicDomain; 53 platforms = platforms.linux; 54 }; 55}