projects/guix·blob go-team · refs

1168 lines · 48.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-vcs)
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.7")
282 (source (origin
283 (method url-fetch)
284 (uri (string-append "mirror://gnu/global/global-"
285 version ".tar.gz"))
286 (sha256
287 (base32
288 "1xwbbhm5yydhpfdspsywwid5kj62c1z1ricrbvanhbfskc65kazx"))))
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.10")
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 "03isq42ndgg7gr1wpmn8ax2hx7dh00nfx02xzfcya5grc7dn95q7"))))
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 "4.1.0")
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 "025iqg1d53qf87pbplh686xxxirz07ffzmgrmn4ayy5by31g95ra"))
491 (modules '((guix build utils)))
492 (snippet #~(begin (delete-file-recursively "vendor")))))
493 (build-system go-build-system)
494 (arguments
495 (list
496 #:install-source? #f
497 #:import-path "github.com/boyter/scc"
498 #:embed-files
499 ;; For go-github-com-santhosh-tekuri-jsonschema-v6:
500 #~(list "applicator"
501 "content"
502 "core"
503 "format"
504 "format-annotation"
505 "format-assertion"
506 "meta-data"
507 "schema"
508 "unevaluated"
509 "validation")
510 #:test-flags
511 ;; One test fails to compare UNICODE strings.
512 #~(list "-skip" "TestUnicodeAwareTrimMatchesOneAtATime")
513 #:test-subdirs
514 ;; package github.com/boyter/scc/examples/language: C source files not
515 ;; allowed when not using cgo or SWIG: c.c
516 #~(list "." "cmd/badges" "processor")))
517 (native-inputs
518 (list go-github-com-agnivade-levenshtein
519 go-github-com-boyter-gocodewalker
520 go-github-com-boyter-simplecache
521 go-github-com-clipperhouse-uax29-v2
522 go-github-com-go-git-go-git-v5
523 go-github-com-json-iterator-go
524 go-github-com-mark3labs-mcp-go
525 go-github-com-mattn-go-isatty
526 go-github-com-mattn-go-runewidth
527 go-github-com-rs-zerolog
528 go-github-com-spf13-cobra
529 go-github-com-spf13-pflag
530 go-go-yaml-in-yaml-v2
531 go-golang-org-x-crypto
532 go-golang-org-x-text))
533 (home-page "https://github.com/boyter/scc")
534 (synopsis "Sloc, Cloc and Code")
535 (description
536 "@command{scc} provides a lines-of-code counter similar to tools like
537@command{cloc} and @command{sloccount}. It aims to be fast as possible while
538supporting @acronym{COCOMO,Constructive Cost Model} calculation and code
539complexity estimation.")
540 (license license:expat)))
541
542(define-public the-silver-searcher
543 (package
544 (name "the-silver-searcher")
545 (version "2.2.0")
546 (source (origin
547 (method url-fetch)
548 (uri (string-append
549 "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
550 version ".tar.gz"))
551 (sha256
552 (base32
553 "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
554 (build-system gnu-build-system)
555 (arguments
556 ;; Required since GCC 10, see:
557 ;; https://gcc.gnu.org/gcc-10/porting_to.html.
558 `(#:configure-flags (list "CFLAGS=-fcommon")))
559 (native-inputs
560 (list pkg-config))
561 (inputs
562 (list pcre xz zlib))
563 (home-page "https://geoff.greer.fm/ag/")
564 (synopsis "Fast code searching tool")
565 (description
566 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
567numbers of files. It's intended primarily for source code repositories, and
568respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
569of magnitude faster than its inspiration, @command{ack}, and less specialised
570tools such as @command{grep}.")
571 (license license:asl2.0)))
572
573(define-public trio
574 (package
575 (name "trio")
576 (version "1.16")
577 (source (origin
578 (method url-fetch)
579 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
580 version ".tar.gz"))
581 (sha256
582 (base32
583 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
584 (build-system gnu-build-system)
585 (home-page "https://daniel.haxx.se/projects/trio/")
586 (synopsis "Portable and extendable printf and string functions")
587 (description
588 "Trio is a set of @code{printf} and string functions designed be used by
589applications with a focus on portability or with the need for additional
590features that are not supported by the standard @code{stdio} implementation.")
591 ;; This license is very similar to the ISC license, but the wording is
592 ;; slightly different.
593 (license (license:non-copyleft
594 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
595
596(define-public lcov
597 (package
598 (name "lcov")
599 (version "1.16")
600 (source
601 (origin
602 (method url-fetch)
603 (uri (string-append "https://github.com/linux-test-project/lcov"
604 "/releases/download/v" version
605 "/lcov-" version ".tar.gz"))
606 (sha256
607 (base32 "02r4wdl5d694aaxc5fgjw4nl3zmzq45khaxmsi3agj18annk2w4q"))))
608 (build-system gnu-build-system)
609 (arguments
610 '(#:test-target "test"
611 #:make-flags (list (string-append "PREFIX="
612 (assoc-ref %outputs "out")))
613 ;; This test suite has race conditions in its scripts which make it
614 ;; unreliable when run in parallel.
615 #:parallel-tests? #f
616 #:phases
617 (modify-phases %standard-phases
618 (add-after 'unpack 'patch-references-to-commands
619 (lambda* (#:key inputs #:allow-other-keys)
620 ;; Lift the requirement of having a shell and 'find' in PATH.
621 (substitute* "bin/geninfo"
622 (("qw/abs_path/")
623 "qw/abs_path getcwd/"))
624 (substitute* '("bin/lcov" "bin/geninfo")
625 (("`pwd`")
626 "getcwd()")
627 (("`find ")
628 (string-append "`"
629 (search-input-file inputs "/bin/find")
630 " ")))))
631 (delete 'configure) ;no configure script
632 (add-after 'install 'wrap
633 (lambda* (#:key outputs #:allow-other-keys)
634 (let ((out (assoc-ref outputs "out")))
635 (wrap-program (string-append out "/bin/geninfo")
636 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB"))))))))))
637 (inputs (list bash-minimal perl perl-io-compress perl-json))
638 (home-page "https://ltp.sourceforge.net/coverage/lcov.php")
639 (synopsis "Code coverage tool that enhances GNU gcov")
640 (description "LCOV is an extension of @command{gcov}, a tool part of the
641GNU@tie{}Binutils, which provides information about what parts of a program
642are actually executed (i.e., \"covered\") while running a particular test
643case. The extension consists of a set of Perl scripts which build on the
644textual @command{gcov} output to implement the following enhanced
645functionality such as HTML output.")
646 (license license:gpl2+)))
647
648(define-public lcov-cobertura
649 (package
650 (name "lcov-cobertura")
651 (version "2.1.1")
652 (source
653 (origin
654 (method url-fetch)
655 (uri (pypi-uri "lcov_cobertura" version))
656 (sha256
657 (base32 "13xmr249c6qygm14gilb0icrsgb35ghsrr14a1zvppmxy9jf5a7g"))))
658 (build-system pyproject-build-system)
659 (arguments
660 (list
661 #:phases
662 #~(modify-phases %standard-phases
663 (add-after 'unpack 'patch-source
664 (lambda _
665 ;; Prevent setuptools.errors.InvalidConfigError:
666 ;; License classifiers have been superseded by license expressions
667 ;; (see https://peps.python.org/pep-0639/). Please remove:
668 ;; License :: OSI Approved :: Apache Software License
669 ;; Reported upstream:
670 ;; https://github.com/eriwen/lcov-to-cobertura-xml/pull/65
671 (substitute* "setup.cfg"
672 (("\tLicense :: OSI Approved :: Apache Software License\n")
673 "")))))))
674 (native-inputs
675 (list python-pytest
676 python-setuptools
677 python-setuptools-scm
678 python-wheel
679 python-xmldiff))
680 (home-page "https://eriwen.github.io/lcov-to-cobertura-xml/")
681 (synopsis "LCOV to Cobertura XML converter")
682 (description
683 "The lcov-to-cobertura Python module converts code coverage report files
684in the lcov format to the XML format of
685@uref{http://cobertura.github.io/cobertura/, Cobertura}, a Java code coverage
686tool. It allows continuous integration servers like Jenkins to aggregate
687results and determine build stability.")
688 (license license:asl2.0)))
689
690(define-public kcov
691 (package
692 (name "kcov")
693 (version "42")
694 (source (origin
695 (method git-fetch)
696 (uri (git-reference
697 (url "https://github.com/SimonKagstrom/kcov")
698 (commit (string-append "v" version))))
699 (file-name (git-file-name name version))
700 (sha256
701 (base32
702 "14pyahpgadh845q2p1gjw2yrlqcan4n870icrn2yqdpf33cprzgk"))))
703 (build-system cmake-build-system)
704 (arguments
705 `(#:tests? #f ; no test target
706 #:phases
707 (modify-phases %standard-phases
708 (add-after 'unpack 'fix-/bin/bash-references
709 (lambda* (#:key inputs #:allow-other-keys)
710 (substitute* (find-files "src" ".*\\.cc?$")
711 (("/bin/(bash|sh)" shell)
712 (search-input-file inputs shell))))))))
713 (inputs
714 (list curl elfutils libelf openssl zlib))
715 (native-inputs
716 (list python))
717 (home-page "https://github.com/SimonKagstrom/kcov")
718 (synopsis "Code coverage tester for compiled languages, Python and Bash")
719 (description "Kcov is a code coverage tester for compiled languages,
720Python and Bash. It was originally a fork of Bcov, but has since evolved to
721support a large feature set in addition to that of Bcov.
722
723Kcov uses DWARF debugging information for compiled programs to make it
724possible to collect coverage information without special compiler switches.")
725 (license license:gpl2+)))
726
727(define-public colormake
728 (package
729 (name "colormake")
730 (version "0.9.20140503")
731 (source
732 (origin
733 (method git-fetch)
734 (uri (git-reference
735 (url "https://github.com/pagekite/Colormake")
736 (commit version)))
737 (file-name (git-file-name name version))
738 (sha256
739 (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
740 (build-system trivial-build-system)
741 (native-inputs
742 (list bash perl))
743 (arguments
744 `(#:modules ((guix build utils))
745 #:builder
746 (begin
747 (use-modules (guix build utils))
748 (copy-recursively (assoc-ref %build-inputs "source") "source")
749 (chdir "source")
750 (patch-shebang "colormake.pl"
751 (list (string-append (assoc-ref %build-inputs "perl")
752 "/bin")))
753 (let* ((out (assoc-ref %outputs "out"))
754 (bin (string-append out "/bin"))
755 (doc (string-append out "/share/doc"))
756 (install-files (lambda (files directory)
757 (for-each (lambda (file)
758 (install-file file directory))
759 files))))
760 (substitute* "colormake"
761 (("colormake\\.pl") (string-append bin "/colormake.pl"))
762 (("/bin/bash")
763 (search-input-file %build-inputs "/bin/sh")))
764 (install-file "colormake.1" (string-append doc "/man/man1"))
765 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
766 (install-files '("colormake" "colormake-short" "clmake"
767 "clmake-short" "colormake.pl")
768 bin)
769 #t))))
770 (home-page "https://bre.klaki.net/programs/colormake/")
771 (synopsis "Wrapper around @command{make} to produce colored output")
772 (description "This package provides a wrapper around @command{make} to
773produce colored output.")
774 (license license:gpl2+)))
775
776(define-public makefile2graph
777 (package
778 (name "makefile2graph")
779 (version "1.5.0")
780 (source
781 (origin
782 (method git-fetch)
783 (uri (git-reference
784 (url "https://github.com/lindenb/makefile2graph")
785 (commit (string-append "v" version))))
786 (file-name (git-file-name name version))
787 (sha256
788 (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
789 (build-system gnu-build-system)
790 (arguments
791 (list
792 #:test-target "test"
793 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
794 (string-append "prefix=" #$output))
795 #:phases
796 #~(modify-phases %standard-phases
797 (delete 'configure))))
798 (native-inputs
799 (list graphviz))
800 (home-page "https://github.com/lindenb/makefile2graph")
801 (synopsis "Creates a graph of dependencies from GNU Make")
802 (description
803 "@code{make2graph} creates a graph of dependencies from GNU Make. The
804output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
805independent targets.")
806 (license license:expat)))
807
808(define-public uncrustify
809 (package
810 (name "uncrustify")
811 (version "0.80.1")
812 (source (origin
813 (method git-fetch)
814 (uri (git-reference
815 (url "https://github.com/uncrustify/uncrustify/")
816 (commit (string-append name "-" version))))
817 (file-name (git-file-name name version))
818 (sha256
819 (base32
820 "1n7ifr4i35ii5zaia61jdd61virbygc00anhc9iq3p5gzjlfxhsa"))))
821 (build-system cmake-build-system)
822 (native-inputs (list python-wrapper))
823 (arguments
824 (list #:phases
825 #~(modify-phases %standard-phases
826 (add-after 'unpack 'unpack-etc
827 (lambda* (#:key inputs outputs #:allow-other-keys)
828 ;; Configuration samples are not installed by default.
829 (let* ((output (assoc-ref outputs "out"))
830 (etcdir (string-append output "/etc")))
831 (for-each (lambda (l)
832 (install-file l etcdir))
833 (find-files "etc" "\\.cfg$"))))))))
834 (home-page "https://uncrustify.sourceforge.net/")
835 (synopsis "Code formatter for C and other related languages")
836 (description
837 "Beautify source code in many languages of the C family (C, C++, C#,
838Objective@tie{}C, D, Java, Pawn, and Vala). Features:
839@itemize
840@item Indent and align code.
841@item Reformat comments (a little bit).
842@item Fix inter-character spacing.
843@item Add or remove parens / braces.
844@item Supports embedded SQL @code{EXEC SQL} stuff.
845@item Highly configurable - More than 600 configurable options.
846@end itemize\n")
847 (license license:gpl2+)))
848
849(define-public astyle
850 (package
851 (name "astyle")
852 (version "3.5")
853 (source
854 (origin
855 (method url-fetch)
856 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
857 version "/astyle-" version ".tar.bz2"))
858 (sha256
859 (base32 "0g4jyp47iz97ld9ac4wb5k59j4cs8dbw4dp8f32bwqx8pyvirz6y"))))
860 (build-system gnu-build-system)
861 (arguments
862 (list
863 #:tests? #f ;no tests
864 #:make-flags
865 #~(list (string-append "prefix=" #$output)
866 "INSTALL=install"
867 "release" "shared")
868 #:phases
869 #~(modify-phases %standard-phases
870 (add-after 'unpack 'patch-makefile
871 (lambda _
872 (substitute* "build/gcc/Makefile"
873 (("CBASEFLAGS = -Wall -Wextra -fno-rtti -fno-exceptions -std=c\\+\\+11")
874 "CBASEFLAGS = -Wall -Wextra -fno-rtti -fno-exceptions -std=c++17"))))
875 (replace 'configure
876 (lambda _
877 (chdir "build/gcc")))
878 (add-after 'install 'install-more
879 (lambda* (#:key outputs #:allow-other-keys)
880 ;; Libraries and headers aren't installed by default.
881 (let ((include (string-append #$output "/include"))
882 (lib (string-append #$output "/lib")))
883 (mkdir-p include)
884 (copy-file "../../src/astyle.h"
885 (string-append include "/astyle.h"))
886 (mkdir-p lib)
887 (for-each (lambda (l)
888 (copy-file
889 l (string-append lib "/" (basename l))))
890 (find-files "bin" "^lib.*\\.so"))))))))
891 (home-page "https://astyle.sourceforge.net/")
892 (synopsis "Source code indenter, formatter, and beautifier")
893 (description
894 "Artistic Style is a source code indenter, formatter, and beautifier for
895the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
896 (license license:lgpl3+)))
897
898(define-public idutils
899 (package
900 (name "idutils")
901 (version "4.6")
902 (source
903 (origin
904 (method url-fetch)
905 (uri (string-append "mirror://gnu/idutils/idutils-" version ".tar.xz"))
906 (sha256
907 (base32 "1hmai3422iaqnp34kkzxdnywl7n7pvlxp11vrw66ybxn9wxg90c1"))
908 (modules '((guix build utils)))
909 (snippet
910 '(begin
911 (substitute* (find-files "lib" "\\.c$")
912 (("#if defined _IO_ftrylockfile")
913 "#if defined _IO_EOF_SEEN"))
914 (substitute* "lib/stdio-impl.h"
915 (("^/\\* BSD stdio derived implementations")
916 (string-append
917 "#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN" "\n"
918 "# define _IO_IN_BACKUP 0x100\n" "#endif\n\n"
919 "/* BSD stdio derived implementations")))
920
921 ;; 'gets' is deprecated in glibc 2.33 and its declaration is
922 ;; no longer visible by default from <stdio.h>.
923 (substitute* "lib/stdio.in.h"
924 (("_GL_WARN_ON_USE \\(gets.*")
925 ""))))))
926 (build-system gnu-build-system)
927 (native-inputs (list emacs-minimal))
928 (home-page "https://www.gnu.org/software/idutils/")
929 (synopsis "Identifier database utilities")
930 (description
931 "The GNU idutils package includes tools to create an index of textual
932tokens used in a list of file names and then to query that index. Thus, it
933allows the user to, for example, find all the uses of a particular function
934in a large programming project. In addition to handling textual tokens, it
935can also handle numeric constants and the contents of character strings.")
936 (license license:gpl3+)))
937
938(define-public indent
939 ;; XXX: Not released anymore, but some patches fix CVEs.
940 (let ((commit "1737c929cbe2ec8a181107df9742894a44c57f71")
941 (revision "0"))
942 (package
943 (name "indent")
944 (version (git-version "2.2.13" revision commit))
945 (source
946 (origin
947 (method git-fetch)
948 (uri (git-reference
949 (url "https://git.savannah.gnu.org/git/indent")
950 (commit commit)))
951 (file-name (git-file-name name version))
952 (sha256
953 (base32 "138bqlwvfjv3w1plw2zzf0nqw38lhgimzx1gic6p8r5kizjp9123"))))
954 (build-system gnu-build-system)
955 (arguments
956 (list #:phases
957 #~(modify-phases %standard-phases
958 (add-after 'unpack 'patch-bootstrap
959 (lambda _
960 (substitute* "bootstrap"
961 (("^(wget|\\./configure|rm)" all)
962 (string-append "#" all)))
963 (call-with-output-file "doc/version.texi"
964 (lambda (port)
965 (format port "\
966@set UPDATED
967@set EDITION ~a
968@set VERSION ~a"
969 #$version
970 #$version))))))))
971 (native-inputs
972 (list autoconf-2.71 automake gettext-minimal texinfo))
973 (home-page "https://www.gnu.org/software/indent/")
974 (synopsis "Code reformatter")
975 (description
976 "Indent is a program that makes source code easier to read by
977reformatting it in a consistent style. It can change the style to one of
978several different styles such as GNU, BSD or K&R. It has some flexibility to
979deal with incomplete or malformed syntax. GNU indent offers several
980extensions over the standard utility.")
981 (license license:gpl3+)
982 (properties '((lint-hidden-cves . ("CVE-2023-40305"
983 "CVE-2024-0911")))))))
984
985(define-public sourcetrail
986 (package
987 (name "sourcetrail")
988 (version "2.1.0")
989 (source
990 (origin
991 (method git-fetch)
992 (uri (git-reference
993 (url "https://github.com/OpenSourceSourceTrail/Sourcetrail")
994 (commit version)
995 (recursive? #t)))
996 (patches (search-patches "sourcetrail-fix-cmakelists-and-paths.patch"))
997 (file-name (git-file-name name version))
998 (sha256
999 "0ya737byp1204sc5l11zi7fn7fgvqmcwyq84lbdxhyjvyfhb8598")
1000 (modules '((guix build utils)))
1001 (snippet #~(begin
1002 (for-each delete-file-recursively
1003 '(".conan" ".devcontainer"
1004 ".github"
1005 "conanfile.txt"
1006 "scripts"
1007 "bin/app/data/install"
1008 "bin/app/user/log"))))))
1009 (build-system cmake-build-system)
1010 (arguments
1011 (let* ((split-version (string-split version
1012 (lambda (c)
1013 (or (eqv? c #\.)
1014 (eqv? c #\-)))))
1015 (major-version (first split-version))
1016 (minor-version (second split-version))
1017 (version-patch (third split-version)))
1018 (list #:configure-flags #~(list "-DENABLE_UNIT_TEST=true"
1019 "-DENABLE_GUI_TEST=true"
1020 "-DENABLE_INTERGRATION_TEST=true"
1021 (string-append "-DVERSION_MAJOR="
1022 #$major-version)
1023 (string-append "-DVERSION_MINOR="
1024 #$minor-version)
1025 (string-append "-DVERSION_PATCH="
1026 #$version-patch)
1027 "-DLLVM_ENABLE_PROJECTS:STRING=clang"
1028 "-DLLVM_ENABLE_RTTI:BOOL=ON"
1029 "-DCLANG_LINK_CLANG_DYLIB:BOOL=ON"
1030 "-DLLVM_LINK_LLVM_DYLIB:BOOL=ON"
1031 "-DLLVM_TARGETS_TO_BUILD=host"
1032 "-DBUILD_CXX_LANGUAGE_PACKAGE=ON"
1033 (string-append "-DClang_DIR="
1034 #$clang-19
1035 "/lib/cmake/clang"))
1036 #:phases #~(modify-phases %standard-phases
1037 (add-after 'unpack 'fix-paths
1038 (lambda* (#:key inputs #:allow-other-keys)
1039 (substitute* "src/lib_gui/tests/utilityAppTestSuite.cpp"
1040 (("/usr/bin/bash")
1041 (search-input-file inputs "/bin/bash")))
1042 (substitute* "CMakeLists.txt"
1043 (("@OUTPUT_DIR@")
1044 #$output))))
1045 (add-after 'install 'install-projects
1046 (lambda _
1047 (let ((src (string-append #$output
1048 "/share/sourcetrail/user/projects"))
1049 (dst (string-append #$output:projects
1050 "/share/sourcetrail/user/projects")))
1051 (copy-recursively src dst)
1052 (delete-file-recursively src))))))))
1053 (inputs (list boost-1.83
1054 clang-19
1055 expected-lite
1056 qt5compat
1057 qtbase
1058 qtnetworkauth
1059 qtsvg
1060 qtwayland
1061 range-v3
1062 spdlog
1063 sqlite
1064 tinyxml))
1065 (native-inputs (list googletest))
1066 (home-page "https://github.com/OpenSourceSourceTrail/Sourcetrail")
1067 (synopsis "Graphical cross-platform source code browser for C/C++")
1068 (description
1069 "Sourcetrail is a free and open-source cross-platform source explorer
1070that helps you get productive on unfamiliar source code. It includes support
1071for C/C++, providing a graphical means for discovering symbols and their place
1072in a project.")
1073 (license license:gpl3)))
1074
1075(define-public universal-ctags
1076 (package
1077 (name "universal-ctags")
1078 (version "6.2.1")
1079 (source
1080 (origin
1081 (method git-fetch)
1082 (uri (git-reference
1083 (url "https://github.com/universal-ctags/ctags")
1084 (commit (string-append "v" version))))
1085 (file-name (git-file-name name version))
1086 (sha256
1087 (base32
1088 "04i9fhhifs82d39z2dskscp7v2885g7isjn9r9zm4wsl6dcnb5n7"))
1089 (modules '((guix build utils)))
1090 (snippet
1091 '(begin
1092 ;; Remove the bundled PackCC and associated build rules.
1093 (substitute* "Makefile.am"
1094 (("^PACKCC = .*")
1095 "PACKCC = packcc\n")
1096 (("\\$\\(PACKCC_FILES\\)")
1097 "")
1098 (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): \\$\\(PACKCC\\)")
1099 "$(PEG_SRCS) $(PEG_HEADS):"))
1100 (delete-file-recursively "misc/packcc")
1101 (delete-file "autogen.sh")))))
1102 (build-system gnu-build-system)
1103 (arguments
1104 '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime.
1105 #:configure-flags '("--enable-tmpdir=/tmp")
1106 #:test-target "units"
1107 #:phases (modify-phases %standard-phases
1108 (add-after 'unpack 'make-files-writable
1109 (lambda _
1110 (for-each make-file-writable (find-files "."))))
1111 (add-before 'bootstrap 'patch-misc
1112 (lambda _
1113 ;; The autogen.sh script calls out to these scripts, so
1114 ;; we cannot wait for the patch-source-shebangs phase.
1115 (for-each patch-shebang (find-files "misc"))))
1116 (add-before 'check 'patch-tests
1117 (lambda _
1118 (substitute* "misc/units"
1119 (("SHELL=/bin/sh")
1120 (string-append "SHELL=" (which "sh"))))
1121 (substitute* "Tmain/utils.sh"
1122 (("/bin/echo") (which "echo"))))))))
1123 (native-inputs
1124 (list autoconf automake packcc perl pkg-config python-docutils))
1125 (inputs
1126 (list jansson libseccomp libxml2 libyaml pcre2))
1127 (home-page "https://ctags.io/")
1128 (synopsis "Generate tag files for source code")
1129 (description
1130 "Universal Ctags generates an index (or tag) file of language objects
1131found in source files for many popular programming languages. This index
1132makes it easy for text editors and other tools to locate the indexed items.
1133Universal Ctags improves on traditional ctags because of its multilanguage
1134support, its ability for the user to define new languages searched by regular
1135expressions, and its ability to generate emacs-style TAGS files.")
1136 (license license:gpl2+)))
1137
1138(define-public xenon
1139 (package
1140 (name "xenon")
1141 (version "0.9.3")
1142 (source
1143 (origin
1144 (method url-fetch)
1145 (uri (pypi-uri "xenon" version))
1146 (sha256
1147 (base32
1148 "1yj31bqz2bphvvyb0jkas7bxc2rw76rf1csz0mwmvah8pbc3hxaa"))))
1149 (build-system pyproject-build-system)
1150 ;; Test suite not shipped with the PyPI archive; tests in Git require
1151 ;; network access.
1152 (arguments (list #:tests? #f))
1153 (native-inputs
1154 (list python-setuptools))
1155 (inputs
1156 (list python-pyyaml
1157 python-radon
1158 python-requests))
1159 (home-page "https://xenon.readthedocs.org/")
1160 (synopsis "Monitor code metrics for Python on your CI server")
1161 (description
1162 "Xenon is a monitoring tool based on Radon. It monitors code complexity.
1163Ideally, @code{xenon} is run every time code is committed. Through command
1164line options, various thresholds can be set for the complexity of code. It
1165will fail (i.e., it will exit with a non-zero exit code) when any of these
1166requirements is not met.")
1167 (properties '((lint-hidden-cpe-vendors . ("vmware"))))
1168 (license license:expat)))