1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
8 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
10 ;;; This file is part of GNU Guix.
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.
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.
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/>.
25 (define-module (gnu packages code)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system cmake)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages emacs)
35 #:use-module (gnu packages gcc)
36 #:use-module (gnu packages pcre)
37 #:use-module (gnu packages pkg-config)
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))
44 ;;; Tools to deal with source code: metrics, cross-references, etc.
52 (uri (string-append "mirror://gnu/cflow/cflow-"
56 "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
57 (build-system gnu-build-system)
59 ;; Needed to have cflow-mode.el installed.
60 (native-inputs `(("emacs" ,emacs-minimal)))
62 '(#:configure-flags (list (string-append "CPPFLAGS="
63 "-D" "CFLOW_PREPROC=\\\""
64 (assoc-ref %build-inputs "gcc")
66 (home-page "https://www.gnu.org/software/cflow/")
67 (synopsis "Create a graph of control flow within a program")
69 "GNU cflow analyzes C source files and produces a graph charting the
70 control flow of the program. It can output the graph in several styles and
71 in either the POSIX format or in an extended GNU format. cflow also includes
72 a major mode for Emacs for examining the flowcharts that it produces.")
73 (license license:gpl3+)))
75 (define-public complexity
81 (uri (string-append "mirror://gnu/complexity/complexity-"
85 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
86 (build-system gnu-build-system)
88 `(("texinfo" ,texinfo)
89 ("autogen" ,autogen)))
90 (home-page "https://www.gnu.org/software/complexity/")
91 (synopsis "Analyze complexity of C functions")
93 "GNU complexity provides tools for finding procedures that are
94 convoluted, overly long or otherwise difficult to understand. This
95 may help in learning or reviewing unfamiliar code or perhaps
96 highlighting your own code that seemed comprehensible when you wrote it.")
97 (license license:gpl3+)))
99 (define-public global ; a global variable
105 (uri (string-append "mirror://gnu/global/global-"
109 "0cnd7a7d1pl46yk15q6mnr9i9w3xi8pxgchw4ia9njgr4jjqzh6r"))))
110 (build-system gnu-build-system)
111 (inputs `(("ncurses" ,ncurses)
116 (list (string-append "--with-ncurses="
117 (assoc-ref %build-inputs "ncurses"))
118 (string-append "--with-sqlite3="
119 (assoc-ref %build-inputs "sqlite")))
122 (modify-phases %standard-phases
123 (add-after 'install 'post-install
124 (lambda* (#:key outputs #:allow-other-keys)
125 ;; Install the Emacs Lisp file in the right place.
126 (let* ((out (assoc-ref outputs "out"))
127 (data (string-append out "/share/gtags"))
128 (lisp (string-append out "/share/emacs/site-lisp")))
129 (install-file (string-append data "/gtags.el") lisp)
130 (delete-file (string-append data "/gtags.el"))
132 (home-page "https://www.gnu.org/software/global/")
133 (synopsis "Cross-environment source code tag system")
135 "GLOBAL is a source code tagging system that functions in the same way
136 across a wide array of environments, such as different text editors, shells
137 and web browsers. The resulting tags are useful for quickly moving around in
138 a large, deeply nested project.")
139 (license license:gpl3+)))
141 (define-public sloccount
147 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
151 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
152 (build-system gnu-build-system)
154 '(#:phases (modify-phases %standard-phases
156 (add-before 'build 'make-dotl-files-older
158 ;; Make the '.l' files as old as the '.c'
159 ;; files to avoid triggering the rule that
164 (for-each (lambda (file)
165 (set-file-time file ref))
166 (find-files "." "\\.[chl]$"))
168 (add-before 'install 'make-target-directories
169 (lambda* (#:key outputs #:allow-other-keys)
170 (let ((out (assoc-ref outputs "out")))
171 (mkdir-p (string-append out "/bin"))
172 (mkdir-p (string-append out
174 (mkdir-p (string-append out
178 (setenv "HOME" (getcwd))
180 (string-append (getcwd) ":"
182 (zero? (system* "make" "test")))))
184 #:make-flags (list (string-append "PREFIX="
185 (assoc-ref %outputs "out")))))
186 (inputs `(("perl" ,perl)))
187 (home-page "http://www.dwheeler.com/sloccount/")
188 (synopsis "Count physical source lines of code (SLOC)")
190 "SLOCCount is a set of the programs for counting source lines of
191 code (SLOC) in large software systems. It can automatically identify and
192 measure a wide range of programming languages. It automatically estimates the
193 effort, time, and money it would take to develop the software, using the
194 COCOMO model or user-provided parameters.")
195 (license license:gpl2+)))
205 "https://github.com/AlDanial/cloc/releases/download/" version
206 "/cloc-" version ".tar.gz"))
209 "0rq5xfiln1wlv3yr9mg18ax4gskbss786iqaf0v45iv6awyl5b2m"))))
210 (build-system gnu-build-system)
212 `(("coreutils" ,coreutils)
214 ("perl-algorithm-diff" ,perl-algorithm-diff)
215 ("perl-regexp-common" ,perl-regexp-common)
216 ("perl-digest-md5" ,perl-digest-md5)))
218 `(#:phases (modify-phases %standard-phases
222 (lambda* (#:key inputs outputs #:allow-other-keys)
223 (let* ((out (assoc-ref outputs "out")))
225 (system* "make" "-C" "Unix"
226 (string-append "prefix=" out)
227 (string-append "INSTALL="
228 (assoc-ref inputs "coreutils")
231 (add-after 'install 'wrap-program
232 (lambda* (#:key inputs outputs #:allow-other-keys)
233 (let ((out (assoc-ref outputs "out")))
234 (wrap-program (string-append out "/bin/cloc")
236 ,(string-split (getenv "PERL5LIB") #\:)))
239 ;; Tests require some other packages.
241 (home-page "https://github.com/AlDanial/cloc")
242 (synopsis "Count source lines of code (SLOC) and other source code metrics")
243 (description "cloc counts blank lines, comment lines, and physical lines
244 of source code in many programming languages. Given two versions of a code
245 base, cloc can compute differences in blank, comment, and source lines.
247 cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
248 cloc can handle a greater variety of programming languages.")
249 (license license:gpl2+)))
251 (define-public the-silver-searcher
253 (name "the-silver-searcher")
258 "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
262 "04wm3r5p2mgv8mdkvysak0d5199h5y0yzl032624brfxpzmqfcq0"))))
263 (build-system gnu-build-system)
265 `(("pkg-config" ,pkg-config)))
270 (home-page "http://geoff.greer.fm/ag/")
271 (synopsis "Fast code searching tool")
273 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
274 numbers of files. It's intended primarily for source code repositories, and
275 respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
276 of magnitude faster than its inspiration, @command{ack}, and less specialised
277 tools such as @command{grep}.")
278 (license license:asl2.0)))
286 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
290 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
291 (build-system gnu-build-system)
292 (home-page "http://daniel.haxx.se/projects/trio/")
293 (synopsis "Portable and extendable printf and string functions")
295 "Trio is a set of @code{printf} and string functions designed be used by
296 applications with a focus on portability or with the need for additional
297 features that are not supported by the standard @code{stdio} implementation.")
298 ;; This license is very similar to the ISC license, but the wording is
299 ;; slightly different.
300 (license (license:non-copyleft
301 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
303 (define-public withershins
310 "https://github.com/cameronwhite/withershins/archive/v"
312 (file-name (string-append name "-" version ".tar.gz"))
315 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
316 (build-system cmake-build-system)
318 `(#:out-of-source? #f
320 (modify-phases %standard-phases
322 'unpack 'find-libiberty
324 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
325 (substitute* "cmake/FindIberty.cmake"
326 (("/usr/include") (string-append libiberty "/include"))
327 (("libiberty.a iberty")
328 (string-append "NAMES libiberty.a iberty\nPATHS \""
329 libiberty "/lib" "\"")))
333 (lambda* (#:key outputs #:allow-other-keys)
334 (let* ((out (assoc-ref outputs "out"))
335 (include (string-append out "/include"))
336 (lib (string-append out "/lib")))
338 (install-file "src/withershins.hpp" include)
340 (install-file "src/libwithershins.a" lib))
342 (home-page "https://github.com/cameronwhite/withershins")
344 `(("libiberty" ,libiberty)
345 ("binutils" ,binutils) ;for libbfd
347 (synopsis "C++11 library for generating stack traces")
349 "Withershins is a simple cross-platform C++11 library for generating
351 ;; Sources are released under Expat license, but since BFD is licensed
352 ;; under the GPLv3+ the combined work is GPLv3+ as well.
353 (license license:gpl3+)))
361 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
362 "/LCOV-" version "/lcov-" version ".tar.gz"))
365 "19wfifdpxxivhq9adbphanjfga9bg9spms9v7c3589wndjff8x5l"))))
366 (build-system gnu-build-system)
368 '(#:make-flags (let ((out (assoc-ref %outputs "out")))
369 (list (string-append "PREFIX=" out)
370 (string-append "BIN_DIR=" out "/bin")
371 (string-append "MAN_DIR=" out "/share/man")))
372 #:phases (modify-phases %standard-phases
374 #:tests? #f)) ;no 'check' target
375 (inputs `(("perl" ,perl)))
376 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
377 (synopsis "Code coverage tool that enhances GNU gcov")
379 "LCOV is an extension of @command{gcov}, a tool part of the
380 GNU@tie{}Binutils, which provides information about what parts of a program
381 are actually executed (i.e., \"covered\") while running a particular test
382 case. The extension consists of a set of Perl scripts which build on the
383 textual @command{gcov} output to implement the following enhanced
384 functionality such as HTML output.")
385 (license license:gpl2+)))