Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / code.scm
CommitLineData
23153c90 1;;; GNU Guix --- Functional package management for GNU
4b3070f7 2;;; Copyright © 2013, 2015, 2018 Ludovic Courtès <ludo@gnu.org>
99e64a6e 3;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4bfd8579 4;;; Copyright © 2015, 2018 Ricardo Wurmus <rekado@elephly.net>
c65bfc65 5;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
ba7cd0fd 6;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
8af20b99 7;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
f7fc9667 8;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
4b3070f7 9;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
4715f92e 10;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
c1e5109b 11;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
e470abf8
LC
12;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
13;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
62b8ae1a 14;;; Copyright © 2019 Hartmut Goebel <h.goebel@goebel-consult.de>
23153c90
LC
15;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages code)
32 #:use-module (guix packages)
59bd4b90 33 #:use-module (guix utils)
23153c90 34 #:use-module (guix download)
ad8a4d6d 35 #:use-module (guix git-download)
d13586bf 36 #:use-module ((guix licenses) #:prefix license:)
23153c90 37 #:use-module (guix build-system gnu)
76e14638 38 #:use-module (guix build-system cmake)
dc993847 39 #:use-module (guix build-system trivial)
457fc22d 40 #:use-module (gnu packages)
ad8a4d6d
FT
41 #:use-module (gnu packages autogen)
42 #:use-module (gnu packages autotools)
76e14638 43 #:use-module (gnu packages base)
ad8a4d6d 44 #:use-module (gnu packages bash)
d13586bf 45 #:use-module (gnu packages compression)
457fc22d 46 #:use-module (gnu packages cpp)
99e64a6e 47 #:use-module (gnu packages emacs)
76e14638 48 #:use-module (gnu packages gcc)
906dcb20 49 #:use-module (gnu packages graphviz)
d13586bf 50 #:use-module (gnu packages pcre)
99e64a6e 51 #:use-module (gnu packages perl)
ad8a4d6d
FT
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages python)
cd0322a3 54 #:use-module (gnu packages sqlite)
99e64a6e 55 #:use-module (gnu packages texinfo)
99e64a6e 56 #:use-module (gnu packages ncurses)
4b3070f7 57 #:use-module (gnu packages llvm)
ad8a4d6d 58 #:use-module (gnu packages lua))
23153c90
LC
59
60;;; Tools to deal with source code: metrics, cross-references, etc.
61
99e64a6e
LC
62(define-public cflow
63 (package
64 (name "cflow")
cfae5382 65 (version "1.6")
99e64a6e
LC
66 (source (origin
67 (method url-fetch)
68 (uri (string-append "mirror://gnu/cflow/cflow-"
69 version ".tar.bz2"))
70 (sha256
71 (base32
cfae5382 72 "1mzd3yf0dfv8h2av5vsxxlhpk21nw064h91b2kgfrdz92r0pnj1l"))))
99e64a6e
LC
73 (build-system gnu-build-system)
74
75 ;; Needed to have cflow-mode.el installed.
b8fc3622 76 (native-inputs `(("emacs" ,emacs-minimal)))
65d98906
OP
77 (arguments
78 '(#:configure-flags (list (string-append "CPPFLAGS="
79 "-D" "CFLOW_PREPROC=\\\""
80 (assoc-ref %build-inputs "gcc")
81 "/bin/cpp\\\""))))
6fd52309 82 (home-page "https://www.gnu.org/software/cflow/")
99e64a6e
LC
83 (synopsis "Create a graph of control flow within a program")
84 (description
85 "GNU cflow analyzes C source files and produces a graph charting the
86control flow of the program. It can output the graph in several styles and
e881752c 87in either the POSIX format or in an extended GNU format. cflow also includes
99e64a6e 88a major mode for Emacs for examining the flowcharts that it produces.")
d13586bf 89 (license license:gpl3+)))
99e64a6e
LC
90
91(define-public complexity
92 (package
93 (name "complexity")
1e42d8b8 94 (version "1.10")
99e64a6e
LC
95 (source (origin
96 (method url-fetch)
97 (uri (string-append "mirror://gnu/complexity/complexity-"
1e42d8b8 98 version ".tar.xz"))
99e64a6e
LC
99 (sha256
100 (base32
1e42d8b8 101 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
99e64a6e
LC
102 (build-system gnu-build-system)
103 (native-inputs
104 `(("texinfo" ,texinfo)
105 ("autogen" ,autogen)))
6fd52309 106 (home-page "https://www.gnu.org/software/complexity/")
99e64a6e
LC
107 (synopsis "Analyze complexity of C functions")
108 (description
109 "GNU complexity provides tools for finding procedures that are
110convoluted, overly long or otherwise difficult to understand. This
111may help in learning or reviewing unfamiliar code or perhaps
112highlighting your own code that seemed comprehensible when you wrote it.")
d13586bf 113 (license license:gpl3+)))
99e64a6e
LC
114
115(define-public global ; a global variable
116 (package
117 (name "global")
ad83280f 118 (version "6.6.4")
99e64a6e
LC
119 (source (origin
120 (method url-fetch)
121 (uri (string-append "mirror://gnu/global/global-"
122 version ".tar.gz"))
123 (sha256
124 (base32
ad83280f 125 "1515642wsjz7x3rsgaqk4sc7n0z2znl7idsk8jz8wgy5aswqqzlq"))))
99e64a6e
LC
126 (build-system gnu-build-system)
127 (inputs `(("ncurses" ,ncurses)
e1ac691d
LC
128 ("libltdl" ,libltdl)
129 ("sqlite" ,sqlite)))
99e64a6e
LC
130 (arguments
131 `(#:configure-flags
132 (list (string-append "--with-ncurses="
e1ac691d
LC
133 (assoc-ref %build-inputs "ncurses"))
134 (string-append "--with-sqlite3="
135 (assoc-ref %build-inputs "sqlite")))
99e64a6e 136
9d9951d6
EF
137 #:phases
138 (modify-phases %standard-phases
139 (add-after 'install 'post-install
140 (lambda* (#:key outputs #:allow-other-keys)
141 ;; Install the Emacs Lisp file in the right place.
142 (let* ((out (assoc-ref outputs "out"))
143 (data (string-append out "/share/gtags"))
144 (lisp (string-append out "/share/emacs/site-lisp")))
145 (install-file (string-append data "/gtags.el") lisp)
146 (delete-file (string-append data "/gtags.el"))
147 #t))))))
6fd52309 148 (home-page "https://www.gnu.org/software/global/")
99e64a6e
LC
149 (synopsis "Cross-environment source code tag system")
150 (description
254a8819
CL
151 "GNU GLOBAL is a source code tagging system that functions in the same
152way across a wide array of environments, such as different text editors,
153shells and web browsers. The resulting tags are useful for quickly moving
154around in a large, deeply nested project.")
d13586bf 155 (license license:gpl3+)))
99e64a6e 156
23153c90
LC
157(define-public sloccount
158 (package
159 (name "sloccount")
160 (version "2.26")
161 (source (origin
162 (method url-fetch)
163 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
164 version ".tar.gz"))
165 (sha256
166 (base32
167 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
168 (build-system gnu-build-system)
169 (arguments
170 '(#:phases (modify-phases %standard-phases
f8503e2b
LC
171 (delete 'configure)
172 (add-before 'build 'make-dotl-files-older
23153c90
LC
173 (lambda _
174 ;; Make the '.l' files as old as the '.c'
175 ;; files to avoid triggering the rule that
176 ;; requires Flex.
177 (define ref
178 (stat "README"))
179
180 (for-each (lambda (file)
181 (set-file-time file ref))
182 (find-files "." "\\.[chl]$"))
183 #t))
f8503e2b 184 (add-before 'install 'make-target-directories
23153c90
LC
185 (lambda* (#:key outputs #:allow-other-keys)
186 (let ((out (assoc-ref outputs "out")))
187 (mkdir-p (string-append out "/bin"))
188 (mkdir-p (string-append out
189 "/share/man/man1"))
190 (mkdir-p (string-append out
e99b4772
RW
191 "/share/doc"))
192 #t)))
f8503e2b 193 (replace 'check
23153c90
LC
194 (lambda _
195 (setenv "HOME" (getcwd))
196 (setenv "PATH"
197 (string-append (getcwd) ":"
198 (getenv "PATH")))
e99b4772 199 (invoke "make" "test"))))
23153c90
LC
200
201 #:make-flags (list (string-append "PREFIX="
202 (assoc-ref %outputs "out")))))
203 (inputs `(("perl" ,perl)))
204 (home-page "http://www.dwheeler.com/sloccount/")
205 (synopsis "Count physical source lines of code (SLOC)")
206 (description
207 "SLOCCount is a set of the programs for counting source lines of
208code (SLOC) in large software systems. It can automatically identify and
209measure a wide range of programming languages. It automatically estimates the
210effort, time, and money it would take to develop the software, using the
211COCOMO model or user-provided parameters.")
d13586bf
212 (license license:gpl2+)))
213
f7fc9667
AW
214(define-public cloc
215 (package
216 (name "cloc")
ba7cd0fd 217 (version "1.84")
f7fc9667
AW
218 (source
219 (origin
38878020
TGR
220 (method git-fetch)
221 (uri (git-reference
222 (url "https://github.com/AlDanial/cloc.git")
223 (commit version)))
224 (file-name (git-file-name name version))
f7fc9667 225 (sha256
ba7cd0fd 226 (base32 "14xikdwcr6pcnkk2i43zrsj88z8b3mrv0svbnbvxvarw1id83pnn"))))
f7fc9667
AW
227 (build-system gnu-build-system)
228 (inputs
229 `(("coreutils" ,coreutils)
230 ("perl" ,perl)
231 ("perl-algorithm-diff" ,perl-algorithm-diff)
95943ed7
TGR
232 ("perl-digest-md5" ,perl-digest-md5)
233 ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
234 ("perl-regexp-common" ,perl-regexp-common)))
f7fc9667
AW
235 (arguments
236 `(#:phases (modify-phases %standard-phases
295fc415
TGR
237 (delete 'configure) ; nothing to configure
238 (delete 'build) ; nothing to build
f7fc9667
AW
239 (replace 'install
240 (lambda* (#:key inputs outputs #:allow-other-keys)
241 (let* ((out (assoc-ref outputs "out")))
53244d1f
TGR
242 (invoke "make" "-C" "Unix"
243 (string-append "prefix=" out)
244 (string-append "INSTALL="
245 (assoc-ref inputs "coreutils")
246 "/bin/install")
247 "install")
248 #t)))
f7fc9667
AW
249 (add-after 'install 'wrap-program
250 (lambda* (#:key inputs outputs #:allow-other-keys)
251 (let ((out (assoc-ref outputs "out")))
252 (wrap-program (string-append out "/bin/cloc")
253 `("PERL5LIB" ":" =
254 ,(string-split (getenv "PERL5LIB") #\:)))
255 #t))))
256 #:out-of-source? #t
257 ;; Tests require some other packages.
258 #:tests? #f))
259 (home-page "https://github.com/AlDanial/cloc")
260 (synopsis "Count source lines of code (SLOC) and other source code metrics")
261 (description "cloc counts blank lines, comment lines, and physical lines
262of source code in many programming languages. Given two versions of a code
263base, cloc can compute differences in blank, comment, and source lines.
264
265cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
e0f49664 266cloc can handle a greater variety of programming languages.")
f7fc9667
AW
267 (license license:gpl2+)))
268
d13586bf
269(define-public the-silver-searcher
270 (package
271 (name "the-silver-searcher")
ffa82227 272 (version "2.2.0")
d13586bf
273 (source (origin
274 (method url-fetch)
275 (uri (string-append
422a6cd4 276 "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
d13586bf
277 version ".tar.gz"))
278 (sha256
279 (base32
ffa82227 280 "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
d13586bf
281 (build-system gnu-build-system)
282 (native-inputs
392f3266 283 `(("pkg-config" ,pkg-config)))
d13586bf
284 (inputs
285 `(("pcre" ,pcre)
286 ("xz" ,xz)
287 ("zlib" ,zlib)))
422a6cd4 288 (home-page "https://geoff.greer.fm/ag/")
d13586bf
289 (synopsis "Fast code searching tool")
290 (description
6acff0f9
TGR
291 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
292numbers of files. It's intended primarily for source code repositories, and
293respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
294of magnitude faster than its inspiration, @command{ack}, and less specialised
295tools such as @command{grep}.")
d13586bf 296 (license license:asl2.0)))
76e14638 297
a4e6356e
RW
298(define-public trio
299 (package
300 (name "trio")
301 (version "1.16")
302 (source (origin
303 (method url-fetch)
304 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
305 version ".tar.gz"))
306 (sha256
307 (base32
308 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
309 (build-system gnu-build-system)
310 (home-page "http://daniel.haxx.se/projects/trio/")
311 (synopsis "Portable and extendable printf and string functions")
312 (description
313 "Trio is a set of @code{printf} and string functions designed be used by
314applications with a focus on portability or with the need for additional
315features that are not supported by the standard @code{stdio} implementation.")
316 ;; This license is very similar to the ISC license, but the wording is
317 ;; slightly different.
318 (license (license:non-copyleft
319 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
320
76e14638
RW
321(define-public withershins
322 (package
323 (name "withershins")
324 (version "0.1")
3dd14ea7
TGR
325 (source
326 (origin
327 (method git-fetch)
328 (uri (git-reference
329 (url "https://github.com/cameronwhite/withershins.git")
330 (commit (string-append "v" version))))
331 (file-name (git-file-name name version))
332 (sha256
333 (base32 "1cviqvbbcwljm1zx12j6511hazr3kscwrvcyifrkfi4fpy5z985m"))))
76e14638
RW
334 (build-system cmake-build-system)
335 (arguments
336 `(#:out-of-source? #f
66c2df9e
TGR
337 #:configure-flags
338 ;; XXX A (justified!) misleading-indentation error breaks the build.
339 (list "-DENABLE_WERROR=OFF")
76e14638
RW
340 #:phases
341 (modify-phases %standard-phases
342 (add-after
343 'unpack 'find-libiberty
344 (lambda _
25734108 345 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
76e14638 346 (substitute* "cmake/FindIberty.cmake"
25734108
RW
347 (("/usr/include") (string-append libiberty "/include"))
348 (("libiberty.a iberty")
349 (string-append "NAMES libiberty.a iberty\nPATHS \""
350 libiberty "/lib" "\"")))
76e14638
RW
351 #t)))
352 (replace
353 'install
354 (lambda* (#:key outputs #:allow-other-keys)
f3860753
TGR
355 (let* ((out (assoc-ref outputs "out"))
356 (include (string-append out "/include"))
357 (lib (string-append out "/lib")))
358 (mkdir-p include)
359 (install-file "src/withershins.hpp" include)
360 (mkdir-p lib)
361 (install-file "src/libwithershins.a" lib))
76e14638
RW
362 #t)))))
363 (home-page "https://github.com/cameronwhite/withershins")
364 (inputs
25734108 365 `(("libiberty" ,libiberty)
76e14638
RW
366 ("binutils" ,binutils) ;for libbfd
367 ("zlib" ,zlib)))
368 (synopsis "C++11 library for generating stack traces")
369 (description
370 "Withershins is a simple cross-platform C++11 library for generating
371stack traces.")
372 ;; Sources are released under Expat license, but since BFD is licensed
373 ;; under the GPLv3+ the combined work is GPLv3+ as well.
374 (license license:gpl3+)))
0084aaf3
LC
375
376(define-public lcov
377 (package
378 (name "lcov")
8fadbc4b 379 (version "1.14")
0084aaf3
LC
380 (source (origin
381 (method url-fetch)
de67e922
LF
382 (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
383 "/LCOV-" version "/lcov-" version ".tar.gz"))
0084aaf3
LC
384 (sha256
385 (base32
8fadbc4b 386 "06h7ixyznf6vz1qvksjgy5f3q2nw9akf6zx59npf0h3l32cmd68l"))))
0084aaf3
LC
387 (build-system gnu-build-system)
388 (arguments
b15af0ce
TGR
389 '(#:make-flags
390 (let ((out (assoc-ref %outputs "out")))
391 (list (string-append "PREFIX=" out)))
392 #:phases
393 (modify-phases %standard-phases
394 (delete 'configure)) ; no configure script
395 #:tests? #f)) ; no 'check' target
0084aaf3
LC
396 (inputs `(("perl" ,perl)))
397 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
398 (synopsis "Code coverage tool that enhances GNU gcov")
399 (description
400 "LCOV is an extension of @command{gcov}, a tool part of the
401GNU@tie{}Binutils, which provides information about what parts of a program
402are actually executed (i.e., \"covered\") while running a particular test
403case. The extension consists of a set of Perl scripts which build on the
404textual @command{gcov} output to implement the following enhanced
405functionality such as HTML output.")
406 (license license:gpl2+)))
4b3070f7
FT
407
408(define-public rtags
409 (package
410 (name "rtags")
af147cdd 411 (version "2.18")
457fc22d
FT
412 (source
413 (origin
84ae0e29
TGR
414 (method git-fetch)
415 (uri (git-reference
416 (url "https://github.com/Andersbakken/rtags.git")
417 (commit (string-append "v" version))))
418 (file-name (git-file-name name version))
457fc22d
FT
419 (patches (search-patches "rtags-separate-rct.patch"))
420 (modules '((guix build utils)))
421 (snippet
422 ;; Part of spliting rct with rtags.
423 ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
424 '(with-directory-excursion "src"
425 (delete-file-recursively "rct") ;remove bundled copy
426 (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
427 (substitute* files
428 (("#include ?\"rct/(.*.h)\"" all header)
6cbee49d
MW
429 (string-append "#include <rct/" header ">")))
430 #t)))
457fc22d
FT
431 (sha256
432 (base32
84ae0e29 433 "0raqjbkl1ykga4ahgl9xw49cgh3cyqcf42z36z7d6fz1fw192kg0"))))
4b3070f7
FT
434 (build-system cmake-build-system)
435 (arguments
3def739d
TGR
436 '(#:build-type "RelWithDebInfo"
437 #:configure-flags
457fc22d 438 '("-DRTAGS_NO_ELISP_FILES=1"
457fc22d 439 "-DBUILD_TESTING=FALSE")
4b3070f7 440 #:tests? #f))
457fc22d
FT
441 (native-inputs
442 `(("pkg-config" ,pkg-config)))
4b3070f7 443 (inputs
457fc22d
FT
444 `(("bash-completion" ,bash-completion)
445 ("clang" ,clang)
4b3070f7 446 ("llvm" ,llvm)
457fc22d
FT
447 ("lua" ,lua)
448 ("rct" ,rct)
449 ("selene" ,selene)))
84ae0e29 450 (home-page "https://github.com/Andersbakken/rtags")
4b3070f7
FT
451 (synopsis "Indexer for the C language family with Emacs integration")
452 (description
453 "RTags is a client/server application that indexes C/C++ code and keeps a
454persistent file-based database of references, declarations, definitions,
455symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
456to find symbols by name (including nested class and namespace scope). Most
457importantly we give you proper follow-symbol and find-references support.")
458 (license license:gpl3+)))
dc993847
OP
459
460(define-public colormake
461 (package
462 (name "colormake")
463 (version "0.9.20140503")
464 (source
465 (origin
213c32e4
TGR
466 (method git-fetch)
467 (uri (git-reference
468 (url "https://github.com/pagekite/Colormake.git")
469 (commit version)))
470 (file-name (git-file-name name version))
dc993847 471 (sha256
213c32e4 472 (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
dc993847
OP
473 (build-system trivial-build-system)
474 (native-inputs
475 `(("bash" ,bash)
213c32e4 476 ("perl" ,perl)))
dc993847
OP
477 (arguments
478 `(#:modules ((guix build utils))
479 #:builder
480 (begin
481 (use-modules (guix build utils))
213c32e4
TGR
482 (copy-recursively (assoc-ref %build-inputs "source") "source")
483 (chdir "source")
dc993847
OP
484 (patch-shebang "colormake.pl"
485 (list (string-append (assoc-ref %build-inputs "perl")
486 "/bin")))
487 (let* ((out (assoc-ref %outputs "out"))
488 (bin (string-append out "/bin"))
489 (doc (string-append out "/share/doc"))
490 (install-files (lambda (files directory)
491 (for-each (lambda (file)
492 (install-file file directory))
493 files))))
494 (substitute* "colormake"
495 (("colormake\\.pl") (string-append bin "/colormake.pl"))
496 (("/bin/bash")
497 (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
498 (install-file "colormake.1" (string-append doc "/man/man1"))
499 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
500 (install-files '("colormake" "colormake-short" "clmake"
501 "clmake-short" "colormake.pl")
e3cfef22
MW
502 bin)
503 #t))))
0e564b5e 504 (home-page "https://bre.klaki.net/programs/colormake/")
dc993847
OP
505 (synopsis "Wrapper around @command{make} to produce colored output")
506 (description "This package provides a wrapper around @command{make} to
507produce colored output.")
508 (license license:gpl2+)))
906dcb20
CB
509
510(define-public makefile2graph
511 (package
512 (name "makefile2graph")
513 (version "1.5.0")
104264cd
TGR
514 (source
515 (origin
516 (method git-fetch)
517 (uri (git-reference
518 (url "https://github.com/lindenb/makefile2graph.git")
519 (commit (string-append "v" version))))
520 (file-name (git-file-name name version))
521 (sha256
522 (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
906dcb20
CB
523 (build-system gnu-build-system)
524 (arguments
525 '(#:test-target "test"
526 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
527 #:phases
528 (modify-phases %standard-phases
529 (delete 'configure))))
530 (native-inputs
531 `(("graphviz" ,graphviz)))
532 (home-page "https://github.com/lindenb/makefile2graph")
533 (synopsis "Creates a graph of dependencies from GNU Make")
534 (description
535 "@code{make2graph} creates a graph of dependencies from GNU Make. The
536output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
537independent targets.")
538 (license license:expat)))
9c4dcfaf
PN
539
540(define-public uncrustify
541 (package
542 (name "uncrustify")
ae5de93a 543 (version "0.69.0")
9c4dcfaf 544 (source (origin
b5944fcb
PN
545 (method git-fetch)
546 (uri (git-reference
547 (url "https://github.com/uncrustify/uncrustify/")
548 (commit (string-append name "-" version))))
549 (file-name (git-file-name name version))
9c4dcfaf
PN
550 (sha256
551 (base32
ae5de93a 552 "0sqrg13kp8fwymq40976bq380bzw40g4ss7ihlbq45d0f90ifa1k"))))
9c4dcfaf
PN
553 (build-system cmake-build-system)
554 (native-inputs
34843fe9
PN
555 `(("unzip" ,unzip)
556 ("python" ,python-wrapper)))
9c4dcfaf
PN
557 (arguments
558 `(#:phases
559 (modify-phases %standard-phases
560 (add-after 'unpack 'unpack-etc
561 (lambda* (#:key inputs outputs #:allow-other-keys)
562 ;; Configuration samples are not installed by default.
563 (let* ((output (assoc-ref outputs "out"))
564 (etcdir (string-append output "/etc")))
565 (for-each (lambda (l)
566 (install-file l etcdir))
567 (find-files "etc" "\\.cfg$")))
568 #t)))))
569 (home-page "http://uncrustify.sourceforge.net/")
570 (synopsis "Code formatter for C and other related languages")
571 (description
572 "Beautify source code in many languages of the C family (C, C++, C#,
573Objective@tie{}C, D, Java, Pawn, and Vala). Features:
574@itemize
575@item Indent and align code.
576@item Reformat comments (a little bit).
577@item Fix inter-character spacing.
578@item Add or remove parens / braces.
579@item Supports embedded SQL @code{EXEC SQL} stuff.
580@item Highly configurable - More than 600 configurable options.
581@end itemize\n")
582 (license license:gpl2+)))
c1e5109b
LC
583
584(define-public astyle
585 (package
586 (name "astyle")
4bfd8579 587 (version "3.1")
c1e5109b
LC
588 (source
589 (origin
590 (method url-fetch)
591 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
592 version "/astyle_" version "_linux.tar.gz"))
593 (sha256
594 (base32
4bfd8579 595 "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"))))
c1e5109b
LC
596 (build-system gnu-build-system)
597 (arguments
598 `(#:tests? #f ;no tests
599 #:make-flags (list (string-append "prefix=" %output)
600 "INSTALL=install"
601 "all")
62b8ae1a
HG
602 #:modules ((guix build gnu-build-system) ;; FIXME use %default-modules
603 (guix build utils)
604 (ice-9 regex))
c1e5109b
LC
605 #:phases
606 (modify-phases %standard-phases
607 (replace 'configure
608 (lambda _ (chdir "build/gcc") #t))
609 (add-after 'install 'install-libs
610 (lambda* (#:key outputs #:allow-other-keys)
0c6ab522 611 ;; Libraries and includes are not installed by default
c1e5109b 612 (let* ((output (assoc-ref outputs "out"))
0c6ab522 613 (incdir (string-append output "/include"))
c1e5109b 614 (libdir (string-append output "/lib")))
62b8ae1a
HG
615 (define (make-so-link sofile strip-pattern)
616 (symlink
617 (basename sofile)
618 (regexp-substitute #f
619 (string-match strip-pattern sofile)
620 'pre)))
0c6ab522
HG
621 (mkdir-p incdir)
622 (copy-file "../../src/astyle.h"
623 (string-append incdir "/astyle.h"))
62b8ae1a
HG
624 (mkdir-p libdir)
625 (for-each (lambda (l)
626 (copy-file
627 l (string-append libdir "/" (basename l))))
628 (find-files "bin" "lib*"))
629 (for-each
630 (lambda (sofile)
631 (make-so-link sofile "(\\.[0-9]){3}$") ;; link .so
632 (make-so-link sofile "(\\.[0-9]){2}$")) ;; link .so.3
633 (find-files libdir "lib.*\\.so\\..*")))
c1e5109b
LC
634 #t)))))
635 (home-page "http://astyle.sourceforge.net/")
636 (synopsis "Source code indenter, formatter, and beautifier")
637 (description
638 "Artistic Style is a source code indenter, formatter, and beautifier for
639the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
640 (license license:lgpl3+)))
e470abf8
LC
641
642(define-public indent
643 (package
644 (name "indent")
7fe6dcf7 645 (version "2.2.12")
e470abf8
LC
646 (source (origin
647 (method url-fetch)
648 (uri (string-append "mirror://gnu/indent/indent-" version
649 ".tar.gz"))
7fe6dcf7
MB
650 (sha256
651 (base32 "12xvcd16cwilzglv9h7sgh4h1qqjd1h8s48ji2dla58m4706hzg7"))))
e470abf8
LC
652 (build-system gnu-build-system)
653 (arguments
9d10a634
MW
654 `(#:phases
655 (modify-phases %standard-phases
656 (add-after 'unpack 'fix-docdir
657 (lambda _
658 ;; Although indent uses a modern autoconf in which docdir
659 ;; defaults to PREFIX/share/doc, the doc/Makefile.am
660 ;; overrides this to be in PREFIX/doc. Fix this.
661 (substitute* "doc/Makefile.in"
662 (("^docdir = .*$") "docdir = @docdir@\n"))
59bd4b90
MO
663 #t))
664 (add-after 'unpack 'fix-configure
665 (lambda* (#:key inputs native-inputs #:allow-other-keys)
666 ;; Replace outdated config.sub and config.guess:
667 (with-directory-excursion "config"
668 (for-each (lambda (file)
669 (install-file
670 (string-append (assoc-ref
671 (or native-inputs inputs) "automake")
672 "/share/automake-"
673 ,(version-major+minor
674 (package-version automake))
675 "/" file) "."))
676 '("config.sub" "config.guess")))
9d10a634 677 #t)))))
7fe6dcf7 678 (native-inputs
59bd4b90
MO
679 `(("texinfo" ,texinfo)
680 ("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
e470abf8
LC
681 (synopsis "Code reformatter")
682 (description
683 "Indent is a program that makes source code easier to read by
684reformatting it in a consistent style. It can change the style to one of
685several different styles such as GNU, BSD or K&R. It has some flexibility to
686deal with incomplete or malformed syntax. GNU indent offers several
687extensions over the standard utility.")
688 (license license:gpl3+)
689 (home-page "https://www.gnu.org/software/indent/")))
ad8a4d6d
FT
690
691(define-public amalgamate
692 (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
693 (revision "0")
694 (version (git-version "1.1.1" revision commit)))
695 (package
696 (name "amalgamate")
697 (version version)
698 (home-page "https://github.com/edlund/amalgamate")
699 (source
700 (origin
701 (method git-fetch)
702 (uri (git-reference
703 (url home-page)
704 (commit commit)))
705 (sha256
706 (base32
707 "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
708 (file-name (git-file-name name version))
709 (modules '((guix build utils)))
710 (snippet
711 '(substitute* "test.sh"
712 (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
713 "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
714 (build-system gnu-build-system)
715 (inputs
716 `(("python" ,python-wrapper)))
717 (arguments
718 `(#:phases
719 (modify-phases %standard-phases
720 (delete 'configure)
721 (delete 'build)
722 (replace 'install
723 (lambda* (#:key outputs #:allow-other-keys)
724 (let* ((out (assoc-ref outputs "out"))
725 (bin (string-append out "/bin")))
726 (install-file "amalgamate.py" bin))))
727 (replace 'check
728 (lambda _
729 (invoke "./test.sh"))))))
730 (synopsis "Tool for amalgamating C source and header files")
731 ;; The package is indeed a script file, and the term "amalgamate.py" is
732 ;; used by upstream.
733 (description "amalgamate.py aims to make it easy to use SQLite-style C
734source and header amalgamation in projects.")
735 (license license:bsd-3))))