gnu: android: Add android-udev-rules package.
[jackhill/guix/guix.git] / gnu / packages / code.scm
CommitLineData
23153c90 1;;; GNU Guix --- Functional package management for GNU
99e64a6e
LC
2;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
76e14638 4;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
94c3a6f1 5;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6acff0f9 6;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
4391a029 7;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
f7fc9667 8;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
23153c90
LC
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages code)
26 #:use-module (guix packages)
27 #:use-module (guix download)
d13586bf 28 #:use-module ((guix licenses) #:prefix license:)
23153c90 29 #:use-module (guix build-system gnu)
76e14638
RW
30 #:use-module (guix build-system cmake)
31 #:use-module (gnu packages base)
d13586bf 32 #:use-module (gnu packages compression)
e1ac691d 33 #:use-module (gnu packages databases)
99e64a6e 34 #:use-module (gnu packages emacs)
76e14638 35 #:use-module (gnu packages gcc)
d13586bf
36 #:use-module (gnu packages pcre)
37 #:use-module (gnu packages pkg-config)
99e64a6e
LC
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages texinfo)
40 #:use-module (gnu packages autogen)
41 #:use-module (gnu packages ncurses)
42 #:use-module (gnu packages autotools))
23153c90
LC
43
44;;; Tools to deal with source code: metrics, cross-references, etc.
45
99e64a6e
LC
46(define-public cflow
47 (package
48 (name "cflow")
cb307c08 49 (version "1.5")
99e64a6e
LC
50 (source (origin
51 (method url-fetch)
52 (uri (string-append "mirror://gnu/cflow/cflow-"
53 version ".tar.bz2"))
54 (sha256
55 (base32
cb307c08 56 "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
99e64a6e
LC
57 (build-system gnu-build-system)
58
59 ;; Needed to have cflow-mode.el installed.
b8fc3622 60 (native-inputs `(("emacs" ,emacs-minimal)))
99e64a6e 61
6fd52309 62 (home-page "https://www.gnu.org/software/cflow/")
99e64a6e
LC
63 (synopsis "Create a graph of control flow within a program")
64 (description
65 "GNU cflow analyzes C source files and produces a graph charting the
66control flow of the program. It can output the graph in several styles and
e881752c 67in either the POSIX format or in an extended GNU format. cflow also includes
99e64a6e 68a major mode for Emacs for examining the flowcharts that it produces.")
d13586bf 69 (license license:gpl3+)))
99e64a6e
LC
70
71(define-public complexity
72 (package
73 (name "complexity")
1e42d8b8 74 (version "1.10")
99e64a6e
LC
75 (source (origin
76 (method url-fetch)
77 (uri (string-append "mirror://gnu/complexity/complexity-"
1e42d8b8 78 version ".tar.xz"))
99e64a6e
LC
79 (sha256
80 (base32
1e42d8b8 81 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
99e64a6e
LC
82 (build-system gnu-build-system)
83 (native-inputs
84 `(("texinfo" ,texinfo)
85 ("autogen" ,autogen)))
6fd52309 86 (home-page "https://www.gnu.org/software/complexity/")
99e64a6e
LC
87 (synopsis "Analyze complexity of C functions")
88 (description
89 "GNU complexity provides tools for finding procedures that are
90convoluted, overly long or otherwise difficult to understand. This
91may help in learning or reviewing unfamiliar code or perhaps
92highlighting your own code that seemed comprehensible when you wrote it.")
d13586bf 93 (license license:gpl3+)))
99e64a6e
LC
94
95(define-public global ; a global variable
96 (package
97 (name "global")
9cbc9d86 98 (version "6.5.7")
99e64a6e
LC
99 (source (origin
100 (method url-fetch)
101 (uri (string-append "mirror://gnu/global/global-"
102 version ".tar.gz"))
103 (sha256
104 (base32
9cbc9d86 105 "0cnd7a7d1pl46yk15q6mnr9i9w3xi8pxgchw4ia9njgr4jjqzh6r"))))
99e64a6e
LC
106 (build-system gnu-build-system)
107 (inputs `(("ncurses" ,ncurses)
e1ac691d
LC
108 ("libltdl" ,libltdl)
109 ("sqlite" ,sqlite)))
99e64a6e
LC
110 (arguments
111 `(#:configure-flags
112 (list (string-append "--with-ncurses="
e1ac691d
LC
113 (assoc-ref %build-inputs "ncurses"))
114 (string-append "--with-sqlite3="
115 (assoc-ref %build-inputs "sqlite")))
99e64a6e 116
9d9951d6
EF
117 #:phases
118 (modify-phases %standard-phases
119 (add-after 'install 'post-install
120 (lambda* (#:key outputs #:allow-other-keys)
121 ;; Install the Emacs Lisp file in the right place.
122 (let* ((out (assoc-ref outputs "out"))
123 (data (string-append out "/share/gtags"))
124 (lisp (string-append out "/share/emacs/site-lisp")))
125 (install-file (string-append data "/gtags.el") lisp)
126 (delete-file (string-append data "/gtags.el"))
127 #t))))))
6fd52309 128 (home-page "https://www.gnu.org/software/global/")
99e64a6e
LC
129 (synopsis "Cross-environment source code tag system")
130 (description
131 "GLOBAL is a source code tagging system that functions in the same way
132across a wide array of environments, such as different text editors, shells
133and web browsers. The resulting tags are useful for quickly moving around in
134a large, deeply nested project.")
d13586bf 135 (license license:gpl3+)))
99e64a6e 136
23153c90
LC
137(define-public sloccount
138 (package
139 (name "sloccount")
140 (version "2.26")
141 (source (origin
142 (method url-fetch)
143 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
144 version ".tar.gz"))
145 (sha256
146 (base32
147 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
148 (build-system gnu-build-system)
149 (arguments
150 '(#:phases (modify-phases %standard-phases
f8503e2b
LC
151 (delete 'configure)
152 (add-before 'build 'make-dotl-files-older
23153c90
LC
153 (lambda _
154 ;; Make the '.l' files as old as the '.c'
155 ;; files to avoid triggering the rule that
156 ;; requires Flex.
157 (define ref
158 (stat "README"))
159
160 (for-each (lambda (file)
161 (set-file-time file ref))
162 (find-files "." "\\.[chl]$"))
163 #t))
f8503e2b 164 (add-before 'install 'make-target-directories
23153c90
LC
165 (lambda* (#:key outputs #:allow-other-keys)
166 (let ((out (assoc-ref outputs "out")))
167 (mkdir-p (string-append out "/bin"))
168 (mkdir-p (string-append out
169 "/share/man/man1"))
170 (mkdir-p (string-append out
171 "/share/doc")))))
f8503e2b 172 (replace 'check
23153c90
LC
173 (lambda _
174 (setenv "HOME" (getcwd))
175 (setenv "PATH"
176 (string-append (getcwd) ":"
177 (getenv "PATH")))
178 (zero? (system* "make" "test")))))
179
180 #:make-flags (list (string-append "PREFIX="
181 (assoc-ref %outputs "out")))))
182 (inputs `(("perl" ,perl)))
183 (home-page "http://www.dwheeler.com/sloccount/")
184 (synopsis "Count physical source lines of code (SLOC)")
185 (description
186 "SLOCCount is a set of the programs for counting source lines of
187code (SLOC) in large software systems. It can automatically identify and
188measure a wide range of programming languages. It automatically estimates the
189effort, time, and money it would take to develop the software, using the
190COCOMO model or user-provided parameters.")
d13586bf
191 (license license:gpl2+)))
192
f7fc9667
AW
193(define-public cloc
194 (package
195 (name "cloc")
7ca001c3 196 (version "1.74")
f7fc9667
AW
197 (source
198 (origin
199 (method url-fetch)
200 (uri (string-append
7ca001c3 201 "https://github.com/AlDanial/cloc/releases/download/" version
f7fc9667
AW
202 "/cloc-" version ".tar.gz"))
203 (sha256
204 (base32
7ca001c3 205 "0rq5xfiln1wlv3yr9mg18ax4gskbss786iqaf0v45iv6awyl5b2m"))))
f7fc9667
AW
206 (build-system gnu-build-system)
207 (inputs
208 `(("coreutils" ,coreutils)
209 ("perl" ,perl)
210 ("perl-algorithm-diff" ,perl-algorithm-diff)
211 ("perl-regexp-common" ,perl-regexp-common)
212 ("perl-digest-md5" ,perl-digest-md5)))
213 (arguments
214 `(#:phases (modify-phases %standard-phases
215 (delete 'configure)
216 (delete 'build)
217 (replace 'install
218 (lambda* (#:key inputs outputs #:allow-other-keys)
219 (let* ((out (assoc-ref outputs "out")))
220 (zero?
221 (system* "make" "-C" "Unix"
222 (string-append "prefix=" out)
223 (string-append "INSTALL="
224 (assoc-ref inputs "coreutils")
225 "/bin/install")
226 "install")))))
227 (add-after 'install 'wrap-program
228 (lambda* (#:key inputs outputs #:allow-other-keys)
229 (let ((out (assoc-ref outputs "out")))
230 (wrap-program (string-append out "/bin/cloc")
231 `("PERL5LIB" ":" =
232 ,(string-split (getenv "PERL5LIB") #\:)))
233 #t))))
234 #:out-of-source? #t
235 ;; Tests require some other packages.
236 #:tests? #f))
237 (home-page "https://github.com/AlDanial/cloc")
238 (synopsis "Count source lines of code (SLOC) and other source code metrics")
239 (description "cloc counts blank lines, comment lines, and physical lines
240of source code in many programming languages. Given two versions of a code
241base, cloc can compute differences in blank, comment, and source lines.
242
243cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
e0f49664 244cloc can handle a greater variety of programming languages.")
f7fc9667
AW
245 (license license:gpl2+)))
246
d13586bf
247(define-public the-silver-searcher
248 (package
249 (name "the-silver-searcher")
4391a029 250 (version "2.0.0")
d13586bf
251 (source (origin
252 (method url-fetch)
253 (uri (string-append
392f3266 254 "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
d13586bf
255 version ".tar.gz"))
256 (sha256
257 (base32
4391a029 258 "04wm3r5p2mgv8mdkvysak0d5199h5y0yzl032624brfxpzmqfcq0"))))
d13586bf
259 (build-system gnu-build-system)
260 (native-inputs
392f3266 261 `(("pkg-config" ,pkg-config)))
d13586bf
262 (inputs
263 `(("pcre" ,pcre)
264 ("xz" ,xz)
265 ("zlib" ,zlib)))
d13586bf
266 (home-page "http://geoff.greer.fm/ag/")
267 (synopsis "Fast code searching tool")
268 (description
6acff0f9
TGR
269 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
270numbers of files. It's intended primarily for source code repositories, and
271respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
272of magnitude faster than its inspiration, @command{ack}, and less specialised
273tools such as @command{grep}.")
d13586bf 274 (license license:asl2.0)))
76e14638 275
a4e6356e
RW
276(define-public trio
277 (package
278 (name "trio")
279 (version "1.16")
280 (source (origin
281 (method url-fetch)
282 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
283 version ".tar.gz"))
284 (sha256
285 (base32
286 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
287 (build-system gnu-build-system)
288 (home-page "http://daniel.haxx.se/projects/trio/")
289 (synopsis "Portable and extendable printf and string functions")
290 (description
291 "Trio is a set of @code{printf} and string functions designed be used by
292applications with a focus on portability or with the need for additional
293features that are not supported by the standard @code{stdio} implementation.")
294 ;; This license is very similar to the ISC license, but the wording is
295 ;; slightly different.
296 (license (license:non-copyleft
297 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
298
76e14638
RW
299(define-public withershins
300 (package
301 (name "withershins")
302 (version "0.1")
303 (source (origin
304 (method url-fetch)
305 (uri (string-append
306 "https://github.com/cameronwhite/withershins/archive/v"
307 version ".tar.gz"))
308 (file-name (string-append name "-" version ".tar.gz"))
309 (sha256
310 (base32
311 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
312 (build-system cmake-build-system)
313 (arguments
314 `(#:out-of-source? #f
76e14638
RW
315 #:phases
316 (modify-phases %standard-phases
317 (add-after
318 'unpack 'find-libiberty
319 (lambda _
25734108 320 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
76e14638 321 (substitute* "cmake/FindIberty.cmake"
25734108
RW
322 (("/usr/include") (string-append libiberty "/include"))
323 (("libiberty.a iberty")
324 (string-append "NAMES libiberty.a iberty\nPATHS \""
325 libiberty "/lib" "\"")))
76e14638
RW
326 #t)))
327 (replace
328 'install
329 (lambda* (#:key outputs #:allow-other-keys)
f3860753
TGR
330 (let* ((out (assoc-ref outputs "out"))
331 (include (string-append out "/include"))
332 (lib (string-append out "/lib")))
333 (mkdir-p include)
334 (install-file "src/withershins.hpp" include)
335 (mkdir-p lib)
336 (install-file "src/libwithershins.a" lib))
76e14638
RW
337 #t)))))
338 (home-page "https://github.com/cameronwhite/withershins")
339 (inputs
25734108 340 `(("libiberty" ,libiberty)
76e14638
RW
341 ("binutils" ,binutils) ;for libbfd
342 ("zlib" ,zlib)))
343 (synopsis "C++11 library for generating stack traces")
344 (description
345 "Withershins is a simple cross-platform C++11 library for generating
346stack traces.")
347 ;; Sources are released under Expat license, but since BFD is licensed
348 ;; under the GPLv3+ the combined work is GPLv3+ as well.
349 (license license:gpl3+)))
0084aaf3
LC
350
351(define-public lcov
352 (package
353 (name "lcov")
591f1d3e 354 (version "1.12")
0084aaf3
LC
355 (source (origin
356 (method url-fetch)
de67e922
LF
357 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
358 "/LCOV-" version "/lcov-" version ".tar.gz"))
0084aaf3
LC
359 (sha256
360 (base32
591f1d3e 361 "19wfifdpxxivhq9adbphanjfga9bg9spms9v7c3589wndjff8x5l"))))
0084aaf3
LC
362 (build-system gnu-build-system)
363 (arguments
364 '(#:make-flags (let ((out (assoc-ref %outputs "out")))
365 (list (string-append "PREFIX=" out)
366 (string-append "BIN_DIR=" out "/bin")
367 (string-append "MAN_DIR=" out "/share/man")))
368 #:phases (modify-phases %standard-phases
369 (delete 'configure))
370 #:tests? #f)) ;no 'check' target
371 (inputs `(("perl" ,perl)))
372 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
373 (synopsis "Code coverage tool that enhances GNU gcov")
374 (description
375 "LCOV is an extension of @command{gcov}, a tool part of the
376GNU@tie{}Binutils, which provides information about what parts of a program
377are actually executed (i.e., \"covered\") while running a particular test
378case. The extension consists of a set of Perl scripts which build on the
379textual @command{gcov} output to implement the following enhanced
380functionality such as HTML output.")
381 (license license:gpl2+)))