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