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