projects/guix·blob hurd-team · refs

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