nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 77 lines 1.8 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5}: 6let 7 isCross = stdenv.buildPlatform != stdenv.hostPlatform; 8 cross = "${stdenv.hostPlatform.config}"; 9 static = stdenv.hostPlatform.isStatic; 10 11 cc = if !isCross then "cc" else "${cross}-cc"; 12 ar = if !isCross then "ar" else "${cross}-ar"; 13 ranlib = if !isCross then "ranlib" else "${cross}-ranlib"; 14in 15stdenv.mkDerivation rec { 16 postPatch = '' 17 sed -i 's,set --, set -x; set --,' Makefile 18 ''; 19 pname = "tinycdb"; 20 version = "0.80"; 21 # In general, static library (.a) goes to "dev", shared (.so) to 22 # "lib". In case of static build, there is no .so library, so "lib" 23 # output is useless and empty. 24 outputs = [ 25 "out" 26 "dev" 27 "man" 28 ] 29 ++ lib.optional (!static) "lib"; 30 separateDebugInfo = true; 31 makeFlags = [ 32 "prefix=$(out)" 33 "CC=${cc}" 34 "AR=${ar}" 35 "RANLIB=${ranlib}" 36 "static" 37 ] 38 ++ lib.optional (!static) "shared"; 39 postInstall = '' 40 mkdir -p $dev/lib $out/bin 41 mv $out/lib/libcdb.a $dev/lib 42 rmdir $out/lib 43 '' 44 + ( 45 if static then 46 '' 47 cp cdb $out/bin/cdb 48 '' 49 else 50 '' 51 mkdir -p $lib/lib 52 cp libcdb.so* $lib/lib 53 cp cdb-shared $out/bin/cdb 54 '' 55 ); 56 57 src = fetchurl { 58 url = "http://www.corpit.ru/mjt/tinycdb/${pname}-${version}.tar.gz"; 59 sha256 = "sha256-wyG5BekCwsqZo/+Kjd39iCMkf+Ht7IpLuF+Dhpxjn7g="; 60 }; 61 62 meta = with lib; { 63 64 description = "Utility to manipulate constant databases (cdb)"; 65 mainProgram = "cdb"; 66 67 longDescription = '' 68 tinycdb is a small, fast and reliable utility and subroutine 69 library for creating and reading constant databases. The database 70 structure is tuned for fast reading. 71 ''; 72 73 homepage = "https://www.corpit.ru/mjt/tinycdb.html"; 74 license = licenses.publicDomain; 75 platforms = platforms.linux; 76 }; 77}