1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2018 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, 2017 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>
9 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
26 (define-module (gnu packages code)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system cmake)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages emacs)
37 #:use-module (gnu packages gcc)
38 #:use-module (gnu packages pcre)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages texinfo)
42 #:use-module (gnu packages autogen)
43 #:use-module (gnu packages ncurses)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages llvm)
46 #:use-module (gnu packages bash))
48 ;;; Tools to deal with source code: metrics, cross-references, etc.
56 (uri (string-append "mirror://gnu/cflow/cflow-"
60 "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
61 (build-system gnu-build-system)
63 ;; Needed to have cflow-mode.el installed.
64 (native-inputs `(("emacs" ,emacs-minimal)))
66 '(#:configure-flags (list (string-append "CPPFLAGS="
67 "-D" "CFLOW_PREPROC=\\\""
68 (assoc-ref %build-inputs "gcc")
70 (home-page "https://www.gnu.org/software/cflow/")
71 (synopsis "Create a graph of control flow within a program")
73 "GNU cflow analyzes C source files and produces a graph charting the
74 control flow of the program. It can output the graph in several styles and
75 in either the POSIX format or in an extended GNU format. cflow also includes
76 a major mode for Emacs for examining the flowcharts that it produces.")
77 (license license:gpl3+)))
79 (define-public complexity
85 (uri (string-append "mirror://gnu/complexity/complexity-"
89 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
90 (build-system gnu-build-system)
92 `(("texinfo" ,texinfo)
93 ("autogen" ,autogen)))
94 (home-page "https://www.gnu.org/software/complexity/")
95 (synopsis "Analyze complexity of C functions")
97 "GNU complexity provides tools for finding procedures that are
98 convoluted, overly long or otherwise difficult to understand. This
99 may help in learning or reviewing unfamiliar code or perhaps
100 highlighting your own code that seemed comprehensible when you wrote it.")
101 (license license:gpl3+)))
103 (define-public global ; a global variable
109 (uri (string-append "mirror://gnu/global/global-"
113 "1r2r6z41lmgbszzwx7h3jqhwnqb9jj32pndzhr3lb0id710c8gcl"))))
114 (build-system gnu-build-system)
115 (inputs `(("ncurses" ,ncurses)
120 (list (string-append "--with-ncurses="
121 (assoc-ref %build-inputs "ncurses"))
122 (string-append "--with-sqlite3="
123 (assoc-ref %build-inputs "sqlite")))
126 (modify-phases %standard-phases
127 (add-after 'install 'post-install
128 (lambda* (#:key outputs #:allow-other-keys)
129 ;; Install the Emacs Lisp file in the right place.
130 (let* ((out (assoc-ref outputs "out"))
131 (data (string-append out "/share/gtags"))
132 (lisp (string-append out "/share/emacs/site-lisp")))
133 (install-file (string-append data "/gtags.el") lisp)
134 (delete-file (string-append data "/gtags.el"))
136 (home-page "https://www.gnu.org/software/global/")
137 (synopsis "Cross-environment source code tag system")
139 "GLOBAL is a source code tagging system that functions in the same way
140 across a wide array of environments, such as different text editors, shells
141 and web browsers. The resulting tags are useful for quickly moving around in
142 a large, deeply nested project.")
143 (license license:gpl3+)))
145 (define-public sloccount
151 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
155 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
156 (build-system gnu-build-system)
158 '(#:phases (modify-phases %standard-phases
160 (add-before 'build 'make-dotl-files-older
162 ;; Make the '.l' files as old as the '.c'
163 ;; files to avoid triggering the rule that
168 (for-each (lambda (file)
169 (set-file-time file ref))
170 (find-files "." "\\.[chl]$"))
172 (add-before 'install 'make-target-directories
173 (lambda* (#:key outputs #:allow-other-keys)
174 (let ((out (assoc-ref outputs "out")))
175 (mkdir-p (string-append out "/bin"))
176 (mkdir-p (string-append out
178 (mkdir-p (string-append out
182 (setenv "HOME" (getcwd))
184 (string-append (getcwd) ":"
186 (zero? (system* "make" "test")))))
188 #:make-flags (list (string-append "PREFIX="
189 (assoc-ref %outputs "out")))))
190 (inputs `(("perl" ,perl)))
191 (home-page "http://www.dwheeler.com/sloccount/")
192 (synopsis "Count physical source lines of code (SLOC)")
194 "SLOCCount is a set of the programs for counting source lines of
195 code (SLOC) in large software systems. It can automatically identify and
196 measure a wide range of programming languages. It automatically estimates the
197 effort, time, and money it would take to develop the software, using the
198 COCOMO model or user-provided parameters.")
199 (license license:gpl2+)))
209 "https://github.com/AlDanial/cloc/releases/download/" version
210 "/cloc-" version ".tar.gz"))
213 "0rq5xfiln1wlv3yr9mg18ax4gskbss786iqaf0v45iv6awyl5b2m"))))
214 (build-system gnu-build-system)
216 `(("coreutils" ,coreutils)
218 ("perl-algorithm-diff" ,perl-algorithm-diff)
219 ("perl-regexp-common" ,perl-regexp-common)
220 ("perl-digest-md5" ,perl-digest-md5)))
222 `(#:phases (modify-phases %standard-phases
226 (lambda* (#:key inputs outputs #:allow-other-keys)
227 (let* ((out (assoc-ref outputs "out")))
229 (system* "make" "-C" "Unix"
230 (string-append "prefix=" out)
231 (string-append "INSTALL="
232 (assoc-ref inputs "coreutils")
235 (add-after 'install 'wrap-program
236 (lambda* (#:key inputs outputs #:allow-other-keys)
237 (let ((out (assoc-ref outputs "out")))
238 (wrap-program (string-append out "/bin/cloc")
240 ,(string-split (getenv "PERL5LIB") #\:)))
243 ;; Tests require some other packages.
245 (home-page "https://github.com/AlDanial/cloc")
246 (synopsis "Count source lines of code (SLOC) and other source code metrics")
247 (description "cloc counts blank lines, comment lines, and physical lines
248 of source code in many programming languages. Given two versions of a code
249 base, cloc can compute differences in blank, comment, and source lines.
251 cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
252 cloc can handle a greater variety of programming languages.")
253 (license license:gpl2+)))
255 (define-public the-silver-searcher
257 (name "the-silver-searcher")
262 "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
266 "04wm3r5p2mgv8mdkvysak0d5199h5y0yzl032624brfxpzmqfcq0"))))
267 (build-system gnu-build-system)
269 `(("pkg-config" ,pkg-config)))
274 (home-page "http://geoff.greer.fm/ag/")
275 (synopsis "Fast code searching tool")
277 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
278 numbers of files. It's intended primarily for source code repositories, and
279 respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
280 of magnitude faster than its inspiration, @command{ack}, and less specialised
281 tools such as @command{grep}.")
282 (license license:asl2.0)))
290 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
294 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
295 (build-system gnu-build-system)
296 (home-page "http://daniel.haxx.se/projects/trio/")
297 (synopsis "Portable and extendable printf and string functions")
299 "Trio is a set of @code{printf} and string functions designed be used by
300 applications with a focus on portability or with the need for additional
301 features that are not supported by the standard @code{stdio} implementation.")
302 ;; This license is very similar to the ISC license, but the wording is
303 ;; slightly different.
304 (license (license:non-copyleft
305 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
307 (define-public withershins
314 "https://github.com/cameronwhite/withershins/archive/v"
316 (file-name (string-append name "-" version ".tar.gz"))
319 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
320 (build-system cmake-build-system)
322 `(#:out-of-source? #f
324 (modify-phases %standard-phases
326 'unpack 'find-libiberty
328 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
329 (substitute* "cmake/FindIberty.cmake"
330 (("/usr/include") (string-append libiberty "/include"))
331 (("libiberty.a iberty")
332 (string-append "NAMES libiberty.a iberty\nPATHS \""
333 libiberty "/lib" "\"")))
337 (lambda* (#:key outputs #:allow-other-keys)
338 (let* ((out (assoc-ref outputs "out"))
339 (include (string-append out "/include"))
340 (lib (string-append out "/lib")))
342 (install-file "src/withershins.hpp" include)
344 (install-file "src/libwithershins.a" lib))
346 (home-page "https://github.com/cameronwhite/withershins")
348 `(("libiberty" ,libiberty)
349 ("binutils" ,binutils) ;for libbfd
351 (synopsis "C++11 library for generating stack traces")
353 "Withershins is a simple cross-platform C++11 library for generating
355 ;; Sources are released under Expat license, but since BFD is licensed
356 ;; under the GPLv3+ the combined work is GPLv3+ as well.
357 (license license:gpl3+)))
365 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
366 "/LCOV-" version "/lcov-" version ".tar.gz"))
369 "19wfifdpxxivhq9adbphanjfga9bg9spms9v7c3589wndjff8x5l"))))
370 (build-system gnu-build-system)
372 '(#:make-flags (let ((out (assoc-ref %outputs "out")))
373 (list (string-append "PREFIX=" out)
374 (string-append "BIN_DIR=" out "/bin")
375 (string-append "MAN_DIR=" out "/share/man")))
376 #:phases (modify-phases %standard-phases
378 #:tests? #f)) ;no 'check' target
379 (inputs `(("perl" ,perl)))
380 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
381 (synopsis "Code coverage tool that enhances GNU gcov")
383 "LCOV is an extension of @command{gcov}, a tool part of the
384 GNU@tie{}Binutils, which provides information about what parts of a program
385 are actually executed (i.e., \"covered\") while running a particular test
386 case. The extension consists of a set of Perl scripts which build on the
387 textual @command{gcov} output to implement the following enhanced
388 functionality such as HTML output.")
389 (license license:gpl2+)))
395 (home-page "https://github.com/Andersbakken/rtags")
400 (commit "8ef7554852541eced514c56d5e39d6073f7a2ef9")
402 ;; FIXME: This fetches bundled copies of Lua, RCT, and
407 "12r7lsqdmcbs9864a6dpblvifqvmfxhvxippyhfnnm2ai5ra80nc"))
408 (file-name (git-file-name name version))))
409 (build-system cmake-build-system)
411 '(#:configure-flags '("-DBUILD_TESTING=FALSE"
412 "-DRTAGS_NO_ELISP_FILES=1")
417 ("bash-completion" ,bash-completion)))
418 (synopsis "Indexer for the C language family with Emacs integration")
420 "RTags is a client/server application that indexes C/C++ code and keeps a
421 persistent file-based database of references, declarations, definitions,
422 symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
423 to find symbols by name (including nested class and namespace scope). Most
424 importantly we give you proper follow-symbol and find-references support.")
425 (license license:gpl3+)))