1{ stdenv, fetchFromGitHub, readline }:
2
3let version = "2015-05-04"; in
4stdenv.mkDerivation {
5 name = "picoc-${version}";
6
7 src = fetchFromGitHub {
8 sha256 = "01w3jwl0vn9fsmh7p20ad4nl9ljzgfn576yvncd9pk9frx3pd8y4";
9 rev = "4555e8456f020554bcac50751fbb9b36c7d8c13b";
10 repo = "picoc";
11 owner = "zsaleeba";
12 };
13
14 meta = with stdenv.lib; {
15 inherit version;
16 description = "Very small C interpreter for scripting";
17 longDescription = ''
18 PicoC is a very small C interpreter for scripting. It was originally
19 written as a script language for a UAV's on-board flight system. It's
20 also very suitable for other robotic, embedded and non-embedded
21 applications. The core C source code is around 3500 lines of code. It's
22 not intended to be a complete implementation of ISO C but it has all the
23 essentials. When compiled it only takes a few k of code space and is also
24 very sparing of data space. This means it can work well in small embedded
25 devices.
26 '';
27 homepage = https://github.com/zsaleeba/picoc;
28 downloadPage = https://code.google.com/p/picoc/downloads/list;
29 license = licenses.bsd3;
30 platforms = with platforms; linux;
31 maintainers = with maintainers; [ nckx ];
32 };
33
34 buildInputs = [ readline ];
35
36 postPatch = ''
37 substituteInPlace Makefile --replace '`svnversion -n`' "${version}"
38 '';
39
40 enableParallelBuilding = true;
41
42 # Tests are currently broken on i686 see
43 # http://hydra.nixos.org/build/24003763/nixlog/1
44 doCheck = if stdenv.isi686 then false else true;
45 checkTarget = "test";
46
47 installPhase = ''
48 install -Dm755 picoc $out/bin/picoc
49
50 mkdir -p $out/include
51 install -m644 *.h $out/include
52 '';
53}