1{ stdenv, fetchurl, perl, texinfo }:
2
3assert stdenv ? glibc;
4
5stdenv.mkDerivation rec {
6 name = "tcc-0.9.26";
7
8 src = fetchurl {
9 url = "mirror://savannah/tinycc/${name}.tar.bz2";
10 sha256 = "0wbdbdq6090ayw8bxnbikiv989kykff3m5rzbia05hrnwhd707jj";
11 };
12
13 nativeBuildInputs = [ perl texinfo ];
14
15 postPatch = ''
16 substituteInPlace "texi2pod.pl" \
17 --replace "/usr/bin/perl" "${perl}/bin/perl"
18 '';
19
20 preConfigure = ''
21 configureFlagsArray+=("--elfinterp=$(cat $NIX_CC/nix-support/dynamic-linker)")
22 configureFlagsArray+=("--crtprefix=${stdenv.glibc}/lib")
23 configureFlagsArray+=("--sysincludepaths=${stdenv.glibc}/include:{B}/include")
24 configureFlagsArray+=("--libpaths=${stdenv.glibc}/lib")
25 '';
26
27 doCheck = true;
28 checkTarget = "test";
29
30 meta = {
31 description = "Small, fast, and embeddable C compiler and interpreter";
32
33 longDescription =
34 '' TinyCC (aka TCC) is a small but hyper fast C compiler. Unlike
35 other C compilers, it is meant to be self-sufficient: you do not
36 need an external assembler or linker because TCC does that for
37 you.
38
39 TCC compiles so fast that even for big projects Makefiles may not
40 be necessary.
41
42 TCC not only supports ANSI C, but also most of the new ISO C99
43 standard and many GNU C extensions.
44
45 TCC can also be used to make C scripts, i.e. pieces of C source
46 that you run as a Perl or Python script. Compilation is so fast
47 that your script will be as fast as if it was an executable.
48
49 TCC can also automatically generate memory and bound checks while
50 allowing all C pointers operations. TCC can do these checks even
51 if non patched libraries are used.
52
53 With libtcc, you can use TCC as a backend for dynamic code
54 generation.
55 '';
56
57 homepage = http://www.tinycc.org/;
58 license = stdenv.lib.licenses.lgpl2Plus;
59
60 platforms = stdenv.lib.platforms.unix;
61 maintainers = [ ];
62 };
63}