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