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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages code)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system cmake)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages databases)
30 #:use-module (gnu packages emacs)
31 #:use-module (gnu packages gcc)
32 #:use-module (gnu packages pcre)
33 #:use-module (gnu packages pkg-config)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages texinfo)
36 #:use-module (gnu packages autogen)
37 #:use-module (gnu packages ncurses)
38 #:use-module (gnu packages autotools))
40 ;;; Tools to deal with source code: metrics, cross-references, etc.
48 (uri (string-append "mirror://gnu/cflow/cflow-"
52 "1jkbq97ajcf834z68hbn3xfhiz921zhn39gklml1racf0kb3jzh3"))))
53 (build-system gnu-build-system)
55 ;; Needed to have cflow-mode.el installed.
56 (native-inputs `(("emacs" ,emacs-no-x)))
58 (home-page "http://www.gnu.org/software/cflow/")
59 (synopsis "Create a graph of control flow within a program")
61 "GNU cflow analyzes C source files and produces a graph charting the
62 control flow of the program. It can output the graph in several styles and
63 in either the POSIX format or in an extended GNU format. cflow also includes
64 a major mode for Emacs for examining the flowcharts that it produces.")
65 (license license:gpl3+)))
67 (define-public complexity
73 (uri (string-append "mirror://gnu/complexity/complexity-"
77 "19bc64sxpqd5rqylqaa7dijz2x7qp2b0dg3ah3fb3qbcvd8b4wgy"))))
78 (build-system gnu-build-system)
80 `(("texinfo" ,texinfo)
81 ("autogen" ,autogen)))
82 (home-page "http://www.gnu.org/software/complexity/")
83 (synopsis "Analyze complexity of C functions")
85 "GNU complexity provides tools for finding procedures that are
86 convoluted, overly long or otherwise difficult to understand. This
87 may help in learning or reviewing unfamiliar code or perhaps
88 highlighting your own code that seemed comprehensible when you wrote it.")
89 (license license:gpl3+)))
91 (define-public global ; a global variable
97 (uri (string-append "mirror://gnu/global/global-"
101 "1y34nbazsw2p6r2jhv27z15qvm9mhy5xjchpz8pwps00shkm578f"))))
102 (build-system gnu-build-system)
103 (inputs `(("ncurses" ,ncurses)
108 (list (string-append "--with-ncurses="
109 (assoc-ref %build-inputs "ncurses"))
110 (string-append "--with-sqlite3="
111 (assoc-ref %build-inputs "sqlite")))
113 #:phases (alist-cons-after
114 'install 'post-install
115 (lambda* (#:key outputs #:allow-other-keys)
116 ;; Install the Emacs Lisp file in the right place.
117 (let* ((out (assoc-ref outputs "out"))
118 (data (string-append out "/share/gtags"))
119 (lisp (string-append out "/share/emacs/site-lisp")))
120 (install-file (string-append data "/gtags.el")
122 (delete-file (string-append data "/gtags.el"))
125 (home-page "http://www.gnu.org/software/global/")
126 (synopsis "Cross-environment source code tag system")
128 "GLOBAL is a source code tagging system that functions in the same way
129 across a wide array of environments, such as different text editors, shells
130 and web browsers. The resulting tags are useful for quickly moving around in
131 a large, deeply nested project.")
132 (license license:gpl3+)))
134 (define-public sloccount
140 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
144 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
145 (build-system gnu-build-system)
147 '(#:phases (modify-phases %standard-phases
149 (add-before 'build 'make-dotl-files-older
151 ;; Make the '.l' files as old as the '.c'
152 ;; files to avoid triggering the rule that
157 (for-each (lambda (file)
158 (set-file-time file ref))
159 (find-files "." "\\.[chl]$"))
161 (add-before 'install 'make-target-directories
162 (lambda* (#:key outputs #:allow-other-keys)
163 (let ((out (assoc-ref outputs "out")))
164 (mkdir-p (string-append out "/bin"))
165 (mkdir-p (string-append out
167 (mkdir-p (string-append out
171 (setenv "HOME" (getcwd))
173 (string-append (getcwd) ":"
175 (zero? (system* "make" "test")))))
177 #:make-flags (list (string-append "PREFIX="
178 (assoc-ref %outputs "out")))))
179 (inputs `(("perl" ,perl)))
180 (home-page "http://www.dwheeler.com/sloccount/")
181 (synopsis "Count physical source lines of code (SLOC)")
183 "SLOCCount is a set of the programs for counting source lines of
184 code (SLOC) in large software systems. It can automatically identify and
185 measure a wide range of programming languages. It automatically estimates the
186 effort, time, and money it would take to develop the software, using the
187 COCOMO model or user-provided parameters.")
188 (license license:gpl2+)))
190 (define-public the-silver-searcher
192 (name "the-silver-searcher")
197 "https://github.com/ggreer/the_silver_searcher/archive/"
201 "0ah7vcqprl9hhafi68bvzaiywy7dfm28zf7kpw3xrlqzfn0vg7kp"))
202 (file-name (string-append name "-" version ".tar.gz"))))
203 (build-system gnu-build-system)
205 `(("autoconf" ,autoconf)
206 ("automake" ,automake)
208 ("pkg-config" ,pkg-config)))
215 ;; There is no configure yet, so let's create it, but let configure and
216 ;; make do the work in later phases.
217 (alist-cons-before 'configure 'autoconf
219 (substitute* "build.sh"
220 (("./configure") "true")
221 (("make -j4") "true"))
222 (zero? (system* "sh" "build.sh")))
224 (home-page "http://geoff.greer.fm/ag/")
225 (synopsis "Fast code searching tool")
227 "The silver searcher, or 'ag', is tool for quickly searching through
228 files, but compared to grep is much faster and respects files like .gitignore,
230 (license license:asl2.0)))
232 (define-public withershins
239 "https://github.com/cameronwhite/withershins/archive/v"
241 (file-name (string-append name "-" version ".tar.gz"))
244 "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
245 (build-system cmake-build-system)
247 `(#:out-of-source? #f
249 (modify-phases %standard-phases
251 'unpack 'find-libiberty
253 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
254 (substitute* "cmake/FindIberty.cmake"
255 (("/usr/include") (string-append libiberty "/include"))
256 (("libiberty.a iberty")
257 (string-append "NAMES libiberty.a iberty\nPATHS \""
258 libiberty "/lib" "\"")))
262 (lambda* (#:key outputs #:allow-other-keys)
263 (let ((out (assoc-ref outputs "out")))
264 (mkdir-p (string-append out "/lib"))
265 (mkdir (string-append out "/include"))
266 (copy-file "src/withershins.hpp"
267 (string-append out "/include/withershins.hpp"))
268 (copy-file "src/libwithershins.a"
269 (string-append out "/lib/libwithershins.a")))
271 (home-page "https://github.com/cameronwhite/withershins")
273 `(("libiberty" ,libiberty)
274 ("binutils" ,binutils) ;for libbfd
276 (synopsis "C++11 library for generating stack traces")
278 "Withershins is a simple cross-platform C++11 library for generating
280 ;; Sources are released under Expat license, but since BFD is licensed
281 ;; under the GPLv3+ the combined work is GPLv3+ as well.
282 (license license:gpl3+)))