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