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