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, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017, 2018 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 licenses) #:prefix license:)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system trivial)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages cpp)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages emacs)
39 #:use-module (gnu packages gcc)
40 #:use-module (gnu packages graphviz)
41 #:use-module (gnu packages pcre)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages autogen)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages autotools)
48 #:use-module (gnu packages llvm)
49 #:use-module (gnu packages lua)
50 #:use-module (gnu packages bash))
52 ;;; Tools to deal with source code: metrics, cross-references, etc.
60 (uri (string-append "mirror://gnu/cflow/cflow-"
64 "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
65 (build-system gnu-build-system)
67 ;; Needed to have cflow-mode.el installed.
68 (native-inputs `(("emacs" ,emacs-minimal)))
70 '(#:configure-flags (list (string-append "CPPFLAGS="
71 "-D" "CFLOW_PREPROC=\\\""
72 (assoc-ref %build-inputs "gcc")
74 (home-page "https://www.gnu.org/software/cflow/")
75 (synopsis "Create a graph of control flow within a program")
77 "GNU cflow analyzes C source files and produces a graph charting the
78 control flow of the program. It can output the graph in several styles and
79 in either the POSIX format or in an extended GNU format. cflow also includes
80 a major mode for Emacs for examining the flowcharts that it produces.")
81 (license license:gpl3+)))
83 (define-public complexity
89 (uri (string-append "mirror://gnu/complexity/complexity-"
93 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
94 (build-system gnu-build-system)
96 `(("texinfo" ,texinfo)
97 ("autogen" ,autogen)))
98 (home-page "https://www.gnu.org/software/complexity/")
99 (synopsis "Analyze complexity of C functions")
101 "GNU complexity provides tools for finding procedures that are
102 convoluted, overly long or otherwise difficult to understand. This
103 may help in learning or reviewing unfamiliar code or perhaps
104 highlighting your own code that seemed comprehensible when you wrote it.")
105 (license license:gpl3+)))
107 (define-public global ; a global variable
113 (uri (string-append "mirror://gnu/global/global-"
117 "0zvi5vxwiq0dy8mq2cgs64m8harxs0fvkmsnvi0ayb0w608lgij3"))))
118 (build-system gnu-build-system)
119 (inputs `(("ncurses" ,ncurses)
124 (list (string-append "--with-ncurses="
125 (assoc-ref %build-inputs "ncurses"))
126 (string-append "--with-sqlite3="
127 (assoc-ref %build-inputs "sqlite")))
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"))
140 (home-page "https://www.gnu.org/software/global/")
141 (synopsis "Cross-environment source code tag system")
143 "GNU GLOBAL is a source code tagging system that functions in the same
144 way across a wide array of environments, such as different text editors,
145 shells and web browsers. The resulting tags are useful for quickly moving
146 around in a large, deeply nested project.")
147 (license license:gpl3+)))
149 (define-public sloccount
155 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
159 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
160 (build-system gnu-build-system)
162 '(#:phases (modify-phases %standard-phases
164 (add-before 'build 'make-dotl-files-older
166 ;; Make the '.l' files as old as the '.c'
167 ;; files to avoid triggering the rule that
172 (for-each (lambda (file)
173 (set-file-time file ref))
174 (find-files "." "\\.[chl]$"))
176 (add-before 'install 'make-target-directories
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
182 (mkdir-p (string-append out
186 (setenv "HOME" (getcwd))
188 (string-append (getcwd) ":"
190 (zero? (system* "make" "test")))))
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)")
198 "SLOCCount is a set of the programs for counting source lines of
199 code (SLOC) in large software systems. It can automatically identify and
200 measure a wide range of programming languages. It automatically estimates the
201 effort, time, and money it would take to develop the software, using the
202 COCOMO model or user-provided parameters.")
203 (license license:gpl2+)))
213 "https://github.com/AlDanial/cloc/releases/download/v" version
214 "/cloc-" version ".tar.gz"))
217 "05srlvzwisr7y7ymvzb5yfdsrspja27ysqdmkwhiiivy84mq2gnl"))))
218 (build-system gnu-build-system)
220 `(("coreutils" ,coreutils)
222 ("perl-algorithm-diff" ,perl-algorithm-diff)
223 ("perl-digest-md5" ,perl-digest-md5)
224 ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
225 ("perl-regexp-common" ,perl-regexp-common)))
227 `(#:phases (modify-phases %standard-phases
231 (lambda* (#:key inputs outputs #:allow-other-keys)
232 (let* ((out (assoc-ref outputs "out")))
233 (invoke "make" "-C" "Unix"
234 (string-append "prefix=" out)
235 (string-append "INSTALL="
236 (assoc-ref inputs "coreutils")
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")
245 ,(string-split (getenv "PERL5LIB") #\:)))
248 ;; Tests require some other packages.
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
253 of source code in many programming languages. Given two versions of a code
254 base, cloc can compute differences in blank, comment, and source lines.
256 cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
257 cloc can handle a greater variety of programming languages.")
258 (license license:gpl2+)))
260 (define-public the-silver-searcher
262 (name "the-silver-searcher")
267 "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
271 "1m0mih1x4jpswc8ganhqh0gmwbmd2hzmz7402mxfh19s3kcjnrfl"))))
272 (build-system gnu-build-system)
274 `(("pkg-config" ,pkg-config)))
279 (home-page "http://geoff.greer.fm/ag/")
280 (synopsis "Fast code searching tool")
282 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
283 numbers of files. It's intended primarily for source code repositories, and
284 respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
285 of magnitude faster than its inspiration, @command{ack}, and less specialised
286 tools such as @command{grep}.")
287 (license license:asl2.0)))
295 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
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")
304 "Trio is a set of @code{printf} and string functions designed be used by
305 applications with a focus on portability or with the need for additional
306 features 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"))))
312 (define-public withershins
319 "https://github.com/cameronwhite/withershins/archive/v"
321 (file-name (string-append name "-" version ".tar.gz"))
324 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
325 (build-system cmake-build-system)
327 `(#:out-of-source? #f
329 (modify-phases %standard-phases
331 'unpack 'find-libiberty
333 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
334 (substitute* "cmake/FindIberty.cmake"
335 (("/usr/include") (string-append libiberty "/include"))
336 (("libiberty.a iberty")
337 (string-append "NAMES libiberty.a iberty\nPATHS \""
338 libiberty "/lib" "\"")))
342 (lambda* (#:key outputs #:allow-other-keys)
343 (let* ((out (assoc-ref outputs "out"))
344 (include (string-append out "/include"))
345 (lib (string-append out "/lib")))
347 (install-file "src/withershins.hpp" include)
349 (install-file "src/libwithershins.a" lib))
351 (home-page "https://github.com/cameronwhite/withershins")
353 `(("libiberty" ,libiberty)
354 ("binutils" ,binutils) ;for libbfd
356 (synopsis "C++11 library for generating stack traces")
358 "Withershins is a simple cross-platform C++11 library for generating
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+)))
370 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
371 "/LCOV-" version "/lcov-" version ".tar.gz"))
374 "08wabnb0gcjqk0qc65a6cgbbmz6b8lvam3p7byh0dk42hj3jr5s4"))))
375 (build-system gnu-build-system)
378 (let ((out (assoc-ref %outputs "out")))
379 (list (string-append "PREFIX=" out)))
381 (modify-phases %standard-phases
382 (delete 'configure)) ; no configure script
383 #:tests? #f)) ; no 'check' target
384 (inputs `(("perl" ,perl)))
385 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
386 (synopsis "Code coverage tool that enhances GNU gcov")
388 "LCOV is an extension of @command{gcov}, a tool part of the
389 GNU@tie{}Binutils, which provides information about what parts of a program
390 are actually executed (i.e., \"covered\") while running a particular test
391 case. The extension consists of a set of Perl scripts which build on the
392 textual @command{gcov} output to implement the following enhanced
393 functionality such as HTML output.")
394 (license license:gpl2+)))
400 (home-page "https://github.com/Andersbakken/rtags")
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)))
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")))
416 (("#include ?\"rct/(.*.h)\"" all header)
417 (string-append "#include <rct/" header ">")))
421 "0scjbp1z201q8njvrxqz7lk2m9b6k2rxd5q1shrng6532r7ndif2"))))
422 (build-system cmake-build-system)
425 '("-DRTAGS_NO_ELISP_FILES=1"
426 "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
427 "-DCMAKE_CXX_FLAGS=-std=c++11"
428 "-DBUILD_TESTING=FALSE")
431 `(("pkg-config" ,pkg-config)))
433 `(("bash-completion" ,bash-completion)
439 (synopsis "Indexer for the C language family with Emacs integration")
441 "RTags is a client/server application that indexes C/C++ code and keeps a
442 persistent file-based database of references, declarations, definitions,
443 symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
444 to find symbols by name (including nested class and namespace scope). Most
445 importantly we give you proper follow-symbol and find-references support.")
446 (license license:gpl3+)))
448 (define-public colormake
451 (version "0.9.20140503")
455 (uri (string-append "https://github.com/pagekite/Colormake/archive/"
457 (file-name (string-append name "-" version ".tar.gz"))
460 "08ldss9zd8ls6bjahvxhffpsjcysifr720yf3jz9db2mlklzmyd3"))))
461 (build-system trivial-build-system)
468 `(#:modules ((guix build utils))
471 (use-modules (guix build utils))
473 (setenv "PATH" (string-append
474 (assoc-ref %build-inputs "tar") "/bin" ":"
475 (assoc-ref %build-inputs "gzip") "/bin"))
476 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
477 (chdir (string-append (string-capitalize ,name) "-" ,version))
478 (patch-shebang "colormake.pl"
479 (list (string-append (assoc-ref %build-inputs "perl")
481 (let* ((out (assoc-ref %outputs "out"))
482 (bin (string-append out "/bin"))
483 (doc (string-append out "/share/doc"))
484 (install-files (lambda (files directory)
485 (for-each (lambda (file)
486 (install-file file directory))
488 (substitute* "colormake"
489 (("colormake\\.pl") (string-append bin "/colormake.pl"))
491 (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
492 (install-file "colormake.1" (string-append doc "/man/man1"))
493 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
494 (install-files '("colormake" "colormake-short" "clmake"
495 "clmake-short" "colormake.pl")
497 (home-page "http://bre.klaki.net/programs/colormake/")
498 (synopsis "Wrapper around @command{make} to produce colored output")
499 (description "This package provides a wrapper around @command{make} to
500 produce colored output.")
501 (license license:gpl2+)))
503 (define-public makefile2graph
505 (name "makefile2graph")
509 (uri (string-append "https://github.com/lindenb/" name
510 "/archive/v" version ".tar.gz"))
513 "0h1vchkpmm9h6s87p5nf0ksjxcmsxpx8k62a508w428n570wcr4l"))
514 (file-name (string-append name "-" version ".tar.gz"))))
515 (build-system gnu-build-system)
517 '(#:test-target "test"
518 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
520 (modify-phases %standard-phases
521 (delete 'configure))))
523 `(("graphviz" ,graphviz)))
524 (home-page "https://github.com/lindenb/makefile2graph")
525 (synopsis "Creates a graph of dependencies from GNU Make")
527 "@code{make2graph} creates a graph of dependencies from GNU Make. The
528 output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
529 independent targets.")
530 (license license:expat)))