records: Insert record type ABI checks in constructors.
[jackhill/guix/guix.git] / gnu / packages / code.scm
CommitLineData
23153c90 1;;; GNU Guix --- Functional package management for GNU
4b3070f7 2;;; Copyright © 2013, 2015, 2018 Ludovic Courtès <ludo@gnu.org>
99e64a6e 3;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
76e14638 4;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
cbf5eb84 5;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
b15af0ce 6;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
8af20b99 7;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
f7fc9667 8;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
4b3070f7 9;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
23153c90
LC
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages code)
27 #:use-module (guix packages)
28 #:use-module (guix download)
d13586bf 29 #:use-module ((guix licenses) #:prefix license:)
23153c90 30 #:use-module (guix build-system gnu)
76e14638 31 #:use-module (guix build-system cmake)
dc993847 32 #:use-module (guix build-system trivial)
457fc22d 33 #:use-module (gnu packages)
76e14638 34 #:use-module (gnu packages base)
d13586bf 35 #:use-module (gnu packages compression)
457fc22d 36 #:use-module (gnu packages cpp)
e1ac691d 37 #:use-module (gnu packages databases)
99e64a6e 38 #:use-module (gnu packages emacs)
76e14638 39 #:use-module (gnu packages gcc)
906dcb20 40 #:use-module (gnu packages graphviz)
d13586bf
41 #:use-module (gnu packages pcre)
42 #:use-module (gnu packages pkg-config)
99e64a6e
LC
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages autogen)
46 #:use-module (gnu packages ncurses)
4b3070f7
FT
47 #:use-module (gnu packages autotools)
48 #:use-module (gnu packages llvm)
457fc22d 49 #:use-module (gnu packages lua)
4b3070f7 50 #:use-module (gnu packages bash))
23153c90
LC
51
52;;; Tools to deal with source code: metrics, cross-references, etc.
53
99e64a6e
LC
54(define-public cflow
55 (package
56 (name "cflow")
cb307c08 57 (version "1.5")
99e64a6e
LC
58 (source (origin
59 (method url-fetch)
60 (uri (string-append "mirror://gnu/cflow/cflow-"
61 version ".tar.bz2"))
62 (sha256
63 (base32
cb307c08 64 "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
99e64a6e
LC
65 (build-system gnu-build-system)
66
67 ;; Needed to have cflow-mode.el installed.
b8fc3622 68 (native-inputs `(("emacs" ,emacs-minimal)))
65d98906
OP
69 (arguments
70 '(#:configure-flags (list (string-append "CPPFLAGS="
71 "-D" "CFLOW_PREPROC=\\\""
72 (assoc-ref %build-inputs "gcc")
73 "/bin/cpp\\\""))))
6fd52309 74 (home-page "https://www.gnu.org/software/cflow/")
99e64a6e
LC
75 (synopsis "Create a graph of control flow within a program")
76 (description
77 "GNU cflow analyzes C source files and produces a graph charting the
78control flow of the program. It can output the graph in several styles and
e881752c 79in either the POSIX format or in an extended GNU format. cflow also includes
99e64a6e 80a major mode for Emacs for examining the flowcharts that it produces.")
d13586bf 81 (license license:gpl3+)))
99e64a6e
LC
82
83(define-public complexity
84 (package
85 (name "complexity")
1e42d8b8 86 (version "1.10")
99e64a6e
LC
87 (source (origin
88 (method url-fetch)
89 (uri (string-append "mirror://gnu/complexity/complexity-"
1e42d8b8 90 version ".tar.xz"))
99e64a6e
LC
91 (sha256
92 (base32
1e42d8b8 93 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
99e64a6e
LC
94 (build-system gnu-build-system)
95 (native-inputs
96 `(("texinfo" ,texinfo)
97 ("autogen" ,autogen)))
6fd52309 98 (home-page "https://www.gnu.org/software/complexity/")
99e64a6e
LC
99 (synopsis "Analyze complexity of C functions")
100 (description
101 "GNU complexity provides tools for finding procedures that are
102convoluted, overly long or otherwise difficult to understand. This
103may help in learning or reviewing unfamiliar code or perhaps
104highlighting your own code that seemed comprehensible when you wrote it.")
d13586bf 105 (license license:gpl3+)))
99e64a6e
LC
106
107(define-public global ; a global variable
108 (package
109 (name "global")
0de57b44 110 (version "6.6.2")
99e64a6e
LC
111 (source (origin
112 (method url-fetch)
113 (uri (string-append "mirror://gnu/global/global-"
114 version ".tar.gz"))
115 (sha256
116 (base32
0de57b44 117 "0zvi5vxwiq0dy8mq2cgs64m8harxs0fvkmsnvi0ayb0w608lgij3"))))
99e64a6e
LC
118 (build-system gnu-build-system)
119 (inputs `(("ncurses" ,ncurses)
e1ac691d
LC
120 ("libltdl" ,libltdl)
121 ("sqlite" ,sqlite)))
99e64a6e
LC
122 (arguments
123 `(#:configure-flags
124 (list (string-append "--with-ncurses="
e1ac691d
LC
125 (assoc-ref %build-inputs "ncurses"))
126 (string-append "--with-sqlite3="
127 (assoc-ref %build-inputs "sqlite")))
99e64a6e 128
9d9951d6
EF
129 #:phases
130 (modify-phases %standard-phases
131 (add-after 'install 'post-install
132 (lambda* (#:key outputs #:allow-other-keys)
133 ;; Install the Emacs Lisp file in the right place.
134 (let* ((out (assoc-ref outputs "out"))
135 (data (string-append out "/share/gtags"))
136 (lisp (string-append out "/share/emacs/site-lisp")))
137 (install-file (string-append data "/gtags.el") lisp)
138 (delete-file (string-append data "/gtags.el"))
139 #t))))))
6fd52309 140 (home-page "https://www.gnu.org/software/global/")
99e64a6e
LC
141 (synopsis "Cross-environment source code tag system")
142 (description
254a8819
CL
143 "GNU GLOBAL is a source code tagging system that functions in the same
144way across a wide array of environments, such as different text editors,
145shells and web browsers. The resulting tags are useful for quickly moving
146around in a large, deeply nested project.")
d13586bf 147 (license license:gpl3+)))
99e64a6e 148
23153c90
LC
149(define-public sloccount
150 (package
151 (name "sloccount")
152 (version "2.26")
153 (source (origin
154 (method url-fetch)
155 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
156 version ".tar.gz"))
157 (sha256
158 (base32
159 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
160 (build-system gnu-build-system)
161 (arguments
162 '(#:phases (modify-phases %standard-phases
f8503e2b
LC
163 (delete 'configure)
164 (add-before 'build 'make-dotl-files-older
23153c90
LC
165 (lambda _
166 ;; Make the '.l' files as old as the '.c'
167 ;; files to avoid triggering the rule that
168 ;; requires Flex.
169 (define ref
170 (stat "README"))
171
172 (for-each (lambda (file)
173 (set-file-time file ref))
174 (find-files "." "\\.[chl]$"))
175 #t))
f8503e2b 176 (add-before 'install 'make-target-directories
23153c90
LC
177 (lambda* (#:key outputs #:allow-other-keys)
178 (let ((out (assoc-ref outputs "out")))
179 (mkdir-p (string-append out "/bin"))
180 (mkdir-p (string-append out
181 "/share/man/man1"))
182 (mkdir-p (string-append out
183 "/share/doc")))))
f8503e2b 184 (replace 'check
23153c90
LC
185 (lambda _
186 (setenv "HOME" (getcwd))
187 (setenv "PATH"
188 (string-append (getcwd) ":"
189 (getenv "PATH")))
190 (zero? (system* "make" "test")))))
191
192 #:make-flags (list (string-append "PREFIX="
193 (assoc-ref %outputs "out")))))
194 (inputs `(("perl" ,perl)))
195 (home-page "http://www.dwheeler.com/sloccount/")
196 (synopsis "Count physical source lines of code (SLOC)")
197 (description
198 "SLOCCount is a set of the programs for counting source lines of
199code (SLOC) in large software systems. It can automatically identify and
200measure a wide range of programming languages. It automatically estimates the
201effort, time, and money it would take to develop the software, using the
202COCOMO model or user-provided parameters.")
d13586bf
203 (license license:gpl2+)))
204
f7fc9667
AW
205(define-public cloc
206 (package
207 (name "cloc")
95943ed7 208 (version "1.76")
f7fc9667
AW
209 (source
210 (origin
211 (method url-fetch)
212 (uri (string-append
95943ed7 213 "https://github.com/AlDanial/cloc/releases/download/v" version
f7fc9667
AW
214 "/cloc-" version ".tar.gz"))
215 (sha256
216 (base32
95943ed7 217 "05srlvzwisr7y7ymvzb5yfdsrspja27ysqdmkwhiiivy84mq2gnl"))))
f7fc9667
AW
218 (build-system gnu-build-system)
219 (inputs
220 `(("coreutils" ,coreutils)
221 ("perl" ,perl)
222 ("perl-algorithm-diff" ,perl-algorithm-diff)
95943ed7
TGR
223 ("perl-digest-md5" ,perl-digest-md5)
224 ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
225 ("perl-regexp-common" ,perl-regexp-common)))
f7fc9667
AW
226 (arguments
227 `(#:phases (modify-phases %standard-phases
228 (delete 'configure)
229 (delete 'build)
230 (replace 'install
231 (lambda* (#:key inputs outputs #:allow-other-keys)
232 (let* ((out (assoc-ref outputs "out")))
53244d1f
TGR
233 (invoke "make" "-C" "Unix"
234 (string-append "prefix=" out)
235 (string-append "INSTALL="
236 (assoc-ref inputs "coreutils")
237 "/bin/install")
238 "install")
239 #t)))
f7fc9667
AW
240 (add-after 'install 'wrap-program
241 (lambda* (#:key inputs outputs #:allow-other-keys)
242 (let ((out (assoc-ref outputs "out")))
243 (wrap-program (string-append out "/bin/cloc")
244 `("PERL5LIB" ":" =
245 ,(string-split (getenv "PERL5LIB") #\:)))
246 #t))))
247 #:out-of-source? #t
248 ;; Tests require some other packages.
249 #:tests? #f))
250 (home-page "https://github.com/AlDanial/cloc")
251 (synopsis "Count source lines of code (SLOC) and other source code metrics")
252 (description "cloc counts blank lines, comment lines, and physical lines
253of source code in many programming languages. Given two versions of a code
254base, cloc can compute differences in blank, comment, and source lines.
255
256cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
e0f49664 257cloc can handle a greater variety of programming languages.")
f7fc9667
AW
258 (license license:gpl2+)))
259
d13586bf
260(define-public the-silver-searcher
261 (package
262 (name "the-silver-searcher")
8af20b99 263 (version "2.1.0")
d13586bf
264 (source (origin
265 (method url-fetch)
266 (uri (string-append
392f3266 267 "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
d13586bf
268 version ".tar.gz"))
269 (sha256
270 (base32
8af20b99 271 "1m0mih1x4jpswc8ganhqh0gmwbmd2hzmz7402mxfh19s3kcjnrfl"))))
d13586bf
272 (build-system gnu-build-system)
273 (native-inputs
392f3266 274 `(("pkg-config" ,pkg-config)))
d13586bf
275 (inputs
276 `(("pcre" ,pcre)
277 ("xz" ,xz)
278 ("zlib" ,zlib)))
d13586bf
279 (home-page "http://geoff.greer.fm/ag/")
280 (synopsis "Fast code searching tool")
281 (description
6acff0f9
TGR
282 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
283numbers of files. It's intended primarily for source code repositories, and
284respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
285of magnitude faster than its inspiration, @command{ack}, and less specialised
286tools such as @command{grep}.")
d13586bf 287 (license license:asl2.0)))
76e14638 288
a4e6356e
RW
289(define-public trio
290 (package
291 (name "trio")
292 (version "1.16")
293 (source (origin
294 (method url-fetch)
295 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
296 version ".tar.gz"))
297 (sha256
298 (base32
299 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
300 (build-system gnu-build-system)
301 (home-page "http://daniel.haxx.se/projects/trio/")
302 (synopsis "Portable and extendable printf and string functions")
303 (description
304 "Trio is a set of @code{printf} and string functions designed be used by
305applications with a focus on portability or with the need for additional
306features that are not supported by the standard @code{stdio} implementation.")
307 ;; This license is very similar to the ISC license, but the wording is
308 ;; slightly different.
309 (license (license:non-copyleft
310 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
311
76e14638
RW
312(define-public withershins
313 (package
314 (name "withershins")
315 (version "0.1")
316 (source (origin
317 (method url-fetch)
318 (uri (string-append
319 "https://github.com/cameronwhite/withershins/archive/v"
320 version ".tar.gz"))
321 (file-name (string-append name "-" version ".tar.gz"))
322 (sha256
323 (base32
324 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
325 (build-system cmake-build-system)
326 (arguments
327 `(#:out-of-source? #f
76e14638
RW
328 #:phases
329 (modify-phases %standard-phases
330 (add-after
331 'unpack 'find-libiberty
332 (lambda _
25734108 333 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
76e14638 334 (substitute* "cmake/FindIberty.cmake"
25734108
RW
335 (("/usr/include") (string-append libiberty "/include"))
336 (("libiberty.a iberty")
337 (string-append "NAMES libiberty.a iberty\nPATHS \""
338 libiberty "/lib" "\"")))
76e14638
RW
339 #t)))
340 (replace
341 'install
342 (lambda* (#:key outputs #:allow-other-keys)
f3860753
TGR
343 (let* ((out (assoc-ref outputs "out"))
344 (include (string-append out "/include"))
345 (lib (string-append out "/lib")))
346 (mkdir-p include)
347 (install-file "src/withershins.hpp" include)
348 (mkdir-p lib)
349 (install-file "src/libwithershins.a" lib))
76e14638
RW
350 #t)))))
351 (home-page "https://github.com/cameronwhite/withershins")
352 (inputs
25734108 353 `(("libiberty" ,libiberty)
76e14638
RW
354 ("binutils" ,binutils) ;for libbfd
355 ("zlib" ,zlib)))
356 (synopsis "C++11 library for generating stack traces")
357 (description
358 "Withershins is a simple cross-platform C++11 library for generating
359stack traces.")
360 ;; Sources are released under Expat license, but since BFD is licensed
361 ;; under the GPLv3+ the combined work is GPLv3+ as well.
362 (license license:gpl3+)))
0084aaf3
LC
363
364(define-public lcov
365 (package
366 (name "lcov")
b15af0ce 367 (version "1.13")
0084aaf3
LC
368 (source (origin
369 (method url-fetch)
de67e922
LF
370 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
371 "/LCOV-" version "/lcov-" version ".tar.gz"))
0084aaf3
LC
372 (sha256
373 (base32
b15af0ce 374 "08wabnb0gcjqk0qc65a6cgbbmz6b8lvam3p7byh0dk42hj3jr5s4"))))
0084aaf3
LC
375 (build-system gnu-build-system)
376 (arguments
b15af0ce
TGR
377 '(#:make-flags
378 (let ((out (assoc-ref %outputs "out")))
379 (list (string-append "PREFIX=" out)))
380 #:phases
381 (modify-phases %standard-phases
382 (delete 'configure)) ; no configure script
383 #:tests? #f)) ; no 'check' target
0084aaf3
LC
384 (inputs `(("perl" ,perl)))
385 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
386 (synopsis "Code coverage tool that enhances GNU gcov")
387 (description
388 "LCOV is an extension of @command{gcov}, a tool part of the
389GNU@tie{}Binutils, which provides information about what parts of a program
390are actually executed (i.e., \"covered\") while running a particular test
391case. The extension consists of a set of Perl scripts which build on the
392textual @command{gcov} output to implement the following enhanced
393functionality such as HTML output.")
394 (license license:gpl2+)))
4b3070f7
FT
395
396(define-public rtags
397 (package
398 (name "rtags")
af147cdd 399 (version "2.18")
4b3070f7 400 (home-page "https://github.com/Andersbakken/rtags")
457fc22d
FT
401 (source
402 (origin
403 (method url-fetch)
404 (uri
405 (string-append home-page "/archive/v" version ".tar.gz"))
406 (file-name (string-append name "-" version ".tar.gz"))
407 (patches (search-patches "rtags-separate-rct.patch"))
408 (modules '((guix build utils)))
409 (snippet
410 ;; Part of spliting rct with rtags.
411 ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
412 '(with-directory-excursion "src"
413 (delete-file-recursively "rct") ;remove bundled copy
414 (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
415 (substitute* files
416 (("#include ?\"rct/(.*.h)\"" all header)
417 (string-append "#include <rct/" header ">"))))))
418 (sha256
419 (base32
af147cdd 420 "0scjbp1z201q8njvrxqz7lk2m9b6k2rxd5q1shrng6532r7ndif2"))))
4b3070f7
FT
421 (build-system cmake-build-system)
422 (arguments
3def739d
TGR
423 '(#:build-type "RelWithDebInfo"
424 #:configure-flags
457fc22d 425 '("-DRTAGS_NO_ELISP_FILES=1"
457fc22d
FT
426 "-DCMAKE_CXX_FLAGS=-std=c++11"
427 "-DBUILD_TESTING=FALSE")
4b3070f7 428 #:tests? #f))
457fc22d
FT
429 (native-inputs
430 `(("pkg-config" ,pkg-config)))
4b3070f7 431 (inputs
457fc22d
FT
432 `(("bash-completion" ,bash-completion)
433 ("clang" ,clang)
4b3070f7 434 ("llvm" ,llvm)
457fc22d
FT
435 ("lua" ,lua)
436 ("rct" ,rct)
437 ("selene" ,selene)))
4b3070f7
FT
438 (synopsis "Indexer for the C language family with Emacs integration")
439 (description
440 "RTags is a client/server application that indexes C/C++ code and keeps a
441persistent file-based database of references, declarations, definitions,
442symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
443to find symbols by name (including nested class and namespace scope). Most
444importantly we give you proper follow-symbol and find-references support.")
445 (license license:gpl3+)))
dc993847
OP
446
447(define-public colormake
448 (package
449 (name "colormake")
450 (version "0.9.20140503")
451 (source
452 (origin
453 (method url-fetch)
454 (uri (string-append "https://github.com/pagekite/Colormake/archive/"
455 version ".tar.gz"))
456 (file-name (string-append name "-" version ".tar.gz"))
457 (sha256
458 (base32
459 "08ldss9zd8ls6bjahvxhffpsjcysifr720yf3jz9db2mlklzmyd3"))))
460 (build-system trivial-build-system)
461 (native-inputs
462 `(("bash" ,bash)
463 ("gzip" ,gzip)
464 ("perl" ,perl)
465 ("tar" ,tar)))
466 (arguments
467 `(#:modules ((guix build utils))
468 #:builder
469 (begin
470 (use-modules (guix build utils))
471 ;; bootstrap
472 (setenv "PATH" (string-append
473 (assoc-ref %build-inputs "tar") "/bin" ":"
474 (assoc-ref %build-inputs "gzip") "/bin"))
475 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
476 (chdir (string-append (string-capitalize ,name) "-" ,version))
477 (patch-shebang "colormake.pl"
478 (list (string-append (assoc-ref %build-inputs "perl")
479 "/bin")))
480 (let* ((out (assoc-ref %outputs "out"))
481 (bin (string-append out "/bin"))
482 (doc (string-append out "/share/doc"))
483 (install-files (lambda (files directory)
484 (for-each (lambda (file)
485 (install-file file directory))
486 files))))
487 (substitute* "colormake"
488 (("colormake\\.pl") (string-append bin "/colormake.pl"))
489 (("/bin/bash")
490 (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
491 (install-file "colormake.1" (string-append doc "/man/man1"))
492 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
493 (install-files '("colormake" "colormake-short" "clmake"
494 "clmake-short" "colormake.pl")
495 bin)))))
496 (home-page "http://bre.klaki.net/programs/colormake/")
497 (synopsis "Wrapper around @command{make} to produce colored output")
498 (description "This package provides a wrapper around @command{make} to
499produce colored output.")
500 (license license:gpl2+)))
906dcb20
CB
501
502(define-public makefile2graph
503 (package
504 (name "makefile2graph")
505 (version "1.5.0")
506 (source (origin
507 (method url-fetch)
508 (uri (string-append "https://github.com/lindenb/" name
509 "/archive/v" version ".tar.gz"))
510 (sha256
511 (base32
512 "0h1vchkpmm9h6s87p5nf0ksjxcmsxpx8k62a508w428n570wcr4l"))
513 (file-name (string-append name "-" version ".tar.gz"))))
514 (build-system gnu-build-system)
515 (arguments
516 '(#:test-target "test"
517 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
518 #:phases
519 (modify-phases %standard-phases
520 (delete 'configure))))
521 (native-inputs
522 `(("graphviz" ,graphviz)))
523 (home-page "https://github.com/lindenb/makefile2graph")
524 (synopsis "Creates a graph of dependencies from GNU Make")
525 (description
526 "@code{make2graph} creates a graph of dependencies from GNU Make. The
527output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
528independent targets.")
529 (license license:expat)))