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