projects/guix·blob wip-postfix · refs

1117 lines · 46.4 KiB

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