1{ lib, stdenv, fetchurl, gettext, emacs }:
2
3stdenv.mkDerivation rec {
4 pname = "cflow";
5 version = "1.7";
6
7 src = fetchurl {
8 url = "mirror://gnu/${pname}/${pname}-${version}.tar.bz2";
9 sha256 = "sha256-0BFGyvkAHiZhM0F8KoJYpktfwW/LCCoU9lKCBNDJcIY=";
10 };
11
12 patchPhase = ''
13 substituteInPlace "src/cflow.h" \
14 --replace "/usr/bin/cpp" \
15 "$(cat ${stdenv.cc}/nix-support/orig-cc)/bin/cpp"
16 '';
17
18 buildInputs = [ gettext ] ++
19 # We don't have Emacs/GTK/etc. on {Dar,Cyg}win.
20 lib.optional
21 (! (lib.lists.any (x: stdenv.hostPlatform.system == x)
22 [ "i686-cygwin" ]))
23 emacs;
24
25 doCheck = true;
26
27 meta = with lib; {
28 description = "Tool to analyze the control flow of C programs";
29 mainProgram = "cflow";
30
31 longDescription = ''
32 GNU cflow analyzes a collection of C source files and prints a
33 graph, charting control flow within the program.
34
35 GNU cflow is able to produce both direct and inverted flowgraphs
36 for C sources. Optionally a cross-reference listing can be
37 generated. Two output formats are implemented: POSIX and GNU
38 (extended).
39
40 The package also provides Emacs major mode for examining the
41 produced flowcharts in Emacs.
42 '';
43
44 license = licenses.gpl3Plus;
45
46 homepage = "https://www.gnu.org/software/cflow/";
47
48 maintainers = [ ];
49
50 platforms = platforms.linux ++ platforms.darwin;
51 };
52}