at 17.09-beta 2.3 kB view raw
1{ stdenv, fetchFromRepoOrCz, perl, texinfo }: 2with stdenv.lib; 3 4let 5 date = "20170710"; 6 version = "0.9.27pre-${date}"; 7 rev = "2acb04f7f2077a4cff103421d79ceee48441918a"; 8 sha256 = "1rh89dx1myqfm752d4rlzrm8aadfm17fm88ps0q9ibmbxavb45qw"; 9in 10 11stdenv.mkDerivation rec { 12 name = "tcc-${version}"; 13 14 src = fetchFromRepoOrCz { 15 repo = "tinycc"; 16 inherit rev; 17 inherit sha256; 18 }; 19 20 nativeBuildInputs = [ perl texinfo ]; 21 22 hardeningDisable = [ "fortify" ]; 23 24 postPatch = '' 25 substituteInPlace "texi2pod.pl" \ 26 --replace "/usr/bin/perl" "${perl}/bin/perl" 27 ''; 28 29 preConfigure = '' 30 echo ${version} > VERSION 31 32 configureFlagsArray+=("--cc=cc") 33 configureFlagsArray+=("--elfinterp=$(< $NIX_CC/nix-support/dynamic-linker)") 34 configureFlagsArray+=("--crtprefix=${getLib stdenv.cc.libc}/lib") 35 configureFlagsArray+=("--sysincludepaths=${getDev stdenv.cc.libc}/include:{B}/include") 36 configureFlagsArray+=("--libpaths=${getLib stdenv.cc.libc}/lib") 37 ''; 38 39 doCheck = true; 40 checkTarget = "test"; 41 42 postFixup = '' 43 paxmark m $out/bin/tcc 44 ''; 45 46 meta = { 47 description = "Small, fast, and embeddable C compiler and interpreter"; 48 49 longDescription = '' 50 TinyCC (aka TCC) is a small but hyper fast C compiler. Unlike 51 other C compilers, it is meant to be self-sufficient: you do not 52 need an external assembler or linker because TCC does that for 53 you. 54 55 TCC compiles so fast that even for big projects Makefiles may not 56 be necessary. 57 58 TCC not only supports ANSI C, but also most of the new ISO C99 59 standard and many GNU C extensions. 60 61 TCC can also be used to make C scripts, i.e. pieces of C source 62 that you run as a Perl or Python script. Compilation is so fast 63 that your script will be as fast as if it was an executable. 64 65 TCC can also automatically generate memory and bound checks while 66 allowing all C pointers operations. TCC can do these checks even 67 if non patched libraries are used. 68 69 With libtcc, you can use TCC as a backend for dynamic code 70 generation. 71 ''; 72 73 homepage = http://www.tinycc.org/; 74 license = licenses.mit; 75 76 platforms = [ "x86_64-linux" ]; 77 maintainers = [ maintainers.joachifm ]; 78 }; 79}