1{ lib, stdenv, fetchFromGitHub, libpng, bison, flex, ffmpeg, icu }:
2
3stdenv.mkDerivation rec {
4 pname = "cfdg";
5 version = "3.3";
6 src = fetchFromGitHub {
7 owner = "MtnViewJohn";
8 repo = "context-free";
9 rev = "Version${version}";
10 sha256 = "13m8npccacmgxbs4il45zw53dskjh53ngv2nxahwqw8shjrws4mh";
11 };
12
13 nativeBuildInputs = [ bison flex ];
14 buildInputs = [ libpng ffmpeg icu ];
15
16 postPatch = ''
17 sed -e "/YY_NO_UNISTD/a#include <stdio.h>" -i src-common/cfdg.l
18 sed -e '1i#include <algorithm>' -i src-common/{cfdg,builder,ast}.cpp
19 '';
20
21 installPhase = ''
22 runHook preInstall
23
24 mkdir -p $out/bin
25 cp cfdg $out/bin/
26
27 mkdir -p $out/share/doc/${pname}-${version}
28 cp *.txt $out/share/doc/${pname}-${version}
29
30 runHook postInstall
31 '';
32
33 meta = with lib; {
34 description = "Context-free design grammar - a tool for graphics generation";
35 maintainers = with maintainers; [ raskin ];
36 platforms = platforms.linux;
37 homepage = "https://contextfreeart.org/";
38 license = licenses.gpl2Only;
39 };
40}