gnu: Add wl-clipboard.
[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.80")
215 (source
216 (origin
217 (method url-fetch)
218 (uri (string-append
219 "https://github.com/AlDanial/cloc/releases/download/v" version
220 "/cloc-" version ".tar.gz"))
221 (sha256
222 (base32
223 "0rqxnaskg5b736asyzfda1113zvpkajyqjf49vl9wgzf1r9m6bq8"))))
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) ; nothing to configure
235 (delete 'build) ; nothing to 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 (source
407 (origin
408 (method git-fetch)
409 (uri (git-reference
410 (url "https://github.com/Andersbakken/rtags.git")
411 (commit (string-append "v" version))))
412 (file-name (git-file-name name version))
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 "0raqjbkl1ykga4ahgl9xw49cgh3cyqcf42z36z7d6fz1fw192kg0"))))
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 (home-page "https://github.com/Andersbakken/rtags")
446 (synopsis "Indexer for the C language family with Emacs integration")
447 (description
448 "RTags is a client/server application that indexes C/C++ code and keeps a
449 persistent file-based database of references, declarations, definitions,
450 symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
451 to find symbols by name (including nested class and namespace scope). Most
452 importantly we give you proper follow-symbol and find-references support.")
453 (license license:gpl3+)))
454
455 (define-public colormake
456 (package
457 (name "colormake")
458 (version "0.9.20140503")
459 (source
460 (origin
461 (method url-fetch)
462 (uri (string-append "https://github.com/pagekite/Colormake/archive/"
463 version ".tar.gz"))
464 (file-name (string-append name "-" version ".tar.gz"))
465 (sha256
466 (base32
467 "08ldss9zd8ls6bjahvxhffpsjcysifr720yf3jz9db2mlklzmyd3"))))
468 (build-system trivial-build-system)
469 (native-inputs
470 `(("bash" ,bash)
471 ("gzip" ,gzip)
472 ("perl" ,perl)
473 ("tar" ,tar)))
474 (arguments
475 `(#:modules ((guix build utils))
476 #:builder
477 (begin
478 (use-modules (guix build utils))
479 ;; bootstrap
480 (setenv "PATH" (string-append
481 (assoc-ref %build-inputs "tar") "/bin" ":"
482 (assoc-ref %build-inputs "gzip") "/bin"))
483 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
484 (chdir (string-append (string-capitalize ,name) "-" ,version))
485 (patch-shebang "colormake.pl"
486 (list (string-append (assoc-ref %build-inputs "perl")
487 "/bin")))
488 (let* ((out (assoc-ref %outputs "out"))
489 (bin (string-append out "/bin"))
490 (doc (string-append out "/share/doc"))
491 (install-files (lambda (files directory)
492 (for-each (lambda (file)
493 (install-file file directory))
494 files))))
495 (substitute* "colormake"
496 (("colormake\\.pl") (string-append bin "/colormake.pl"))
497 (("/bin/bash")
498 (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
499 (install-file "colormake.1" (string-append doc "/man/man1"))
500 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
501 (install-files '("colormake" "colormake-short" "clmake"
502 "clmake-short" "colormake.pl")
503 bin)
504 #t))))
505 (home-page "http://bre.klaki.net/programs/colormake/")
506 (synopsis "Wrapper around @command{make} to produce colored output")
507 (description "This package provides a wrapper around @command{make} to
508 produce colored output.")
509 (license license:gpl2+)))
510
511 (define-public makefile2graph
512 (package
513 (name "makefile2graph")
514 (version "1.5.0")
515 (source (origin
516 (method url-fetch)
517 (uri (string-append "https://github.com/lindenb/" name
518 "/archive/v" version ".tar.gz"))
519 (sha256
520 (base32
521 "0h1vchkpmm9h6s87p5nf0ksjxcmsxpx8k62a508w428n570wcr4l"))
522 (file-name (string-append name "-" version ".tar.gz"))))
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
536 output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
537 independent targets.")
538 (license license:expat)))
539
540 (define-public uncrustify
541 (package
542 (name "uncrustify")
543 (version "0.68.1")
544 (source (origin
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))
550 (sha256
551 (base32
552 "0gf6vjcfy8pl7idvwsd500ffj9hri62q0n79kpb6cnfprrqpbgf4"))))
553 (build-system cmake-build-system)
554 (native-inputs
555 `(("unzip" ,unzip)
556 ("python" ,python-wrapper)))
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#,
573 Objective@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+)))
583
584 (define-public astyle
585 (package
586 (name "astyle")
587 (version "3.1")
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
595 "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"))))
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")
602 #:phases
603 (modify-phases %standard-phases
604 (replace 'configure
605 (lambda _ (chdir "build/gcc") #t))
606 (add-after 'install 'install-libs
607 (lambda* (#:key outputs #:allow-other-keys)
608 ;; Libraries are not installed by default
609 (let* ((output (assoc-ref outputs "out"))
610 (libdir (string-append output "/lib")))
611 (begin
612 (mkdir-p libdir)
613 (for-each (lambda (l)
614 (copy-file
615 l (string-append libdir "/" (basename l))))
616 (find-files "bin" "lib*"))))
617 #t)))))
618 (home-page "http://astyle.sourceforge.net/")
619 (synopsis "Source code indenter, formatter, and beautifier")
620 (description
621 "Artistic Style is a source code indenter, formatter, and beautifier for
622 the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
623 (license license:lgpl3+)))
624
625 (define-public indent
626 (package
627 (name "indent")
628 (version "2.2.10")
629 (source (origin
630 (method url-fetch)
631 (uri (string-append "mirror://gnu/indent/indent-" version
632 ".tar.gz"))
633 (sha256 (base32
634 "0f9655vqdvfwbxvs1gpa7py8k1z71aqh8hp73f65vazwbfz436wa"))))
635 (build-system gnu-build-system)
636 (arguments
637 `(#:phases
638 (modify-phases %standard-phases
639 (add-after 'unpack 'fix-docdir
640 (lambda _
641 ;; Although indent uses a modern autoconf in which docdir
642 ;; defaults to PREFIX/share/doc, the doc/Makefile.am
643 ;; overrides this to be in PREFIX/doc. Fix this.
644 (substitute* "doc/Makefile.in"
645 (("^docdir = .*$") "docdir = @docdir@\n"))
646 #t)))))
647 (synopsis "Code reformatter")
648 (description
649 "Indent is a program that makes source code easier to read by
650 reformatting it in a consistent style. It can change the style to one of
651 several different styles such as GNU, BSD or K&R. It has some flexibility to
652 deal with incomplete or malformed syntax. GNU indent offers several
653 extensions over the standard utility.")
654 (license license:gpl3+)
655 (home-page "https://www.gnu.org/software/indent/")))
656
657 (define-public indent-2.2.12
658 (package
659 (inherit indent)
660 (version "2.2.12")
661 (source (origin
662 (method url-fetch)
663 (uri (string-append "mirror://gnu/indent/indent-" version
664 ".tar.gz"))
665 (sha256
666 (base32
667 "12xvcd16cwilzglv9h7sgh4h1qqjd1h8s48ji2dla58m4706hzg7"))))
668 (native-inputs `(("texinfo" ,texinfo)))))
669
670 (define-public amalgamate
671 (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
672 (revision "0")
673 (version (git-version "1.1.1" revision commit)))
674 (package
675 (name "amalgamate")
676 (version version)
677 (home-page "https://github.com/edlund/amalgamate")
678 (source
679 (origin
680 (method git-fetch)
681 (uri (git-reference
682 (url home-page)
683 (commit commit)))
684 (sha256
685 (base32
686 "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
687 (file-name (git-file-name name version))
688 (modules '((guix build utils)))
689 (snippet
690 '(substitute* "test.sh"
691 (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
692 "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
693 (build-system gnu-build-system)
694 (inputs
695 `(("python" ,python-wrapper)))
696 (arguments
697 `(#:phases
698 (modify-phases %standard-phases
699 (delete 'configure)
700 (delete 'build)
701 (replace 'install
702 (lambda* (#:key outputs #:allow-other-keys)
703 (let* ((out (assoc-ref outputs "out"))
704 (bin (string-append out "/bin")))
705 (install-file "amalgamate.py" bin))))
706 (replace 'check
707 (lambda _
708 (invoke "./test.sh"))))))
709 (synopsis "Tool for amalgamating C source and header files")
710 ;; The package is indeed a script file, and the term "amalgamate.py" is
711 ;; used by upstream.
712 (description "amalgamate.py aims to make it easy to use SQLite-style C
713 source and header amalgamation in projects.")
714 (license license:bsd-3))))