gnu: the-silver-searcher: Update to 2.1.0.
[jackhill/guix/guix.git] / gnu / packages / code.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
8 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
9 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages code)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system cmake)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages cpp)
36 #:use-module (gnu packages databases)
37 #:use-module (gnu packages emacs)
38 #:use-module (gnu packages gcc)
39 #:use-module (gnu packages pcre)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages texinfo)
43 #:use-module (gnu packages autogen)
44 #:use-module (gnu packages ncurses)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages llvm)
47 #:use-module (gnu packages lua)
48 #:use-module (gnu packages bash))
49
50 ;;; Tools to deal with source code: metrics, cross-references, etc.
51
52 (define-public cflow
53 (package
54 (name "cflow")
55 (version "1.5")
56 (source (origin
57 (method url-fetch)
58 (uri (string-append "mirror://gnu/cflow/cflow-"
59 version ".tar.bz2"))
60 (sha256
61 (base32
62 "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
63 (build-system gnu-build-system)
64
65 ;; Needed to have cflow-mode.el installed.
66 (native-inputs `(("emacs" ,emacs-minimal)))
67 (arguments
68 '(#:configure-flags (list (string-append "CPPFLAGS="
69 "-D" "CFLOW_PREPROC=\\\""
70 (assoc-ref %build-inputs "gcc")
71 "/bin/cpp\\\""))))
72 (home-page "https://www.gnu.org/software/cflow/")
73 (synopsis "Create a graph of control flow within a program")
74 (description
75 "GNU cflow analyzes C source files and produces a graph charting the
76 control flow of the program. It can output the graph in several styles and
77 in either the POSIX format or in an extended GNU format. cflow also includes
78 a major mode for Emacs for examining the flowcharts that it produces.")
79 (license license:gpl3+)))
80
81 (define-public complexity
82 (package
83 (name "complexity")
84 (version "1.10")
85 (source (origin
86 (method url-fetch)
87 (uri (string-append "mirror://gnu/complexity/complexity-"
88 version ".tar.xz"))
89 (sha256
90 (base32
91 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
92 (build-system gnu-build-system)
93 (native-inputs
94 `(("texinfo" ,texinfo)
95 ("autogen" ,autogen)))
96 (home-page "https://www.gnu.org/software/complexity/")
97 (synopsis "Analyze complexity of C functions")
98 (description
99 "GNU complexity provides tools for finding procedures that are
100 convoluted, overly long or otherwise difficult to understand. This
101 may help in learning or reviewing unfamiliar code or perhaps
102 highlighting your own code that seemed comprehensible when you wrote it.")
103 (license license:gpl3+)))
104
105 (define-public global ; a global variable
106 (package
107 (name "global")
108 (version "6.6.1")
109 (source (origin
110 (method url-fetch)
111 (uri (string-append "mirror://gnu/global/global-"
112 version ".tar.gz"))
113 (sha256
114 (base32
115 "1r2r6z41lmgbszzwx7h3jqhwnqb9jj32pndzhr3lb0id710c8gcl"))))
116 (build-system gnu-build-system)
117 (inputs `(("ncurses" ,ncurses)
118 ("libltdl" ,libltdl)
119 ("sqlite" ,sqlite)))
120 (arguments
121 `(#:configure-flags
122 (list (string-append "--with-ncurses="
123 (assoc-ref %build-inputs "ncurses"))
124 (string-append "--with-sqlite3="
125 (assoc-ref %build-inputs "sqlite")))
126
127 #:phases
128 (modify-phases %standard-phases
129 (add-after 'install 'post-install
130 (lambda* (#:key outputs #:allow-other-keys)
131 ;; Install the Emacs Lisp file in the right place.
132 (let* ((out (assoc-ref outputs "out"))
133 (data (string-append out "/share/gtags"))
134 (lisp (string-append out "/share/emacs/site-lisp")))
135 (install-file (string-append data "/gtags.el") lisp)
136 (delete-file (string-append data "/gtags.el"))
137 #t))))))
138 (home-page "https://www.gnu.org/software/global/")
139 (synopsis "Cross-environment source code tag system")
140 (description
141 "GLOBAL is a source code tagging system that functions in the same way
142 across a wide array of environments, such as different text editors, shells
143 and web browsers. The resulting tags are useful for quickly moving around in
144 a large, deeply nested project.")
145 (license license:gpl3+)))
146
147 (define-public sloccount
148 (package
149 (name "sloccount")
150 (version "2.26")
151 (source (origin
152 (method url-fetch)
153 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
154 version ".tar.gz"))
155 (sha256
156 (base32
157 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
158 (build-system gnu-build-system)
159 (arguments
160 '(#:phases (modify-phases %standard-phases
161 (delete 'configure)
162 (add-before 'build 'make-dotl-files-older
163 (lambda _
164 ;; Make the '.l' files as old as the '.c'
165 ;; files to avoid triggering the rule that
166 ;; requires Flex.
167 (define ref
168 (stat "README"))
169
170 (for-each (lambda (file)
171 (set-file-time file ref))
172 (find-files "." "\\.[chl]$"))
173 #t))
174 (add-before 'install 'make-target-directories
175 (lambda* (#:key outputs #:allow-other-keys)
176 (let ((out (assoc-ref outputs "out")))
177 (mkdir-p (string-append out "/bin"))
178 (mkdir-p (string-append out
179 "/share/man/man1"))
180 (mkdir-p (string-append out
181 "/share/doc")))))
182 (replace 'check
183 (lambda _
184 (setenv "HOME" (getcwd))
185 (setenv "PATH"
186 (string-append (getcwd) ":"
187 (getenv "PATH")))
188 (zero? (system* "make" "test")))))
189
190 #:make-flags (list (string-append "PREFIX="
191 (assoc-ref %outputs "out")))))
192 (inputs `(("perl" ,perl)))
193 (home-page "http://www.dwheeler.com/sloccount/")
194 (synopsis "Count physical source lines of code (SLOC)")
195 (description
196 "SLOCCount is a set of the programs for counting source lines of
197 code (SLOC) in large software systems. It can automatically identify and
198 measure a wide range of programming languages. It automatically estimates the
199 effort, time, and money it would take to develop the software, using the
200 COCOMO model or user-provided parameters.")
201 (license license:gpl2+)))
202
203 (define-public cloc
204 (package
205 (name "cloc")
206 (version "1.74")
207 (source
208 (origin
209 (method url-fetch)
210 (uri (string-append
211 "https://github.com/AlDanial/cloc/releases/download/" version
212 "/cloc-" version ".tar.gz"))
213 (sha256
214 (base32
215 "0rq5xfiln1wlv3yr9mg18ax4gskbss786iqaf0v45iv6awyl5b2m"))))
216 (build-system gnu-build-system)
217 (inputs
218 `(("coreutils" ,coreutils)
219 ("perl" ,perl)
220 ("perl-algorithm-diff" ,perl-algorithm-diff)
221 ("perl-regexp-common" ,perl-regexp-common)
222 ("perl-digest-md5" ,perl-digest-md5)))
223 (arguments
224 `(#:phases (modify-phases %standard-phases
225 (delete 'configure)
226 (delete 'build)
227 (replace 'install
228 (lambda* (#:key inputs outputs #:allow-other-keys)
229 (let* ((out (assoc-ref outputs "out")))
230 (zero?
231 (system* "make" "-C" "Unix"
232 (string-append "prefix=" out)
233 (string-append "INSTALL="
234 (assoc-ref inputs "coreutils")
235 "/bin/install")
236 "install")))))
237 (add-after 'install 'wrap-program
238 (lambda* (#:key inputs outputs #:allow-other-keys)
239 (let ((out (assoc-ref outputs "out")))
240 (wrap-program (string-append out "/bin/cloc")
241 `("PERL5LIB" ":" =
242 ,(string-split (getenv "PERL5LIB") #\:)))
243 #t))))
244 #:out-of-source? #t
245 ;; Tests require some other packages.
246 #:tests? #f))
247 (home-page "https://github.com/AlDanial/cloc")
248 (synopsis "Count source lines of code (SLOC) and other source code metrics")
249 (description "cloc counts blank lines, comment lines, and physical lines
250 of source code in many programming languages. Given two versions of a code
251 base, cloc can compute differences in blank, comment, and source lines.
252
253 cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
254 cloc can handle a greater variety of programming languages.")
255 (license license:gpl2+)))
256
257 (define-public the-silver-searcher
258 (package
259 (name "the-silver-searcher")
260 (version "2.1.0")
261 (source (origin
262 (method url-fetch)
263 (uri (string-append
264 "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
265 version ".tar.gz"))
266 (sha256
267 (base32
268 "1m0mih1x4jpswc8ganhqh0gmwbmd2hzmz7402mxfh19s3kcjnrfl"))))
269 (build-system gnu-build-system)
270 (native-inputs
271 `(("pkg-config" ,pkg-config)))
272 (inputs
273 `(("pcre" ,pcre)
274 ("xz" ,xz)
275 ("zlib" ,zlib)))
276 (home-page "http://geoff.greer.fm/ag/")
277 (synopsis "Fast code searching tool")
278 (description
279 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
280 numbers of files. It's intended primarily for source code repositories, and
281 respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
282 of magnitude faster than its inspiration, @command{ack}, and less specialised
283 tools such as @command{grep}.")
284 (license license:asl2.0)))
285
286 (define-public trio
287 (package
288 (name "trio")
289 (version "1.16")
290 (source (origin
291 (method url-fetch)
292 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
293 version ".tar.gz"))
294 (sha256
295 (base32
296 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
297 (build-system gnu-build-system)
298 (home-page "http://daniel.haxx.se/projects/trio/")
299 (synopsis "Portable and extendable printf and string functions")
300 (description
301 "Trio is a set of @code{printf} and string functions designed be used by
302 applications with a focus on portability or with the need for additional
303 features that are not supported by the standard @code{stdio} implementation.")
304 ;; This license is very similar to the ISC license, but the wording is
305 ;; slightly different.
306 (license (license:non-copyleft
307 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
308
309 (define-public withershins
310 (package
311 (name "withershins")
312 (version "0.1")
313 (source (origin
314 (method url-fetch)
315 (uri (string-append
316 "https://github.com/cameronwhite/withershins/archive/v"
317 version ".tar.gz"))
318 (file-name (string-append name "-" version ".tar.gz"))
319 (sha256
320 (base32
321 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
322 (build-system cmake-build-system)
323 (arguments
324 `(#:out-of-source? #f
325 #:phases
326 (modify-phases %standard-phases
327 (add-after
328 'unpack 'find-libiberty
329 (lambda _
330 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
331 (substitute* "cmake/FindIberty.cmake"
332 (("/usr/include") (string-append libiberty "/include"))
333 (("libiberty.a iberty")
334 (string-append "NAMES libiberty.a iberty\nPATHS \""
335 libiberty "/lib" "\"")))
336 #t)))
337 (replace
338 'install
339 (lambda* (#:key outputs #:allow-other-keys)
340 (let* ((out (assoc-ref outputs "out"))
341 (include (string-append out "/include"))
342 (lib (string-append out "/lib")))
343 (mkdir-p include)
344 (install-file "src/withershins.hpp" include)
345 (mkdir-p lib)
346 (install-file "src/libwithershins.a" lib))
347 #t)))))
348 (home-page "https://github.com/cameronwhite/withershins")
349 (inputs
350 `(("libiberty" ,libiberty)
351 ("binutils" ,binutils) ;for libbfd
352 ("zlib" ,zlib)))
353 (synopsis "C++11 library for generating stack traces")
354 (description
355 "Withershins is a simple cross-platform C++11 library for generating
356 stack traces.")
357 ;; Sources are released under Expat license, but since BFD is licensed
358 ;; under the GPLv3+ the combined work is GPLv3+ as well.
359 (license license:gpl3+)))
360
361 (define-public lcov
362 (package
363 (name "lcov")
364 (version "1.13")
365 (source (origin
366 (method url-fetch)
367 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
368 "/LCOV-" version "/lcov-" version ".tar.gz"))
369 (sha256
370 (base32
371 "08wabnb0gcjqk0qc65a6cgbbmz6b8lvam3p7byh0dk42hj3jr5s4"))))
372 (build-system gnu-build-system)
373 (arguments
374 '(#:make-flags
375 (let ((out (assoc-ref %outputs "out")))
376 (list (string-append "PREFIX=" out)))
377 #:phases
378 (modify-phases %standard-phases
379 (delete 'configure)) ; no configure script
380 #:tests? #f)) ; no 'check' target
381 (inputs `(("perl" ,perl)))
382 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
383 (synopsis "Code coverage tool that enhances GNU gcov")
384 (description
385 "LCOV is an extension of @command{gcov}, a tool part of the
386 GNU@tie{}Binutils, which provides information about what parts of a program
387 are actually executed (i.e., \"covered\") while running a particular test
388 case. The extension consists of a set of Perl scripts which build on the
389 textual @command{gcov} output to implement the following enhanced
390 functionality such as HTML output.")
391 (license license:gpl2+)))
392
393 (define-public rtags
394 (package
395 (name "rtags")
396 (version "2.16")
397 (home-page "https://github.com/Andersbakken/rtags")
398 (source
399 (origin
400 (method url-fetch)
401 (uri
402 (string-append home-page "/archive/v" version ".tar.gz"))
403 (file-name (string-append name "-" version ".tar.gz"))
404 (patches (search-patches "rtags-separate-rct.patch"))
405 (modules '((guix build utils)))
406 (snippet
407 ;; Part of spliting rct with rtags.
408 ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
409 '(with-directory-excursion "src"
410 (delete-file-recursively "rct") ;remove bundled copy
411 (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
412 (substitute* files
413 (("#include ?\"rct/(.*.h)\"" all header)
414 (string-append "#include <rct/" header ">"))))))
415 (sha256
416 (base32
417 "17rkci3mmiw93qc32b9x76pg57b0lx80avr6wnmh190jx8n3v3wy"))))
418 (build-system cmake-build-system)
419 (arguments
420 '(#:configure-flags
421 '("-DRTAGS_NO_ELISP_FILES=1"
422 "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
423 "-DCMAKE_CXX_FLAGS=-std=c++11"
424 "-DBUILD_TESTING=FALSE")
425 #:tests? #f))
426 (native-inputs
427 `(("pkg-config" ,pkg-config)))
428 (inputs
429 `(("bash-completion" ,bash-completion)
430 ("clang" ,clang)
431 ("llvm" ,llvm)
432 ("lua" ,lua)
433 ("rct" ,rct)
434 ("selene" ,selene)))
435 (synopsis "Indexer for the C language family with Emacs integration")
436 (description
437 "RTags is a client/server application that indexes C/C++ code and keeps a
438 persistent file-based database of references, declarations, definitions,
439 symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
440 to find symbols by name (including nested class and namespace scope). Most
441 importantly we give you proper follow-symbol and find-references support.")
442 (license license:gpl3+)))