projects/guix·blob master · refs

1142 lines · 47.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2013, 2015, 2018, 2020, 2021, 2023, 2025 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, 2018, 2019-2024 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 © 2022 Michael Rohleder <[email protected]>
19;;; Copyright © 2023 Fries <[email protected]>
20;;; Copyright © 2023 Zheng Junjie <[email protected]>
21;;; Copyright © 2024 Sharlatan Hellseher <[email protected]>
22;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
23;;; Copyright © 2024 Jordan Moore <[email protected]>
24;;; Copyright © 2025 Nicolas Graves <[email protected]>
25;;; Copyright © 2025 Ada Stevenson <[email protected]>
26;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
27;;; Copyright © 2026 Luca Kredel <[email protected]>
28;;;
29;;; This file is part of GNU Guix.
30;;;
31;;; GNU Guix is free software; you can redistribute it and/or modify it
32;;; under the terms of the GNU General Public License as published by
33;;; the Free Software Foundation; either version 3 of the License, or (at
34;;; your option) any later version.
35;;;
36;;; GNU Guix is distributed in the hope that it will be useful, but
37;;; WITHOUT ANY WARRANTY; without even the implied warranty of
38;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39;;; GNU General Public License for more details.
40;;;
41;;; You should have received a copy of the GNU General Public License
42;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
43
44(define-module (gnu packages code)
45 #:use-module ((guix licenses) #:prefix license:)
46 #:use-module (guix gexp)
47 #:use-module (guix packages)
48 #:use-module (guix utils)
49 #:use-module (guix download)
50 #:use-module (guix git-download)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix build-system cmake)
53 #:use-module (guix build-system pyproject)
54 #:use-module (guix build-system trivial)
55 #:use-module (guix build-system go)
56 #:use-module (gnu packages)
57 #:use-module (gnu packages autogen)
58 #:use-module (gnu packages autotools)
59 #:use-module (gnu packages base)
60 #:use-module (gnu packages bash)
61 #:use-module (gnu packages bison)
62 #:use-module (gnu packages boost)
63 #:use-module (gnu packages check)
64 #:use-module (gnu packages compression)
65 #:use-module (gnu packages cpp)
66 #:use-module (gnu packages curl)
67 #:use-module (gnu packages elf)
68 #:use-module (gnu packages emacs)
69 #:use-module (gnu packages compiler-tools)
70 #:use-module (gnu packages gcc)
71 #:use-module (gnu packages gettext)
72 #:use-module (gnu packages golang-build)
73 #:use-module (gnu packages golang-crypto)
74 #:use-module (gnu packages golang-web)
75 #:use-module (gnu packages golang-xyz)
76 #:use-module (gnu packages graphviz)
77 #:use-module (gnu packages linux)
78 #:use-module (gnu packages llvm)
79 #:use-module (gnu packages logging)
80 #:use-module (gnu packages lua)
81 #:use-module (gnu packages ncurses)
82 #:use-module (gnu packages pcre)
83 #:use-module (gnu packages perl)
84 #:use-module (gnu packages perl-compression)
85 #:use-module (gnu packages pkg-config)
86 #:use-module (gnu packages pretty-print)
87 #:use-module (gnu packages python)
88 #:use-module (gnu packages python-build)
89 #:use-module (gnu packages python-web)
90 #:use-module (gnu packages python-xyz)
91 #:use-module (gnu packages qt)
92 #:use-module (gnu packages readline)
93 #:use-module (gnu packages regex)
94 #:use-module (gnu packages serialization)
95 #:use-module (gnu packages sqlite)
96 #:use-module (gnu packages texinfo)
97 #:use-module (gnu packages tls)
98 #:use-module (gnu packages web)
99 #:use-module (gnu packages xml)
100 #:use-module (srfi srfi-1))
101
102;;; Tools to deal with source code: metrics, cross-references, etc.
103
104(define-public amalgamate
105 (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
106 (revision "0")
107 (version (git-version "1.1.1" revision commit)))
108 (package
109 (name "amalgamate")
110 (version version)
111 (home-page "https://github.com/edlund/amalgamate")
112 (source
113 (origin
114 (method git-fetch)
115 (uri (git-reference
116 (url home-page)
117 (commit commit)))
118 (sha256
119 (base32
120 "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
121 (file-name (git-file-name name version))
122 (modules '((guix build utils)))
123 (snippet
124 '(substitute* "test.sh"
125 (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
126 "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
127 (build-system gnu-build-system)
128 (inputs (list python-wrapper))
129 (arguments
130 `(#:phases
131 (modify-phases %standard-phases
132 (delete 'configure)
133 (delete 'build)
134 (replace 'install
135 (lambda* (#:key outputs #:allow-other-keys)
136 (let* ((out (assoc-ref outputs "out"))
137 (bin (string-append out "/bin")))
138 (install-file "amalgamate.py" bin))))
139 (replace 'check
140 (lambda _
141 (invoke "./test.sh"))))))
142 (synopsis "Tool for amalgamating C source and header files")
143 ;; The package is indeed a script file, and the term "amalgamate.py" is
144 ;; used by upstream.
145 (description "amalgamate.py aims to make it easy to use SQLite-style C
146source and header amalgamation in projects.")
147 (license license:bsd-3))))
148
149(define-public automatic-component-toolkit
150 (package
151 (name "automatic-component-toolkit")
152 (version "1.6.0")
153 (home-page "https://github.com/Autodesk/AutomaticComponentToolkit")
154 (source (origin
155 (method git-fetch)
156 (uri (git-reference (url home-page)
157 (commit (string-append "v" version))))
158 (file-name (git-file-name name version))
159 (sha256
160 (base32
161 "1r0sbw82cf9dbcj3vgnbd4sc1lklzvijic2z5wgkvs21azcm0yzh"))))
162 (build-system go-build-system)
163 (arguments
164 (list
165 #:tests? #f ;no tests
166 #:install-source? #f
167 #:import-path "github.com/Autodesk/AutomaticComponentToolkit/cmd/act"
168 #:unpack-path "github.com/Autodesk/AutomaticComponentToolkit/"
169 #:phases
170 #~(modify-phases %standard-phases
171 ;; Golang produces the final binary based on the current directory
172 ;; name if -o options is not provided, utilize this assumption to
173 ;; completely relay on go-build-system.
174 (add-before 'build 'pretend-cmd-act
175 (lambda* (#:key unpack-path #:allow-other-keys)
176 (let ((act (string-append "src/" unpack-path "/cmd/act"))
177 (source (string-append "src/" unpack-path "/Source")))
178 (mkdir-p act)
179 (copy-recursively source act)))))))
180 (synopsis "Automatically generate software components")
181 (description
182 "The Automatic Component Toolkit (@dfn{ACT}) is a code generator that
183takes an instance of an Interface Description Language (@dfn{IDL}) file and
184generates a thin C89-API, implementation stubs, and language bindings of your
185desired software component.")
186 (license license:bsd-2)))
187
188(define-public cflow
189 (package
190 (name "cflow")
191 (version "1.8")
192 (source (origin
193 (method url-fetch)
194 (uri (string-append "mirror://gnu/cflow/cflow-"
195 version ".tar.bz2"))
196 (sha256
197 (base32
198 "1f4s979phyjz8qss10d0fqa4paa6z3wwdz23d9zqgixnamxn48c3"))))
199 (build-system gnu-build-system)
200
201 ;; Needed to have cflow-mode.el installed.
202 (native-inputs
203 (list emacs-minimal))
204 (arguments
205 '(#:configure-flags (list (string-append "CPPFLAGS="
206 "-D" "CFLOW_PREPROC=\\\""
207 (assoc-ref %build-inputs "gcc")
208 "/bin/cpp\\\""))))
209 (home-page "https://www.gnu.org/software/cflow/")
210 (synopsis "Create a graph of control flow within a program")
211 (description
212 "GNU cflow analyzes C source files and produces a graph charting the
213control flow of the program. It can output the graph in several styles and
214in either the POSIX format or in an extended GNU format. cflow also includes
215a major mode for Emacs for examining the flowcharts that it produces.")
216 (license license:gpl3+)))
217
218(define-public complexity
219 (package
220 (name "complexity")
221 (version "1.10")
222 (source (origin
223 (method url-fetch)
224 (uri (string-append "mirror://gnu/complexity/complexity-"
225 version ".tar.xz"))
226 (sha256
227 (base32
228 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
229 (build-system gnu-build-system)
230 (arguments
231 (list #:phases
232 #~(modify-phases %standard-phases
233 (add-before 'build 'set-man-page-date
234 ;; Avoid embedding the current date for reproducible builds
235 (lambda _
236 (setenv "MAN_PAGE_DATE" "2012-04-18"))))))
237 (native-inputs
238 (list texinfo autogen))
239 (home-page "https://www.gnu.org/software/complexity/")
240 (synopsis "Analyze complexity of C functions")
241 (description
242 "GNU complexity provides tools for finding procedures that are
243convoluted, overly long or otherwise difficult to understand. This
244may help in learning or reviewing unfamiliar code or perhaps
245highlighting your own code that seemed comprehensible when you wrote it.")
246 (license license:gpl3+)))
247
248(define-public cscope
249 (package
250 (name "cscope")
251 (version "15.9")
252 (source
253 (origin
254 (method url-fetch)
255 (uri (string-append "mirror://sourceforge/cscope/cscope/"
256 "v" version "/cscope-" version ".tar.gz"))
257 (sha256
258 (base32 "0ngiv4aj3rr35k3q3wjx0y19gh7i1ydqa0cqip6sjwd8fph5ll65"))))
259 (build-system gnu-build-system)
260 (inputs (list ncurses))
261 (arguments
262 `(#:configure-flags
263 ;; Specify the correct ncurses directory to prevent incorrect fallback
264 ;; on SysV curses.
265 (list (string-append "--with-ncurses="
266 (assoc-ref %build-inputs "ncurses")))))
267 (home-page "https://cscope.sourceforge.net")
268 (synopsis "Tool for browsing source code")
269 (description
270 "Cscope is a text screen based source browsing tool. Although it is
271primarily designed to search C code (including lex and yacc files), it can
272also be used for C++ code.
273
274Using cscope, you can easily search for where symbols are used and defined.")
275 (license license:bsd-3)))
276
277(define-public global ; a global variable
278 (package
279 (name "global")
280 (version "6.7")
281 (source (origin
282 (method url-fetch)
283 (uri (string-append "mirror://gnu/global/global-"
284 version ".tar.gz"))
285 (sha256
286 (base32
287 "1xwbbhm5yydhpfdspsywwid5kj62c1z1ricrbvanhbfskc65kazx"))))
288 (build-system gnu-build-system)
289 (arguments
290 (list #:configure-flags
291 #~(list (string-append "--with-ncurses="
292 #$(this-package-input "ncurses"))
293 (string-append "--with-sqlite3="
294 #$(this-package-input "sqlite"))
295 (string-append "--with-universal-ctags="
296 #$(this-package-input "universal-ctags")
297 "/bin/ctags")
298 ;; Otherwise this gets overridden in the 'configure phase.
299 (string-append "--with-python-interpreter="
300 #$(this-package-input "python-wrapper")
301 "/bin/python")
302 (string-append "--sysconfdir="
303 #$output "/share/gtags")
304 "--localstatedir=/var" ; This needs to be a writable location.
305 "--disable-static")
306
307 #:phases
308 #~(modify-phases %standard-phases
309 (add-after 'unpack 'fix-globash
310 (lambda* (#:key inputs #:allow-other-keys)
311 (substitute* "globash/globash.in"
312 (("/bin/echo")
313 (search-input-file inputs "bin/echo")))))
314 (add-after 'install 'post-install
315 (lambda _
316 ;; Install the plugin files in the right place.
317 (let* ((data (string-append #$output "/share/gtags"))
318 (vim (string-append
319 #$output
320 "/share/vim/vimfiles/pack/guix/start/global/plugin"))
321 (lisp (string-append #$output "/share/emacs/site-lisp/"
322 #$(package-name this-package) "-"
323 #$(package-version this-package))))
324 (mkdir-p lisp)
325 (mkdir-p vim)
326 (rename-file (string-append data "/gtags.el")
327 (string-append lisp "/gtags.el"))
328 (rename-file (string-append data "/gtags.vim")
329 (string-append vim "/gtags.vim"))
330 (rename-file (string-append data "/gtags-cscope.vim")
331 (string-append vim "/gtags-cscope.vim")))))
332 (add-after 'post-install 'install-plugins
333 (lambda _
334 (with-directory-excursion "plugin-factory"
335 (invoke "make" "install"))))
336 (add-before 'install 'dont-install-to-/var
337 (lambda _
338 (substitute* "gozilla/Makefile"
339 (("DESTDIR\\)\\$\\{localstatedir\\}")
340 "TMPDIR)"))))
341 (add-after 'install-plugins 'wrap-program
342 (lambda _
343 (wrap-program
344 (string-append #$output
345 "/share/gtags/script/pygments_parser.py")
346 `("GUIX_PYTHONPATH" ":" prefix
347 (,(getenv "GUIX_PYTHONPATH")))))))))
348 (inputs
349 (list bash-minimal ; for wrap-program
350 coreutils
351 universal-ctags
352 libltdl
353 ncurses
354 python-pygments
355 python-wrapper
356 sqlite))
357 (home-page "https://www.gnu.org/software/global/")
358 (synopsis "Cross-environment source code tag system")
359 (description
360 "GNU GLOBAL is a source code tagging system that functions in the same
361way across a wide array of environments, such as different text editors,
362shells and web browsers. The resulting tags are useful for quickly moving
363around in a large, deeply nested project.")
364 (license license:gpl3+)))
365
366(define-public sloccount
367 (package
368 (name "sloccount")
369 (version "2.26")
370 (source (origin
371 (method url-fetch)
372 (uri (string-append "https://dwheeler.com/sloccount/sloccount-"
373 version ".tar.gz"))
374 (sha256
375 (base32
376 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
377 (build-system gnu-build-system)
378 (arguments
379 '(#:phases (modify-phases %standard-phases
380 (delete 'configure)
381 (add-before 'build 'make-dotl-files-older
382 (lambda _
383 ;; Make the '.l' files as old as the '.c'
384 ;; files to avoid triggering the rule that
385 ;; requires Flex.
386 (define ref
387 (stat "README"))
388
389 (for-each (lambda (file)
390 (set-file-time file ref))
391 (find-files "." "\\.[chl]$"))
392 #t))
393 (add-before 'install 'make-target-directories
394 (lambda* (#:key outputs #:allow-other-keys)
395 (let ((out (assoc-ref outputs "out")))
396 (mkdir-p (string-append out "/bin"))
397 (mkdir-p (string-append out
398 "/share/man/man1"))
399 (mkdir-p (string-append out
400 "/share/doc"))
401 #t)))
402 (replace 'check
403 (lambda _
404 (setenv "HOME" (getcwd))
405 (setenv "PATH"
406 (string-append (getcwd) ":"
407 (getenv "PATH")))
408 (invoke "make" "test"))))
409
410 #:make-flags (list (string-append "PREFIX="
411 (assoc-ref %outputs "out")))))
412 (inputs (list perl))
413 (home-page "https://dwheeler.com/sloccount/")
414 (synopsis "Count physical source lines of code (SLOC)")
415 (description
416 "SLOCCount is a set of the programs for counting source lines of
417code (SLOC) in large software systems. It can automatically identify and
418measure a wide range of programming languages. It automatically estimates the
419effort, time, and money it would take to develop the software, using the
420COCOMO model or user-provided parameters.")
421 (license license:gpl2+)))
422
423(define-public cloc
424 (package
425 (name "cloc")
426 (version "2.10")
427 (source
428 (origin
429 (method git-fetch)
430 (uri (git-reference
431 (url "https://github.com/AlDanial/cloc")
432 (commit (string-append "v" version))))
433 (file-name (git-file-name name version))
434 (sha256
435 (base32 "03isq42ndgg7gr1wpmn8ax2hx7dh00nfx02xzfcya5grc7dn95q7"))))
436 (build-system gnu-build-system)
437 (inputs
438 (list bash-minimal
439 coreutils
440 perl
441 perl-algorithm-diff
442 perl-digest-md5
443 perl-parallel-forkmanager
444 perl-regexp-common))
445 (arguments
446 `(#:phases (modify-phases %standard-phases
447 (delete 'configure) ; nothing to configure
448 (delete 'build) ; nothing to build
449 (replace 'install
450 (lambda* (#:key inputs outputs #:allow-other-keys)
451 (let* ((out (assoc-ref outputs "out")))
452 (invoke "make" "-C" "Unix"
453 (string-append "prefix=" out)
454 (string-append "INSTALL="
455 (assoc-ref inputs "coreutils")
456 "/bin/install")
457 "install"))))
458 (add-after 'install 'wrap-program
459 (lambda* (#:key inputs outputs #:allow-other-keys)
460 (let ((out (assoc-ref outputs "out")))
461 (wrap-program (string-append out "/bin/cloc")
462 `("PERL5LIB" ":" =
463 ,(string-split (getenv "PERL5LIB") #\:)))))))
464 #:out-of-source? #t
465 ;; Tests require some other packages.
466 #:tests? #f))
467 (home-page "https://github.com/AlDanial/cloc")
468 (synopsis "Count source lines of code (SLOC) and other source code metrics")
469 (description "cloc counts blank lines, comment lines, and physical lines
470of source code in many programming languages. Given two versions of a code
471base, cloc can compute differences in blank, comment, and source lines.
472
473cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
474cloc can handle a greater variety of programming languages.")
475 (license license:gpl2+)))
476
477(define-public scc
478 (package
479 (name "scc")
480 (version "3.7.0")
481 (source
482 (origin
483 (method git-fetch)
484 (uri (git-reference
485 (url "https://github.com/boyter/scc")
486 (commit (string-append "v" version))))
487 (file-name (git-file-name name version))
488 (sha256
489 (base32 "1kybs8849whpl1rgbgnwcy0z9nb1jzcjdimba91n6zng9ksz9sl0"))))
490 (build-system go-build-system)
491 (arguments
492 (list
493 #:install-source? #f
494 #:import-path "github.com/boyter/scc"))
495 (native-inputs
496 (list go-github-com-agnivade-levenshtein
497 go-github-com-boyter-gocodewalker
498 go-github-com-boyter-simplecache
499 go-github-com-json-iterator-go
500 go-github-com-mattn-go-runewidth
501 go-github-com-rs-zerolog
502 go-github-com-spf13-cobra
503 go-github-com-spf13-pflag
504 go-go-yaml-in-yaml-v2
505 go-golang-org-x-crypto
506 go-golang-org-x-text))
507 (home-page "https://github.com/boyter/scc")
508 (synopsis "Fast code counter written in Go")
509 (description
510 "@command{scc} provides a lines-of-code counter similar to tools like
511@command{cloc} and @command{sloccount}. It aims to be fast as possible while
512supporting @acronym{COCOMO,Constructive Cost Model} calculation and code
513complexity estimation.")
514 (license license:expat)))
515
516(define-public the-silver-searcher
517 (package
518 (name "the-silver-searcher")
519 (version "2.2.0")
520 (source (origin
521 (method url-fetch)
522 (uri (string-append
523 "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
524 version ".tar.gz"))
525 (sha256
526 (base32
527 "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
528 (build-system gnu-build-system)
529 (arguments
530 ;; Required since GCC 10, see:
531 ;; https://gcc.gnu.org/gcc-10/porting_to.html.
532 `(#:configure-flags (list "CFLAGS=-fcommon")))
533 (native-inputs
534 (list pkg-config))
535 (inputs
536 (list pcre xz zlib))
537 (home-page "https://geoff.greer.fm/ag/")
538 (synopsis "Fast code searching tool")
539 (description
540 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
541numbers of files. It's intended primarily for source code repositories, and
542respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
543of magnitude faster than its inspiration, @command{ack}, and less specialised
544tools such as @command{grep}.")
545 (license license:asl2.0)))
546
547(define-public trio
548 (package
549 (name "trio")
550 (version "1.16")
551 (source (origin
552 (method url-fetch)
553 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
554 version ".tar.gz"))
555 (sha256
556 (base32
557 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
558 (build-system gnu-build-system)
559 (home-page "https://daniel.haxx.se/projects/trio/")
560 (synopsis "Portable and extendable printf and string functions")
561 (description
562 "Trio is a set of @code{printf} and string functions designed be used by
563applications with a focus on portability or with the need for additional
564features that are not supported by the standard @code{stdio} implementation.")
565 ;; This license is very similar to the ISC license, but the wording is
566 ;; slightly different.
567 (license (license:non-copyleft
568 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
569
570(define-public lcov
571 (package
572 (name "lcov")
573 (version "1.16")
574 (source
575 (origin
576 (method url-fetch)
577 (uri (string-append "https://github.com/linux-test-project/lcov"
578 "/releases/download/v" version
579 "/lcov-" version ".tar.gz"))
580 (sha256
581 (base32 "02r4wdl5d694aaxc5fgjw4nl3zmzq45khaxmsi3agj18annk2w4q"))))
582 (build-system gnu-build-system)
583 (arguments
584 '(#:test-target "test"
585 #:make-flags (list (string-append "PREFIX="
586 (assoc-ref %outputs "out")))
587 ;; This test suite has race conditions in its scripts which make it
588 ;; unreliable when run in parallel.
589 #:parallel-tests? #f
590 #:phases
591 (modify-phases %standard-phases
592 (add-after 'unpack 'patch-references-to-commands
593 (lambda* (#:key inputs #:allow-other-keys)
594 ;; Lift the requirement of having a shell and 'find' in PATH.
595 (substitute* "bin/geninfo"
596 (("qw/abs_path/")
597 "qw/abs_path getcwd/"))
598 (substitute* '("bin/lcov" "bin/geninfo")
599 (("`pwd`")
600 "getcwd()")
601 (("`find ")
602 (string-append "`"
603 (search-input-file inputs "/bin/find")
604 " ")))))
605 (delete 'configure) ;no configure script
606 (add-after 'install 'wrap
607 (lambda* (#:key outputs #:allow-other-keys)
608 (let ((out (assoc-ref outputs "out")))
609 (wrap-program (string-append out "/bin/geninfo")
610 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB"))))))))))
611 (inputs (list bash-minimal perl perl-io-compress perl-json))
612 (home-page "https://ltp.sourceforge.net/coverage/lcov.php")
613 (synopsis "Code coverage tool that enhances GNU gcov")
614 (description "LCOV is an extension of @command{gcov}, a tool part of the
615GNU@tie{}Binutils, which provides information about what parts of a program
616are actually executed (i.e., \"covered\") while running a particular test
617case. The extension consists of a set of Perl scripts which build on the
618textual @command{gcov} output to implement the following enhanced
619functionality such as HTML output.")
620 (license license:gpl2+)))
621
622(define-public lcov-cobertura
623 (package
624 (name "lcov-cobertura")
625 (version "2.1.1")
626 (source
627 (origin
628 (method url-fetch)
629 (uri (pypi-uri "lcov_cobertura" version))
630 (sha256
631 (base32 "13xmr249c6qygm14gilb0icrsgb35ghsrr14a1zvppmxy9jf5a7g"))))
632 (build-system pyproject-build-system)
633 (arguments
634 (list
635 #:phases
636 #~(modify-phases %standard-phases
637 (add-after 'unpack 'patch-source
638 (lambda _
639 ;; Prevent setuptools.errors.InvalidConfigError:
640 ;; License classifiers have been superseded by license expressions
641 ;; (see https://peps.python.org/pep-0639/). Please remove:
642 ;; License :: OSI Approved :: Apache Software License
643 ;; Reported upstream:
644 ;; https://github.com/eriwen/lcov-to-cobertura-xml/pull/65
645 (substitute* "setup.cfg"
646 (("\tLicense :: OSI Approved :: Apache Software License\n")
647 "")))))))
648 (native-inputs
649 (list python-pytest
650 python-setuptools
651 python-setuptools-scm
652 python-wheel
653 python-xmldiff))
654 (home-page "https://eriwen.github.io/lcov-to-cobertura-xml/")
655 (synopsis "LCOV to Cobertura XML converter")
656 (description
657 "The lcov-to-cobertura Python module converts code coverage report files
658in the lcov format to the XML format of
659@uref{http://cobertura.github.io/cobertura/, Cobertura}, a Java code coverage
660tool. It allows continuous integration servers like Jenkins to aggregate
661results and determine build stability.")
662 (license license:asl2.0)))
663
664(define-public kcov
665 (package
666 (name "kcov")
667 (version "42")
668 (source (origin
669 (method git-fetch)
670 (uri (git-reference
671 (url "https://github.com/SimonKagstrom/kcov")
672 (commit (string-append "v" version))))
673 (file-name (git-file-name name version))
674 (sha256
675 (base32
676 "14pyahpgadh845q2p1gjw2yrlqcan4n870icrn2yqdpf33cprzgk"))))
677 (build-system cmake-build-system)
678 (arguments
679 `(#:tests? #f ; no test target
680 #:phases
681 (modify-phases %standard-phases
682 (add-after 'unpack 'fix-/bin/bash-references
683 (lambda* (#:key inputs #:allow-other-keys)
684 (substitute* (find-files "src" ".*\\.cc?$")
685 (("/bin/(bash|sh)" shell)
686 (search-input-file inputs shell))))))))
687 (inputs
688 (list curl elfutils libelf openssl zlib))
689 (native-inputs
690 (list python))
691 (home-page "https://github.com/SimonKagstrom/kcov")
692 (synopsis "Code coverage tester for compiled languages, Python and Bash")
693 (description "Kcov is a code coverage tester for compiled languages,
694Python and Bash. It was originally a fork of Bcov, but has since evolved to
695support a large feature set in addition to that of Bcov.
696
697Kcov uses DWARF debugging information for compiled programs to make it
698possible to collect coverage information without special compiler switches.")
699 (license license:gpl2+)))
700
701(define-public colormake
702 (package
703 (name "colormake")
704 (version "0.9.20140503")
705 (source
706 (origin
707 (method git-fetch)
708 (uri (git-reference
709 (url "https://github.com/pagekite/Colormake")
710 (commit version)))
711 (file-name (git-file-name name version))
712 (sha256
713 (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
714 (build-system trivial-build-system)
715 (native-inputs
716 (list bash perl))
717 (arguments
718 `(#:modules ((guix build utils))
719 #:builder
720 (begin
721 (use-modules (guix build utils))
722 (copy-recursively (assoc-ref %build-inputs "source") "source")
723 (chdir "source")
724 (patch-shebang "colormake.pl"
725 (list (string-append (assoc-ref %build-inputs "perl")
726 "/bin")))
727 (let* ((out (assoc-ref %outputs "out"))
728 (bin (string-append out "/bin"))
729 (doc (string-append out "/share/doc"))
730 (install-files (lambda (files directory)
731 (for-each (lambda (file)
732 (install-file file directory))
733 files))))
734 (substitute* "colormake"
735 (("colormake\\.pl") (string-append bin "/colormake.pl"))
736 (("/bin/bash")
737 (search-input-file %build-inputs "/bin/sh")))
738 (install-file "colormake.1" (string-append doc "/man/man1"))
739 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
740 (install-files '("colormake" "colormake-short" "clmake"
741 "clmake-short" "colormake.pl")
742 bin)
743 #t))))
744 (home-page "https://bre.klaki.net/programs/colormake/")
745 (synopsis "Wrapper around @command{make} to produce colored output")
746 (description "This package provides a wrapper around @command{make} to
747produce colored output.")
748 (license license:gpl2+)))
749
750(define-public makefile2graph
751 (package
752 (name "makefile2graph")
753 (version "1.5.0")
754 (source
755 (origin
756 (method git-fetch)
757 (uri (git-reference
758 (url "https://github.com/lindenb/makefile2graph")
759 (commit (string-append "v" version))))
760 (file-name (git-file-name name version))
761 (sha256
762 (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
763 (build-system gnu-build-system)
764 (arguments
765 (list
766 #:test-target "test"
767 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
768 (string-append "prefix=" #$output))
769 #:phases
770 #~(modify-phases %standard-phases
771 (delete 'configure))))
772 (native-inputs
773 (list graphviz))
774 (home-page "https://github.com/lindenb/makefile2graph")
775 (synopsis "Creates a graph of dependencies from GNU Make")
776 (description
777 "@code{make2graph} creates a graph of dependencies from GNU Make. The
778output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
779independent targets.")
780 (license license:expat)))
781
782(define-public uncrustify
783 (package
784 (name "uncrustify")
785 (version "0.80.1")
786 (source (origin
787 (method git-fetch)
788 (uri (git-reference
789 (url "https://github.com/uncrustify/uncrustify/")
790 (commit (string-append name "-" version))))
791 (file-name (git-file-name name version))
792 (sha256
793 (base32
794 "1n7ifr4i35ii5zaia61jdd61virbygc00anhc9iq3p5gzjlfxhsa"))))
795 (build-system cmake-build-system)
796 (native-inputs (list python-wrapper))
797 (arguments
798 (list #:phases
799 #~(modify-phases %standard-phases
800 (add-after 'unpack 'unpack-etc
801 (lambda* (#:key inputs outputs #:allow-other-keys)
802 ;; Configuration samples are not installed by default.
803 (let* ((output (assoc-ref outputs "out"))
804 (etcdir (string-append output "/etc")))
805 (for-each (lambda (l)
806 (install-file l etcdir))
807 (find-files "etc" "\\.cfg$"))))))))
808 (home-page "https://uncrustify.sourceforge.net/")
809 (synopsis "Code formatter for C and other related languages")
810 (description
811 "Beautify source code in many languages of the C family (C, C++, C#,
812Objective@tie{}C, D, Java, Pawn, and Vala). Features:
813@itemize
814@item Indent and align code.
815@item Reformat comments (a little bit).
816@item Fix inter-character spacing.
817@item Add or remove parens / braces.
818@item Supports embedded SQL @code{EXEC SQL} stuff.
819@item Highly configurable - More than 600 configurable options.
820@end itemize\n")
821 (license license:gpl2+)))
822
823(define-public astyle
824 (package
825 (name "astyle")
826 (version "3.5")
827 (source
828 (origin
829 (method url-fetch)
830 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
831 version "/astyle-" version ".tar.bz2"))
832 (sha256
833 (base32 "0g4jyp47iz97ld9ac4wb5k59j4cs8dbw4dp8f32bwqx8pyvirz6y"))))
834 (build-system gnu-build-system)
835 (arguments
836 (list
837 #:tests? #f ;no tests
838 #:make-flags
839 #~(list (string-append "prefix=" #$output)
840 "INSTALL=install"
841 "release" "shared")
842 #:phases
843 #~(modify-phases %standard-phases
844 (add-after 'unpack 'patch-makefile
845 (lambda _
846 (substitute* "build/gcc/Makefile"
847 (("CBASEFLAGS = -Wall -Wextra -fno-rtti -fno-exceptions -std=c\\+\\+11")
848 "CBASEFLAGS = -Wall -Wextra -fno-rtti -fno-exceptions -std=c++17"))))
849 (replace 'configure
850 (lambda _
851 (chdir "build/gcc")))
852 (add-after 'install 'install-more
853 (lambda* (#:key outputs #:allow-other-keys)
854 ;; Libraries and headers aren't installed by default.
855 (let ((include (string-append #$output "/include"))
856 (lib (string-append #$output "/lib")))
857 (mkdir-p include)
858 (copy-file "../../src/astyle.h"
859 (string-append include "/astyle.h"))
860 (mkdir-p lib)
861 (for-each (lambda (l)
862 (copy-file
863 l (string-append lib "/" (basename l))))
864 (find-files "bin" "^lib.*\\.so"))))))))
865 (home-page "https://astyle.sourceforge.net/")
866 (synopsis "Source code indenter, formatter, and beautifier")
867 (description
868 "Artistic Style is a source code indenter, formatter, and beautifier for
869the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
870 (license license:lgpl3+)))
871
872(define-public idutils
873 (package
874 (name "idutils")
875 (version "4.6")
876 (source
877 (origin
878 (method url-fetch)
879 (uri (string-append "mirror://gnu/idutils/idutils-" version ".tar.xz"))
880 (sha256
881 (base32 "1hmai3422iaqnp34kkzxdnywl7n7pvlxp11vrw66ybxn9wxg90c1"))
882 (modules '((guix build utils)))
883 (snippet
884 '(begin
885 (substitute* (find-files "lib" "\\.c$")
886 (("#if defined _IO_ftrylockfile")
887 "#if defined _IO_EOF_SEEN"))
888 (substitute* "lib/stdio-impl.h"
889 (("^/\\* BSD stdio derived implementations")
890 (string-append
891 "#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN" "\n"
892 "# define _IO_IN_BACKUP 0x100\n" "#endif\n\n"
893 "/* BSD stdio derived implementations")))
894
895 ;; 'gets' is deprecated in glibc 2.33 and its declaration is
896 ;; no longer visible by default from <stdio.h>.
897 (substitute* "lib/stdio.in.h"
898 (("_GL_WARN_ON_USE \\(gets.*")
899 ""))))))
900 (build-system gnu-build-system)
901 (native-inputs (list emacs-minimal))
902 (home-page "https://www.gnu.org/software/idutils/")
903 (synopsis "Identifier database utilities")
904 (description
905 "The GNU idutils package includes tools to create an index of textual
906tokens used in a list of file names and then to query that index. Thus, it
907allows the user to, for example, find all the uses of a particular function
908in a large programming project. In addition to handling textual tokens, it
909can also handle numeric constants and the contents of character strings.")
910 (license license:gpl3+)))
911
912(define-public indent
913 ;; XXX: Not released anymore, but some patches fix CVEs.
914 (let ((commit "1737c929cbe2ec8a181107df9742894a44c57f71")
915 (revision "0"))
916 (package
917 (name "indent")
918 (version (git-version "2.2.13" revision commit))
919 (source
920 (origin
921 (method git-fetch)
922 (uri (git-reference
923 (url "https://git.savannah.gnu.org/git/indent")
924 (commit commit)))
925 (file-name (git-file-name name version))
926 (sha256
927 (base32 "138bqlwvfjv3w1plw2zzf0nqw38lhgimzx1gic6p8r5kizjp9123"))))
928 (build-system gnu-build-system)
929 (arguments
930 (list #:phases
931 #~(modify-phases %standard-phases
932 (add-after 'unpack 'patch-bootstrap
933 (lambda _
934 (substitute* "bootstrap"
935 (("^(wget|\\./configure|rm)" all)
936 (string-append "#" all)))
937 (call-with-output-file "doc/version.texi"
938 (lambda (port)
939 (format port "\
940@set UPDATED
941@set EDITION ~a
942@set VERSION ~a"
943 #$version
944 #$version))))))))
945 (native-inputs
946 (list autoconf-2.71 automake gettext-minimal texinfo))
947 (home-page "https://www.gnu.org/software/indent/")
948 (synopsis "Code reformatter")
949 (description
950 "Indent is a program that makes source code easier to read by
951reformatting it in a consistent style. It can change the style to one of
952several different styles such as GNU, BSD or K&R. It has some flexibility to
953deal with incomplete or malformed syntax. GNU indent offers several
954extensions over the standard utility.")
955 (license license:gpl3+)
956 (properties '((lint-hidden-cves . ("CVE-2023-40305"
957 "CVE-2024-0911")))))))
958
959(define-public sourcetrail
960 (package
961 (name "sourcetrail")
962 (version "2.1.0")
963 (source
964 (origin
965 (method git-fetch)
966 (uri (git-reference
967 (url "https://github.com/OpenSourceSourceTrail/Sourcetrail")
968 (commit version)
969 (recursive? #t)))
970 (patches (search-patches "sourcetrail-fix-cmakelists-and-paths.patch"))
971 (file-name (git-file-name name version))
972 (sha256
973 "0ya737byp1204sc5l11zi7fn7fgvqmcwyq84lbdxhyjvyfhb8598")
974 (modules '((guix build utils)))
975 (snippet #~(begin
976 (for-each delete-file-recursively
977 '(".conan" ".devcontainer"
978 ".github"
979 "conanfile.txt"
980 "scripts"
981 "bin/app/data/install"
982 "bin/app/user/log"))))))
983 (build-system cmake-build-system)
984 (arguments
985 (let* ((split-version (string-split version
986 (lambda (c)
987 (or (eqv? c #\.)
988 (eqv? c #\-)))))
989 (major-version (first split-version))
990 (minor-version (second split-version))
991 (version-patch (third split-version)))
992 (list #:configure-flags #~(list "-DENABLE_UNIT_TEST=true"
993 "-DENABLE_GUI_TEST=true"
994 "-DENABLE_INTERGRATION_TEST=true"
995 (string-append "-DVERSION_MAJOR="
996 #$major-version)
997 (string-append "-DVERSION_MINOR="
998 #$minor-version)
999 (string-append "-DVERSION_PATCH="
1000 #$version-patch)
1001 "-DLLVM_ENABLE_PROJECTS:STRING=clang"
1002 "-DLLVM_ENABLE_RTTI:BOOL=ON"
1003 "-DCLANG_LINK_CLANG_DYLIB:BOOL=ON"
1004 "-DLLVM_LINK_LLVM_DYLIB:BOOL=ON"
1005 "-DLLVM_TARGETS_TO_BUILD=host"
1006 "-DBUILD_CXX_LANGUAGE_PACKAGE=ON"
1007 (string-append "-DClang_DIR="
1008 #$clang-19
1009 "/lib/cmake/clang"))
1010 #:phases #~(modify-phases %standard-phases
1011 (add-after 'unpack 'fix-paths
1012 (lambda* (#:key inputs #:allow-other-keys)
1013 (substitute* "src/lib_gui/tests/utilityAppTestSuite.cpp"
1014 (("/usr/bin/bash")
1015 (search-input-file inputs "/bin/bash")))
1016 (substitute* "CMakeLists.txt"
1017 (("@OUTPUT_DIR@")
1018 #$output))))
1019 (add-after 'install 'install-projects
1020 (lambda _
1021 (let ((src (string-append #$output
1022 "/share/sourcetrail/user/projects"))
1023 (dst (string-append #$output:projects
1024 "/share/sourcetrail/user/projects")))
1025 (copy-recursively src dst)
1026 (delete-file-recursively src))))))))
1027 (inputs (list boost-1.83
1028 clang-19
1029 expected-lite
1030 qt5compat
1031 qtbase
1032 qtnetworkauth
1033 qtsvg
1034 qtwayland
1035 range-v3
1036 spdlog
1037 sqlite
1038 tinyxml))
1039 (native-inputs (list googletest))
1040 (home-page "https://github.com/OpenSourceSourceTrail/Sourcetrail")
1041 (synopsis "Graphical cross-platform source code browser for C/C++")
1042 (description
1043 "Sourcetrail is a free and open-source cross-platform source explorer
1044that helps you get productive on unfamiliar source code. It includes support
1045for C/C++, providing a graphical means for discovering symbols and their place
1046in a project.")
1047 (license license:gpl3)))
1048
1049(define-public universal-ctags
1050 (package
1051 (name "universal-ctags")
1052 (version "6.2.1")
1053 (source
1054 (origin
1055 (method git-fetch)
1056 (uri (git-reference
1057 (url "https://github.com/universal-ctags/ctags")
1058 (commit (string-append "v" version))))
1059 (file-name (git-file-name name version))
1060 (sha256
1061 (base32
1062 "04i9fhhifs82d39z2dskscp7v2885g7isjn9r9zm4wsl6dcnb5n7"))
1063 (modules '((guix build utils)))
1064 (snippet
1065 '(begin
1066 ;; Remove the bundled PackCC and associated build rules.
1067 (substitute* "Makefile.am"
1068 (("^PACKCC = .*")
1069 "PACKCC = packcc\n")
1070 (("\\$\\(PACKCC_FILES\\)")
1071 "")
1072 (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): \\$\\(PACKCC\\)")
1073 "$(PEG_SRCS) $(PEG_HEADS):"))
1074 (delete-file-recursively "misc/packcc")
1075 (delete-file "autogen.sh")))))
1076 (build-system gnu-build-system)
1077 (arguments
1078 '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime.
1079 #:configure-flags '("--enable-tmpdir=/tmp")
1080 #:test-target "units"
1081 #:phases (modify-phases %standard-phases
1082 (add-after 'unpack 'make-files-writable
1083 (lambda _
1084 (for-each make-file-writable (find-files "."))))
1085 (add-before 'bootstrap 'patch-misc
1086 (lambda _
1087 ;; The autogen.sh script calls out to these scripts, so
1088 ;; we cannot wait for the patch-source-shebangs phase.
1089 (for-each patch-shebang (find-files "misc"))))
1090 (add-before 'check 'patch-tests
1091 (lambda _
1092 (substitute* "misc/units"
1093 (("SHELL=/bin/sh")
1094 (string-append "SHELL=" (which "sh"))))
1095 (substitute* "Tmain/utils.sh"
1096 (("/bin/echo") (which "echo"))))))))
1097 (native-inputs
1098 (list autoconf automake packcc perl pkg-config python-docutils))
1099 (inputs
1100 (list jansson libseccomp libxml2 libyaml pcre2))
1101 (home-page "https://ctags.io/")
1102 (synopsis "Generate tag files for source code")
1103 (description
1104 "Universal Ctags generates an index (or tag) file of language objects
1105found in source files for many popular programming languages. This index
1106makes it easy for text editors and other tools to locate the indexed items.
1107Universal Ctags improves on traditional ctags because of its multilanguage
1108support, its ability for the user to define new languages searched by regular
1109expressions, and its ability to generate emacs-style TAGS files.")
1110 (license license:gpl2+)))
1111
1112(define-public xenon
1113 (package
1114 (name "xenon")
1115 (version "0.9.3")
1116 (source
1117 (origin
1118 (method url-fetch)
1119 (uri (pypi-uri "xenon" version))
1120 (sha256
1121 (base32
1122 "1yj31bqz2bphvvyb0jkas7bxc2rw76rf1csz0mwmvah8pbc3hxaa"))))
1123 (build-system pyproject-build-system)
1124 ;; Test suite not shipped with the PyPI archive; tests in Git require
1125 ;; network access.
1126 (arguments (list #:tests? #f))
1127 (native-inputs
1128 (list python-setuptools))
1129 (inputs
1130 (list python-pyyaml
1131 python-radon
1132 python-requests))
1133 (home-page "https://xenon.readthedocs.org/")
1134 (synopsis "Monitor code metrics for Python on your CI server")
1135 (description
1136 "Xenon is a monitoring tool based on Radon. It monitors code complexity.
1137Ideally, @code{xenon} is run every time code is committed. Through command
1138line options, various thresholds can be set for the complexity of code. It
1139will fail (i.e., it will exit with a non-zero exit code) when any of these
1140requirements is not met.")
1141 (properties '((lint-hidden-cpe-vendors . ("vmware"))))
1142 (license license:expat)))