aboutsummaryrefslogtreecommitdiff
path: root/nix/tcc.nix
blob: cd4cf27d9bddc3685f65a8e1b7693ff421917e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ stdenv, fetchgit, musl, linuxHeaders }:

stdenv.mkDerivation {
	name = "tcc-yerba";
	src = fetchgit {
		url = "https://repo.or.cz/tinycc.git";
		rev = "34eed88a";
		hash = "nix will yell at me but then i fix it";
	};

	configureFlags = [
		"--cc=gcc"
		"--ar=ar"
		"--config-musl"
		"--crtprefix=${musl}/lib"
		"--sysincludepaths=${linuxHeaders}/include:{B}/include"
		"--libpaths=${musl}/lib"
	];

	buildPhase = ''
		make -j$NIX_BUILD_CORES
	'';

	installPhase = ''
		mkdir -p $out/bin $out/lib 
		cp tcc $out/bin/
		cp libtcc.a $out/lib/ 2>/dev/null || true
	'';
}