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
30 longDescription = ''
31 GNU cflow analyzes a collection of C source files and prints a
32 graph, charting control flow within the program.
33
34 GNU cflow is able to produce both direct and inverted flowgraphs
35 for C sources. Optionally a cross-reference listing can be
36 generated. Two output formats are implemented: POSIX and GNU
37 (extended).
38
39 The package also provides Emacs major mode for examining the
40 produced flowcharts in Emacs.
41 '';
42
43 license = licenses.gpl3Plus;
44
45 homepage = "https://www.gnu.org/software/cflow/";
46
47 maintainers = [ maintainers.vrthra ];
48
49 platforms = platforms.linux ++ platforms.darwin;
50 };
51}