projects/guix·blob wip-node-riscv64 · refs

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