1{
2 fetchurl,
3 lib,
4 stdenv,
5 ncurses,
6 emacsSupport ? true,
7 emacs,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "cscope";
12 version = "15.9";
13
14 src = fetchurl {
15 url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
16 sha256 = "0ngiv4aj3rr35k3q3wjx0y19gh7i1ydqa0cqip6sjwd8fph5ll65";
17 };
18
19 configureFlags = [ "--with-ncurses=${ncurses.dev}" ];
20
21 buildInputs = [ ncurses ];
22 nativeBuildInputs = lib.optional emacsSupport emacs;
23
24 postInstall = lib.optionalString emacsSupport ''
25 cd "contrib/xcscope"
26
27 sed -i "cscope-indexer" \
28 -"es|^PATH=.*$|PATH=\"$out/bin:\$PATH\"|g"
29 sed -i "xcscope.el" \
30 -"es|\"cscope-indexer\"|\"$out/libexec/cscope/cscope-indexer\"|g";
31
32 mkdir -p "$out/libexec/cscope"
33 cp "cscope-indexer" "$out/libexec/cscope"
34
35 mkdir -p "$out/share/emacs/site-lisp"
36 emacs --batch --eval '(byte-compile-file "xcscope.el")'
37 cp xcscope.el{,c} "$out/share/emacs/site-lisp"
38 '';
39
40 meta = {
41 description = "Developer's tool for browsing source code";
42
43 longDescription = ''
44 Cscope is a developer's tool for browsing source code. It has
45 an impeccable Unix pedigree, having been originally developed at
46 Bell Labs back in the days of the PDP-11. Cscope was part of
47 the official AT&T Unix distribution for many years, and has been
48 used to manage projects involving 20 million lines of code!
49 '';
50
51 license = "BSD-style";
52
53 homepage = "https://cscope.sourceforge.net/";
54
55 maintainers = [ ];
56
57 platforms = lib.platforms.unix;
58 };
59}