projects/guix·blob version-1.4.0 · refs

1075 lines · 44.6 KiB

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