gnu: Use 'search-input-file' some more.
[jackhill/guix/guix.git] / gnu / packages / code.scm
CommitLineData
23153c90 1;;; GNU Guix --- Functional package management for GNU
dda0ada3 2;;; Copyright © 2013, 2015, 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
a5b24740 3;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
4bfd8579 4;;; Copyright © 2015, 2018 Ricardo Wurmus <rekado@elephly.net>
8afd8553 5;;; Copyright © 2016, 2017, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
ba7cd0fd 6;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
8af20b99 7;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
f7fc9667 8;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
4b3070f7 9;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
4715f92e 10;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
c1e5109b 11;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
e470abf8 12;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
62b8ae1a 13;;; Copyright © 2019 Hartmut Goebel <h.goebel@goebel-consult.de>
d8ccff83 14;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
6ee590ec 15;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
89c9e647 16;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
93242b54 17;;; Copyright © 2021 lu hui <luhuins@163.com>
393315a9 18;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
23153c90
LC
19;;;
20;;; This file is part of GNU Guix.
21;;;
22;;; GNU Guix is free software; you can redistribute it and/or modify it
23;;; under the terms of the GNU General Public License as published by
24;;; the Free Software Foundation; either version 3 of the License, or (at
25;;; your option) any later version.
26;;;
27;;; GNU Guix is distributed in the hope that it will be useful, but
28;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30;;; GNU General Public License for more details.
31;;;
32;;; You should have received a copy of the GNU General Public License
33;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35(define-module (gnu packages code)
36 #:use-module (guix packages)
59bd4b90 37 #:use-module (guix utils)
23153c90 38 #:use-module (guix download)
ad8a4d6d 39 #:use-module (guix git-download)
d13586bf 40 #:use-module ((guix licenses) #:prefix license:)
23153c90 41 #:use-module (guix build-system gnu)
76e14638 42 #:use-module (guix build-system cmake)
830ea727 43 #:use-module (guix build-system python)
dc993847 44 #:use-module (guix build-system trivial)
457fc22d 45 #:use-module (gnu packages)
ad8a4d6d
FT
46 #:use-module (gnu packages autogen)
47 #:use-module (gnu packages autotools)
76e14638 48 #:use-module (gnu packages base)
ad8a4d6d 49 #:use-module (gnu packages bash)
58056d5b 50 #:use-module (gnu packages c)
d13586bf 51 #:use-module (gnu packages compression)
457fc22d 52 #:use-module (gnu packages cpp)
89c9e647
JL
53 #:use-module (gnu packages curl)
54 #:use-module (gnu packages elf)
99e64a6e 55 #:use-module (gnu packages emacs)
76e14638 56 #:use-module (gnu packages gcc)
906dcb20 57 #:use-module (gnu packages graphviz)
1b8c7d12 58 #:use-module (gnu packages llvm)
58056d5b 59 #:use-module (gnu packages linux)
1b8c7d12
MB
60 #:use-module (gnu packages lua)
61 #:use-module (gnu packages ncurses)
d13586bf 62 #:use-module (gnu packages pcre)
99e64a6e 63 #:use-module (gnu packages perl)
d8ccff83 64 #:use-module (gnu packages perl-compression)
ad8a4d6d
FT
65 #:use-module (gnu packages pkg-config)
66 #:use-module (gnu packages python)
590be0a1 67 #:use-module (gnu packages python-xyz)
e8122816 68 #:use-module (gnu packages serialization)
cd0322a3 69 #:use-module (gnu packages sqlite)
58056d5b
MB
70 #:use-module (gnu packages texinfo)
71 #:use-module (gnu packages web)
72 #:use-module (gnu packages xml))
23153c90
LC
73
74;;; Tools to deal with source code: metrics, cross-references, etc.
75
99e64a6e
LC
76(define-public cflow
77 (package
78 (name "cflow")
cfae5382 79 (version "1.6")
99e64a6e
LC
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "mirror://gnu/cflow/cflow-"
83 version ".tar.bz2"))
84 (sha256
85 (base32
cfae5382 86 "1mzd3yf0dfv8h2av5vsxxlhpk21nw064h91b2kgfrdz92r0pnj1l"))))
99e64a6e
LC
87 (build-system gnu-build-system)
88
89 ;; Needed to have cflow-mode.el installed.
b8fc3622 90 (native-inputs `(("emacs" ,emacs-minimal)))
65d98906
OP
91 (arguments
92 '(#:configure-flags (list (string-append "CPPFLAGS="
93 "-D" "CFLOW_PREPROC=\\\""
94 (assoc-ref %build-inputs "gcc")
95 "/bin/cpp\\\""))))
6fd52309 96 (home-page "https://www.gnu.org/software/cflow/")
99e64a6e
LC
97 (synopsis "Create a graph of control flow within a program")
98 (description
99 "GNU cflow analyzes C source files and produces a graph charting the
100control flow of the program. It can output the graph in several styles and
e881752c 101in either the POSIX format or in an extended GNU format. cflow also includes
99e64a6e 102a major mode for Emacs for examining the flowcharts that it produces.")
d13586bf 103 (license license:gpl3+)))
99e64a6e
LC
104
105(define-public complexity
106 (package
107 (name "complexity")
1e42d8b8 108 (version "1.10")
99e64a6e
LC
109 (source (origin
110 (method url-fetch)
111 (uri (string-append "mirror://gnu/complexity/complexity-"
1e42d8b8 112 version ".tar.xz"))
99e64a6e
LC
113 (sha256
114 (base32
1e42d8b8 115 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
99e64a6e
LC
116 (build-system gnu-build-system)
117 (native-inputs
118 `(("texinfo" ,texinfo)
119 ("autogen" ,autogen)))
6fd52309 120 (home-page "https://www.gnu.org/software/complexity/")
99e64a6e
LC
121 (synopsis "Analyze complexity of C functions")
122 (description
123 "GNU complexity provides tools for finding procedures that are
124convoluted, overly long or otherwise difficult to understand. This
125may help in learning or reviewing unfamiliar code or perhaps
126highlighting your own code that seemed comprehensible when you wrote it.")
d13586bf 127 (license license:gpl3+)))
99e64a6e
LC
128
129(define-public global ; a global variable
130 (package
131 (name "global")
a8977845 132 (version "6.6.7")
99e64a6e
LC
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "mirror://gnu/global/global-"
136 version ".tar.gz"))
137 (sha256
138 (base32
a8977845 139 "0g4aslm2zajq605py11s4rs1wdnzcqhkh7bc2xl5az42adzzg839"))))
99e64a6e 140 (build-system gnu-build-system)
590be0a1
EF
141 (inputs
142 `(("bash" ,bash-minimal) ; for wrap-program
143 ("coreutils" ,coreutils)
144 ("ctags" ,universal-ctags)
145 ("libltdl" ,libltdl)
146 ("ncurses" ,ncurses)
147 ("python-pygments" ,python-pygments)
148 ("python-wrapper" ,python-wrapper)
149 ("sqlite" ,sqlite)))
99e64a6e
LC
150 (arguments
151 `(#:configure-flags
152 (list (string-append "--with-ncurses="
e1ac691d
LC
153 (assoc-ref %build-inputs "ncurses"))
154 (string-append "--with-sqlite3="
ecd297a1 155 (assoc-ref %build-inputs "sqlite"))
590be0a1
EF
156 (string-append "--with-universal-ctags="
157 (assoc-ref %build-inputs "ctags") "/bin/ctags")
158 (string-append "--sysconfdir="
159 (assoc-ref %outputs "out") "/share/gtags")
160 "--localstatedir=/var" ; This needs to be a writable location.
ecd297a1 161 "--disable-static")
99e64a6e 162
9d9951d6
EF
163 #:phases
164 (modify-phases %standard-phases
93242b54 165 (add-after 'unpack 'fix-globash
166 (lambda* (#:key inputs #:allow-other-keys)
167 (let* ((echo (string-append
168 (assoc-ref inputs "coreutils") "/bin/echo")))
169 (substitute* "globash/globash.in"
170 (("/bin/echo") echo)))))
590be0a1
EF
171 (add-after 'post-install 'install-plugins
172 (lambda _
173 (with-directory-excursion "plugin-factory"
174 (invoke "make" "install"))))
175 (add-before 'install 'dont-install-to-/var
176 (lambda _
177 (substitute* "gozilla/Makefile"
178 (("DESTDIR\\)\\$\\{localstatedir\\}") "TMPDIR)"))))
179 (add-after 'install-plugins 'wrap-program
180 (lambda* (#:key inputs outputs #:allow-other-keys)
181 (wrap-program
182 (string-append (assoc-ref outputs "out")
183 "/share/gtags/script/pygments_parser.py")
99a7bc99 184 `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH"))))))
9d9951d6
EF
185 (add-after 'install 'post-install
186 (lambda* (#:key outputs #:allow-other-keys)
683910e9 187 ;; Install the plugin files in the right place.
9d9951d6
EF
188 (let* ((out (assoc-ref outputs "out"))
189 (data (string-append out "/share/gtags"))
683910e9 190 (vim (string-append out "/share/vim/vimfiles/plugin"))
8afd8553
EF
191 (lisp (string-append out "/share/emacs/site-lisp/"
192 ,(package-name this-package) "-"
193 ,(package-version this-package))))
683910e9
EF
194 (mkdir-p lisp)
195 (mkdir-p vim)
196 (rename-file (string-append data "/gtags.el")
197 (string-append lisp "/gtags.el"))
198 (rename-file (string-append data "/gtags.vim")
199 (string-append vim "/gtags.vim"))
200 (rename-file (string-append data "/gtags-cscope.vim")
201 (string-append vim "/gtags-cscope.vim"))
9d9951d6 202 #t))))))
6fd52309 203 (home-page "https://www.gnu.org/software/global/")
99e64a6e
LC
204 (synopsis "Cross-environment source code tag system")
205 (description
254a8819
CL
206 "GNU GLOBAL is a source code tagging system that functions in the same
207way across a wide array of environments, such as different text editors,
208shells and web browsers. The resulting tags are useful for quickly moving
209around in a large, deeply nested project.")
d13586bf 210 (license license:gpl3+)))
99e64a6e 211
23153c90
LC
212(define-public sloccount
213 (package
214 (name "sloccount")
215 (version "2.26")
216 (source (origin
217 (method url-fetch)
dda0ada3 218 (uri (string-append "https://dwheeler.com/sloccount/sloccount-"
23153c90
LC
219 version ".tar.gz"))
220 (sha256
221 (base32
222 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
223 (build-system gnu-build-system)
224 (arguments
225 '(#:phases (modify-phases %standard-phases
f8503e2b
LC
226 (delete 'configure)
227 (add-before 'build 'make-dotl-files-older
23153c90
LC
228 (lambda _
229 ;; Make the '.l' files as old as the '.c'
230 ;; files to avoid triggering the rule that
231 ;; requires Flex.
232 (define ref
233 (stat "README"))
234
235 (for-each (lambda (file)
236 (set-file-time file ref))
237 (find-files "." "\\.[chl]$"))
238 #t))
f8503e2b 239 (add-before 'install 'make-target-directories
23153c90
LC
240 (lambda* (#:key outputs #:allow-other-keys)
241 (let ((out (assoc-ref outputs "out")))
242 (mkdir-p (string-append out "/bin"))
243 (mkdir-p (string-append out
244 "/share/man/man1"))
245 (mkdir-p (string-append out
e99b4772
RW
246 "/share/doc"))
247 #t)))
f8503e2b 248 (replace 'check
23153c90
LC
249 (lambda _
250 (setenv "HOME" (getcwd))
251 (setenv "PATH"
252 (string-append (getcwd) ":"
253 (getenv "PATH")))
e99b4772 254 (invoke "make" "test"))))
23153c90
LC
255
256 #:make-flags (list (string-append "PREFIX="
257 (assoc-ref %outputs "out")))))
258 (inputs `(("perl" ,perl)))
dda0ada3 259 (home-page "https://dwheeler.com/sloccount/")
23153c90
LC
260 (synopsis "Count physical source lines of code (SLOC)")
261 (description
262 "SLOCCount is a set of the programs for counting source lines of
263code (SLOC) in large software systems. It can automatically identify and
264measure a wide range of programming languages. It automatically estimates the
265effort, time, and money it would take to develop the software, using the
266COCOMO model or user-provided parameters.")
d13586bf
267 (license license:gpl2+)))
268
f7fc9667
AW
269(define-public cloc
270 (package
271 (name "cloc")
aa74d37b 272 (version "1.90")
f7fc9667
AW
273 (source
274 (origin
38878020
TGR
275 (method git-fetch)
276 (uri (git-reference
b0e7b699 277 (url "https://github.com/AlDanial/cloc")
aa74d37b 278 (commit (string-append "v" version))))
38878020 279 (file-name (git-file-name name version))
f7fc9667 280 (sha256
aa74d37b 281 (base32 "0ic9q6qqw5f1wafp9lpmhr0miasbdb9zr59c0jlymnzffdmnliyc"))))
f7fc9667
AW
282 (build-system gnu-build-system)
283 (inputs
284 `(("coreutils" ,coreutils)
285 ("perl" ,perl)
286 ("perl-algorithm-diff" ,perl-algorithm-diff)
95943ed7
TGR
287 ("perl-digest-md5" ,perl-digest-md5)
288 ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
289 ("perl-regexp-common" ,perl-regexp-common)))
f7fc9667
AW
290 (arguments
291 `(#:phases (modify-phases %standard-phases
295fc415
TGR
292 (delete 'configure) ; nothing to configure
293 (delete 'build) ; nothing to build
f7fc9667
AW
294 (replace 'install
295 (lambda* (#:key inputs outputs #:allow-other-keys)
296 (let* ((out (assoc-ref outputs "out")))
53244d1f
TGR
297 (invoke "make" "-C" "Unix"
298 (string-append "prefix=" out)
299 (string-append "INSTALL="
300 (assoc-ref inputs "coreutils")
301 "/bin/install")
302 "install")
303 #t)))
f7fc9667
AW
304 (add-after 'install 'wrap-program
305 (lambda* (#:key inputs outputs #:allow-other-keys)
306 (let ((out (assoc-ref outputs "out")))
307 (wrap-program (string-append out "/bin/cloc")
308 `("PERL5LIB" ":" =
309 ,(string-split (getenv "PERL5LIB") #\:)))
310 #t))))
311 #:out-of-source? #t
312 ;; Tests require some other packages.
313 #:tests? #f))
314 (home-page "https://github.com/AlDanial/cloc")
315 (synopsis "Count source lines of code (SLOC) and other source code metrics")
316 (description "cloc counts blank lines, comment lines, and physical lines
317of source code in many programming languages. Given two versions of a code
318base, cloc can compute differences in blank, comment, and source lines.
319
320cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
e0f49664 321cloc can handle a greater variety of programming languages.")
f7fc9667
AW
322 (license license:gpl2+)))
323
d13586bf
324(define-public the-silver-searcher
325 (package
326 (name "the-silver-searcher")
ffa82227 327 (version "2.2.0")
d13586bf
328 (source (origin
329 (method url-fetch)
330 (uri (string-append
422a6cd4 331 "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
d13586bf
332 version ".tar.gz"))
333 (sha256
334 (base32
ffa82227 335 "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
d13586bf 336 (build-system gnu-build-system)
f91097c5
MO
337 (arguments
338 ;; Required since GCC 10, see:
339 ;; https://gcc.gnu.org/gcc-10/porting_to.html.
340 `(#:configure-flags (list "CFLAGS=-fcommon")))
d13586bf 341 (native-inputs
392f3266 342 `(("pkg-config" ,pkg-config)))
d13586bf
343 (inputs
344 `(("pcre" ,pcre)
345 ("xz" ,xz)
346 ("zlib" ,zlib)))
422a6cd4 347 (home-page "https://geoff.greer.fm/ag/")
d13586bf
348 (synopsis "Fast code searching tool")
349 (description
6acff0f9
TGR
350 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
351numbers of files. It's intended primarily for source code repositories, and
352respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
353of magnitude faster than its inspiration, @command{ack}, and less specialised
354tools such as @command{grep}.")
d13586bf 355 (license license:asl2.0)))
76e14638 356
a4e6356e
RW
357(define-public trio
358 (package
359 (name "trio")
360 (version "1.16")
361 (source (origin
362 (method url-fetch)
363 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
364 version ".tar.gz"))
365 (sha256
366 (base32
367 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
368 (build-system gnu-build-system)
e819fc02 369 (home-page "https://daniel.haxx.se/projects/trio/")
a4e6356e
RW
370 (synopsis "Portable and extendable printf and string functions")
371 (description
372 "Trio is a set of @code{printf} and string functions designed be used by
373applications with a focus on portability or with the need for additional
374features that are not supported by the standard @code{stdio} implementation.")
375 ;; This license is very similar to the ISC license, but the wording is
376 ;; slightly different.
377 (license (license:non-copyleft
378 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
379
58056d5b 380(define-public universal-ctags
0658cc83
MB
381 (package
382 (name "universal-ctags")
6ee590ec 383 (version "5.9.20210509.0")
0658cc83
MB
384 (source
385 (origin
386 (method git-fetch)
387 (uri (git-reference
388 (url "https://github.com/universal-ctags/ctags")
389 (commit (string-append "p" version))))
390 (file-name (git-file-name name version))
391 (sha256
392 (base32
6ee590ec 393 "1sq94bnbzr40zwihfnsna759bbak0lw27j0yn12iwpg4xgb4hhwp"))
0658cc83
MB
394 (modules '((guix build utils)))
395 (snippet
396 '(begin
397 ;; Remove the bundled PackCC and associated build rules.
398 (substitute* "Makefile.am"
6ee590ec
MB
399 (("^PACKCC = .*")
400 "PACKCC = packcc")
401 (("\\$\\(PACKCC_FILES\\)")
402 "")
403 (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): \\$\\(PACKCC\\)")
404 "$(PEG_SRCS) $(PEG_HEADS):"))
405 (delete-file-recursively "misc/packcc")))))
0658cc83
MB
406 (build-system gnu-build-system)
407 (arguments
f8eaeea8
MB
408 '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime.
409 #:configure-flags '("--enable-tmpdir=/tmp")
6ee590ec 410 #:test-target "units"
f8eaeea8 411 #:phases (modify-phases %standard-phases
0658cc83
MB
412 (add-after 'unpack 'make-files-writable
413 (lambda _
6ee590ec
MB
414 (for-each make-file-writable (find-files "."))))
415 (add-before 'bootstrap 'patch-misc
0658cc83 416 (lambda _
6ee590ec
MB
417 ;; The autogen.sh script calls out to these scripts, so
418 ;; we cannot wait for the patch-source-shebangs phase.
419 (for-each patch-shebang (find-files "misc"))))
0658cc83
MB
420 (add-before 'check 'patch-tests
421 (lambda _
422 (substitute* "misc/units"
423 (("SHELL=/bin/sh")
424 (string-append "SHELL=" (which "sh"))))
425 (substitute* "Tmain/utils.sh"
6ee590ec 426 (("/bin/echo") (which "echo"))))))))
0658cc83
MB
427 (native-inputs
428 `(("autoconf" ,autoconf)
429 ("automake" ,automake)
6ee590ec 430 ("packcc" ,packcc)
0658cc83
MB
431 ("perl" ,perl)
432 ("pkg-config" ,pkg-config)))
433 (inputs
434 `(("jansson" ,jansson)
435 ("libseccomp" ,libseccomp)
436 ("libxml2" ,libxml2)
437 ("libyaml" ,libyaml)))
438 (home-page "https://ctags.io/")
439 (synopsis "Generate tag files for source code")
440 (description
441 "Universal Ctags generates an index (or tag) file of language objects
58056d5b
MB
442found in source files for many popular programming languages. This index
443makes it easy for text editors and other tools to locate the indexed items.
444Universal Ctags improves on traditional ctags because of its multilanguage
445support, its ability for the user to define new languages searched by regular
446expressions, and its ability to generate emacs-style TAGS files.")
0658cc83 447 (license license:gpl2+)))
58056d5b 448
76e14638
RW
449(define-public withershins
450 (package
451 (name "withershins")
452 (version "0.1")
3dd14ea7
TGR
453 (source
454 (origin
455 (method git-fetch)
456 (uri (git-reference
b0e7b699 457 (url "https://github.com/cameronwhite/withershins")
3dd14ea7
TGR
458 (commit (string-append "v" version))))
459 (file-name (git-file-name name version))
460 (sha256
461 (base32 "1cviqvbbcwljm1zx12j6511hazr3kscwrvcyifrkfi4fpy5z985m"))))
76e14638
RW
462 (build-system cmake-build-system)
463 (arguments
464 `(#:out-of-source? #f
66c2df9e
TGR
465 #:configure-flags
466 ;; XXX A (justified!) misleading-indentation error breaks the build.
467 (list "-DENABLE_WERROR=OFF")
76e14638
RW
468 #:phases
469 (modify-phases %standard-phases
470 (add-after
471 'unpack 'find-libiberty
472 (lambda _
25734108 473 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
76e14638 474 (substitute* "cmake/FindIberty.cmake"
25734108
RW
475 (("/usr/include") (string-append libiberty "/include"))
476 (("libiberty.a iberty")
477 (string-append "NAMES libiberty.a iberty\nPATHS \""
478 libiberty "/lib" "\"")))
76e14638
RW
479 #t)))
480 (replace
481 'install
482 (lambda* (#:key outputs #:allow-other-keys)
f3860753
TGR
483 (let* ((out (assoc-ref outputs "out"))
484 (include (string-append out "/include"))
485 (lib (string-append out "/lib")))
486 (mkdir-p include)
487 (install-file "src/withershins.hpp" include)
488 (mkdir-p lib)
489 (install-file "src/libwithershins.a" lib))
76e14638
RW
490 #t)))))
491 (home-page "https://github.com/cameronwhite/withershins")
492 (inputs
25734108 493 `(("libiberty" ,libiberty)
76e14638
RW
494 ("binutils" ,binutils) ;for libbfd
495 ("zlib" ,zlib)))
496 (synopsis "C++11 library for generating stack traces")
497 (description
498 "Withershins is a simple cross-platform C++11 library for generating
499stack traces.")
500 ;; Sources are released under Expat license, but since BFD is licensed
501 ;; under the GPLv3+ the combined work is GPLv3+ as well.
502 (license license:gpl3+)))
0084aaf3
LC
503
504(define-public lcov
adbcc3ed
TGR
505 (package
506 (name "lcov")
507 (version "1.15")
508 (source
509 (origin
510 (method url-fetch)
511 (uri (string-append "https://github.com/linux-test-project/lcov"
512 "/releases/download/v" version
513 "/lcov-" version ".tar.gz"))
514 (sha256
515 (base32 "0fh5z0q5wg2jxr2nn5w7321y0zg9rwk75j3k5hnamjdy6gxa5kf1"))))
516 (build-system gnu-build-system)
517 (arguments
518 '(#:test-target "test"
519 #:make-flags (list (string-append "PREFIX="
520 (assoc-ref %outputs "out")))
521 #:phases
522 (modify-phases %standard-phases
523 (add-after 'unpack 'patch-pwd
524 ;; Lift the requirement of having a shell in PATH.
525 (lambda _
526 (substitute* "bin/geninfo"
527 (("qw/abs_path/")
528 "qw/abs_path getcwd/"))
529 (substitute* '("bin/lcov" "bin/geninfo")
530 (("`pwd`")
531 "getcwd()"))
532 #t))
533 (delete 'configure) ;no configure script
534 (add-after 'install 'wrap
535 (lambda* (#:key outputs #:allow-other-keys)
536 (let ((out (assoc-ref outputs "out")))
537 (wrap-program (string-append out "/bin/geninfo")
538 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))
539 #t)))))
540 (inputs `(("perl" ,perl)
541 ("perl-io-compress" ,perl-io-compress)
542 ("perl-json" ,perl-json)))
543 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
544 (synopsis "Code coverage tool that enhances GNU gcov")
545 (description "LCOV is an extension of @command{gcov}, a tool part of the
0084aaf3
LC
546GNU@tie{}Binutils, which provides information about what parts of a program
547are actually executed (i.e., \"covered\") while running a particular test
548case. The extension consists of a set of Perl scripts which build on the
549textual @command{gcov} output to implement the following enhanced
550functionality such as HTML output.")
adbcc3ed 551 (license license:gpl2+)))
4b3070f7 552
830ea727
LC
553(define-public lcov-cobertura
554 (package
555 (name "python-lcov-cobertura")
556 (version "1.6")
557 (source
558 (origin
559 (method url-fetch)
560 (uri (pypi-uri "lcov_cobertura" version))
561 (sha256
562 (base32
563 "02ar6yjazlxq4p64cz9gag08bvakmzjrp147jara9wlnlbc96j8g"))))
564 (build-system python-build-system)
565 (home-page "https://eriwen.github.io/lcov-to-cobertura-xml/")
566 (synopsis "LCOV to Cobertura XML converter")
567 (description
568 "The lcov-to-cobertura Python module converts code coverage report files
569in the lcov format to the XML format of
570@uref{http://cobertura.github.io/cobertura/, Cobertura}, a Java code coverage
571tool. It allows continuous integration servers like Jenkins to aggregate
572results and determine build stability.")
573 (license license:asl2.0)))
574
89c9e647
JL
575(define-public kcov
576 (package
577 (name "kcov")
578 (version "38")
579 (source (origin
580 (method git-fetch)
581 (uri (git-reference
582 (url "https://github.com/SimonKagstrom/kcov")
583 (commit version)))
584 (file-name (git-file-name name version))
585 (sha256
586 (base32
587 "0zqg21xwivi16csl6a5wby6679ny01bjaw4am3y4qcgjdyihifp8"))))
588 (build-system cmake-build-system)
589 (arguments
590 `(#:tests? #f ;no test target
591 #:phases
592 (modify-phases %standard-phases
593 (add-after 'unpack 'fix-/bin/bash-references
594 (lambda _
595 (substitute* (find-files "src" ".*\\.cc?$")
596 (("/bin/bash") (which "bash"))
597 (("/bin/sh") (which "sh")))
598 #t)))))
599 (inputs
600 `(("curl" ,curl)
601 ("elfutils" ,elfutils)
602 ("libelf" ,libelf)
603 ("zlib" ,zlib)))
604 (native-inputs
605 `(("python" ,python)))
606 (home-page "https://github.com/SimonKagstrom/kcov")
607 (synopsis "Code coverage tester for compiled languages, Python and Bash")
608 (description "Kcov is a FreeBSD/Linux/OSX code coverage tester for compiled
609languages, Python and Bash. Kcov was originally a fork of Bcov, but has since
610evolved to support a large feature set in addition to that of Bcov.
611
612Kcov uses DWARF debugging information for compiled programs to make it
613possible to collect coverage information without special compiler switches.")
614 (license license:gpl2+)))
615
4b3070f7
FT
616(define-public rtags
617 (package
618 (name "rtags")
af147cdd 619 (version "2.18")
457fc22d
FT
620 (source
621 (origin
84ae0e29
TGR
622 (method git-fetch)
623 (uri (git-reference
b0e7b699 624 (url "https://github.com/Andersbakken/rtags")
84ae0e29
TGR
625 (commit (string-append "v" version))))
626 (file-name (git-file-name name version))
457fc22d
FT
627 (patches (search-patches "rtags-separate-rct.patch"))
628 (modules '((guix build utils)))
629 (snippet
630 ;; Part of spliting rct with rtags.
631 ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
632 '(with-directory-excursion "src"
633 (delete-file-recursively "rct") ;remove bundled copy
634 (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
635 (substitute* files
636 (("#include ?\"rct/(.*.h)\"" all header)
6cbee49d
MW
637 (string-append "#include <rct/" header ">")))
638 #t)))
457fc22d
FT
639 (sha256
640 (base32
84ae0e29 641 "0raqjbkl1ykga4ahgl9xw49cgh3cyqcf42z36z7d6fz1fw192kg0"))))
4b3070f7
FT
642 (build-system cmake-build-system)
643 (arguments
3def739d
TGR
644 '(#:build-type "RelWithDebInfo"
645 #:configure-flags
457fc22d 646 '("-DRTAGS_NO_ELISP_FILES=1"
457fc22d 647 "-DBUILD_TESTING=FALSE")
4b3070f7 648 #:tests? #f))
457fc22d
FT
649 (native-inputs
650 `(("pkg-config" ,pkg-config)))
4b3070f7 651 (inputs
457fc22d
FT
652 `(("bash-completion" ,bash-completion)
653 ("clang" ,clang)
4b3070f7 654 ("llvm" ,llvm)
457fc22d
FT
655 ("lua" ,lua)
656 ("rct" ,rct)
657 ("selene" ,selene)))
84ae0e29 658 (home-page "https://github.com/Andersbakken/rtags")
4b3070f7
FT
659 (synopsis "Indexer for the C language family with Emacs integration")
660 (description
661 "RTags is a client/server application that indexes C/C++ code and keeps a
662persistent file-based database of references, declarations, definitions,
663symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
664to find symbols by name (including nested class and namespace scope). Most
665importantly we give you proper follow-symbol and find-references support.")
666 (license license:gpl3+)))
dc993847
OP
667
668(define-public colormake
669 (package
670 (name "colormake")
671 (version "0.9.20140503")
672 (source
673 (origin
213c32e4
TGR
674 (method git-fetch)
675 (uri (git-reference
b0e7b699 676 (url "https://github.com/pagekite/Colormake")
213c32e4
TGR
677 (commit version)))
678 (file-name (git-file-name name version))
dc993847 679 (sha256
213c32e4 680 (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
dc993847
OP
681 (build-system trivial-build-system)
682 (native-inputs
683 `(("bash" ,bash)
213c32e4 684 ("perl" ,perl)))
dc993847
OP
685 (arguments
686 `(#:modules ((guix build utils))
687 #:builder
688 (begin
689 (use-modules (guix build utils))
213c32e4
TGR
690 (copy-recursively (assoc-ref %build-inputs "source") "source")
691 (chdir "source")
dc993847
OP
692 (patch-shebang "colormake.pl"
693 (list (string-append (assoc-ref %build-inputs "perl")
694 "/bin")))
695 (let* ((out (assoc-ref %outputs "out"))
696 (bin (string-append out "/bin"))
697 (doc (string-append out "/share/doc"))
698 (install-files (lambda (files directory)
699 (for-each (lambda (file)
700 (install-file file directory))
701 files))))
702 (substitute* "colormake"
703 (("colormake\\.pl") (string-append bin "/colormake.pl"))
704 (("/bin/bash")
2dffe476 705 (search-input-file %build-inputs "/bin/sh")))
dc993847
OP
706 (install-file "colormake.1" (string-append doc "/man/man1"))
707 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
708 (install-files '("colormake" "colormake-short" "clmake"
709 "clmake-short" "colormake.pl")
e3cfef22
MW
710 bin)
711 #t))))
0e564b5e 712 (home-page "https://bre.klaki.net/programs/colormake/")
dc993847
OP
713 (synopsis "Wrapper around @command{make} to produce colored output")
714 (description "This package provides a wrapper around @command{make} to
715produce colored output.")
716 (license license:gpl2+)))
906dcb20
CB
717
718(define-public makefile2graph
719 (package
720 (name "makefile2graph")
721 (version "1.5.0")
104264cd
TGR
722 (source
723 (origin
724 (method git-fetch)
725 (uri (git-reference
b0e7b699 726 (url "https://github.com/lindenb/makefile2graph")
104264cd
TGR
727 (commit (string-append "v" version))))
728 (file-name (git-file-name name version))
729 (sha256
730 (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
906dcb20
CB
731 (build-system gnu-build-system)
732 (arguments
733 '(#:test-target "test"
734 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
735 #:phases
736 (modify-phases %standard-phases
737 (delete 'configure))))
738 (native-inputs
739 `(("graphviz" ,graphviz)))
740 (home-page "https://github.com/lindenb/makefile2graph")
741 (synopsis "Creates a graph of dependencies from GNU Make")
742 (description
743 "@code{make2graph} creates a graph of dependencies from GNU Make. The
744output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
745independent targets.")
746 (license license:expat)))
9c4dcfaf
PN
747
748(define-public uncrustify
749 (package
750 (name "uncrustify")
ae5de93a 751 (version "0.69.0")
9c4dcfaf 752 (source (origin
b5944fcb
PN
753 (method git-fetch)
754 (uri (git-reference
755 (url "https://github.com/uncrustify/uncrustify/")
756 (commit (string-append name "-" version))))
757 (file-name (git-file-name name version))
9c4dcfaf
PN
758 (sha256
759 (base32
ae5de93a 760 "0sqrg13kp8fwymq40976bq380bzw40g4ss7ihlbq45d0f90ifa1k"))))
9c4dcfaf
PN
761 (build-system cmake-build-system)
762 (native-inputs
34843fe9
PN
763 `(("unzip" ,unzip)
764 ("python" ,python-wrapper)))
9c4dcfaf
PN
765 (arguments
766 `(#:phases
767 (modify-phases %standard-phases
768 (add-after 'unpack 'unpack-etc
769 (lambda* (#:key inputs outputs #:allow-other-keys)
770 ;; Configuration samples are not installed by default.
771 (let* ((output (assoc-ref outputs "out"))
772 (etcdir (string-append output "/etc")))
773 (for-each (lambda (l)
774 (install-file l etcdir))
775 (find-files "etc" "\\.cfg$")))
776 #t)))))
777 (home-page "http://uncrustify.sourceforge.net/")
778 (synopsis "Code formatter for C and other related languages")
779 (description
780 "Beautify source code in many languages of the C family (C, C++, C#,
781Objective@tie{}C, D, Java, Pawn, and Vala). Features:
782@itemize
783@item Indent and align code.
784@item Reformat comments (a little bit).
785@item Fix inter-character spacing.
786@item Add or remove parens / braces.
787@item Supports embedded SQL @code{EXEC SQL} stuff.
788@item Highly configurable - More than 600 configurable options.
789@end itemize\n")
790 (license license:gpl2+)))
c1e5109b
LC
791
792(define-public astyle
793 (package
794 (name "astyle")
4bfd8579 795 (version "3.1")
c1e5109b
LC
796 (source
797 (origin
798 (method url-fetch)
799 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
800 version "/astyle_" version "_linux.tar.gz"))
801 (sha256
802 (base32
4bfd8579 803 "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"))))
c1e5109b
LC
804 (build-system gnu-build-system)
805 (arguments
806 `(#:tests? #f ;no tests
807 #:make-flags (list (string-append "prefix=" %output)
808 "INSTALL=install"
809 "all")
62b8ae1a
HG
810 #:modules ((guix build gnu-build-system) ;; FIXME use %default-modules
811 (guix build utils)
812 (ice-9 regex))
c1e5109b
LC
813 #:phases
814 (modify-phases %standard-phases
815 (replace 'configure
816 (lambda _ (chdir "build/gcc") #t))
817 (add-after 'install 'install-libs
818 (lambda* (#:key outputs #:allow-other-keys)
0c6ab522 819 ;; Libraries and includes are not installed by default
c1e5109b 820 (let* ((output (assoc-ref outputs "out"))
0c6ab522 821 (incdir (string-append output "/include"))
c1e5109b 822 (libdir (string-append output "/lib")))
62b8ae1a
HG
823 (define (make-so-link sofile strip-pattern)
824 (symlink
825 (basename sofile)
826 (regexp-substitute #f
827 (string-match strip-pattern sofile)
828 'pre)))
0c6ab522
HG
829 (mkdir-p incdir)
830 (copy-file "../../src/astyle.h"
831 (string-append incdir "/astyle.h"))
62b8ae1a
HG
832 (mkdir-p libdir)
833 (for-each (lambda (l)
834 (copy-file
835 l (string-append libdir "/" (basename l))))
836 (find-files "bin" "lib*"))
837 (for-each
838 (lambda (sofile)
839 (make-so-link sofile "(\\.[0-9]){3}$") ;; link .so
840 (make-so-link sofile "(\\.[0-9]){2}$")) ;; link .so.3
841 (find-files libdir "lib.*\\.so\\..*")))
c1e5109b
LC
842 #t)))))
843 (home-page "http://astyle.sourceforge.net/")
844 (synopsis "Source code indenter, formatter, and beautifier")
845 (description
846 "Artistic Style is a source code indenter, formatter, and beautifier for
847the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
848 (license license:lgpl3+)))
e470abf8
LC
849
850(define-public indent
851 (package
852 (name "indent")
7fe6dcf7 853 (version "2.2.12")
e470abf8
LC
854 (source (origin
855 (method url-fetch)
856 (uri (string-append "mirror://gnu/indent/indent-" version
857 ".tar.gz"))
7fe6dcf7
MB
858 (sha256
859 (base32 "12xvcd16cwilzglv9h7sgh4h1qqjd1h8s48ji2dla58m4706hzg7"))))
e470abf8
LC
860 (build-system gnu-build-system)
861 (arguments
9d10a634
MW
862 `(#:phases
863 (modify-phases %standard-phases
864 (add-after 'unpack 'fix-docdir
865 (lambda _
866 ;; Although indent uses a modern autoconf in which docdir
867 ;; defaults to PREFIX/share/doc, the doc/Makefile.am
868 ;; overrides this to be in PREFIX/doc. Fix this.
869 (substitute* "doc/Makefile.in"
870 (("^docdir = .*$") "docdir = @docdir@\n"))
59bd4b90
MO
871 #t))
872 (add-after 'unpack 'fix-configure
873 (lambda* (#:key inputs native-inputs #:allow-other-keys)
874 ;; Replace outdated config.sub and config.guess:
875 (with-directory-excursion "config"
876 (for-each (lambda (file)
877 (install-file
878 (string-append (assoc-ref
879 (or native-inputs inputs) "automake")
880 "/share/automake-"
881 ,(version-major+minor
882 (package-version automake))
883 "/" file) "."))
884 '("config.sub" "config.guess")))
9d10a634 885 #t)))))
7fe6dcf7 886 (native-inputs
59bd4b90
MO
887 `(("texinfo" ,texinfo)
888 ("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
e470abf8
LC
889 (synopsis "Code reformatter")
890 (description
891 "Indent is a program that makes source code easier to read by
892reformatting it in a consistent style. It can change the style to one of
893several different styles such as GNU, BSD or K&R. It has some flexibility to
894deal with incomplete or malformed syntax. GNU indent offers several
895extensions over the standard utility.")
896 (license license:gpl3+)
897 (home-page "https://www.gnu.org/software/indent/")))
ad8a4d6d
FT
898
899(define-public amalgamate
900 (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
901 (revision "0")
902 (version (git-version "1.1.1" revision commit)))
903 (package
904 (name "amalgamate")
905 (version version)
906 (home-page "https://github.com/edlund/amalgamate")
907 (source
908 (origin
909 (method git-fetch)
910 (uri (git-reference
911 (url home-page)
912 (commit commit)))
913 (sha256
914 (base32
915 "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
916 (file-name (git-file-name name version))
917 (modules '((guix build utils)))
918 (snippet
919 '(substitute* "test.sh"
920 (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
921 "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
922 (build-system gnu-build-system)
923 (inputs
924 `(("python" ,python-wrapper)))
925 (arguments
926 `(#:phases
927 (modify-phases %standard-phases
928 (delete 'configure)
929 (delete 'build)
930 (replace 'install
931 (lambda* (#:key outputs #:allow-other-keys)
932 (let* ((out (assoc-ref outputs "out"))
933 (bin (string-append out "/bin")))
934 (install-file "amalgamate.py" bin))))
935 (replace 'check
936 (lambda _
937 (invoke "./test.sh"))))))
938 (synopsis "Tool for amalgamating C source and header files")
939 ;; The package is indeed a script file, and the term "amalgamate.py" is
940 ;; used by upstream.
941 (description "amalgamate.py aims to make it easy to use SQLite-style C
942source and header amalgamation in projects.")
943 (license license:bsd-3))))
393315a9
FCW
944
945(define-public cscope
946 (package
947 (name "cscope")
948 (version "15.9")
949 (source
950 (origin
951 (method url-fetch)
952 (uri (string-append "mirror://sourceforge/cscope/cscope/"
953 "v" version "/cscope-" version ".tar.gz"))
954 (sha256
955 (base32 "0ngiv4aj3rr35k3q3wjx0y19gh7i1ydqa0cqip6sjwd8fph5ll65"))))
956 (build-system gnu-build-system)
957 (inputs `(("ncurses" ,ncurses)))
958 (arguments
959 `(#:configure-flags
960 ;; Specify the correct ncurses directory to prevent incorrect fallback
961 ;; on SysV curses.
962 (list (string-append "--with-ncurses="
963 (assoc-ref %build-inputs "ncurses")))))
964 (home-page "http://cscope.sourceforge.net")
965 (synopsis "Tool for browsing source code")
966 (description
967 "Cscope is a text screen based source browsing tool. Although it is
968primarily designed to search C code (including lex and yacc files), it can
969also be used for C++ code.
970
971Using cscope, you can easily search for where symbols are used and defined.")
972 (license license:bsd-3)))