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, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017, 2018, 2019, 2020 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 ;;; Copyright © 2019 Hartmut Goebel <h.goebel@goebel-consult.de>
15 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
16 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
17 ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages code)
35 #:use-module (guix packages)
36 #:use-module (guix utils)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module ((guix licenses) #:prefix license:)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system cmake)
42 #:use-module (guix build-system trivial)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages autogen)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages bash)
48 #:use-module (gnu packages c)
49 #:use-module (gnu packages compression)
50 #:use-module (gnu packages cpp)
51 #:use-module (gnu packages curl)
52 #:use-module (gnu packages elf)
53 #:use-module (gnu packages emacs)
54 #:use-module (gnu packages gcc)
55 #:use-module (gnu packages graphviz)
56 #:use-module (gnu packages llvm)
57 #:use-module (gnu packages linux)
58 #:use-module (gnu packages lua)
59 #:use-module (gnu packages ncurses)
60 #:use-module (gnu packages pcre)
61 #:use-module (gnu packages perl)
62 #:use-module (gnu packages perl-compression)
63 #:use-module (gnu packages pkg-config)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages sqlite)
66 #:use-module (gnu packages texinfo)
67 #:use-module (gnu packages web)
68 #:use-module (gnu packages xml))
70 ;;; Tools to deal with source code: metrics, cross-references, etc.
78 (uri (string-append "mirror://gnu/cflow/cflow-"
82 "1mzd3yf0dfv8h2av5vsxxlhpk21nw064h91b2kgfrdz92r0pnj1l"))))
83 (build-system gnu-build-system)
85 ;; Needed to have cflow-mode.el installed.
86 (native-inputs `(("emacs" ,emacs-minimal)))
88 '(#:configure-flags (list (string-append "CPPFLAGS="
89 "-D" "CFLOW_PREPROC=\\\""
90 (assoc-ref %build-inputs "gcc")
92 (home-page "https://www.gnu.org/software/cflow/")
93 (synopsis "Create a graph of control flow within a program")
95 "GNU cflow analyzes C source files and produces a graph charting the
96 control flow of the program. It can output the graph in several styles and
97 in either the POSIX format or in an extended GNU format. cflow also includes
98 a major mode for Emacs for examining the flowcharts that it produces.")
99 (license license:gpl3+)))
101 (define-public complexity
107 (uri (string-append "mirror://gnu/complexity/complexity-"
111 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
112 (build-system gnu-build-system)
114 `(("texinfo" ,texinfo)
115 ("autogen" ,autogen)))
116 (home-page "https://www.gnu.org/software/complexity/")
117 (synopsis "Analyze complexity of C functions")
119 "GNU complexity provides tools for finding procedures that are
120 convoluted, overly long or otherwise difficult to understand. This
121 may help in learning or reviewing unfamiliar code or perhaps
122 highlighting your own code that seemed comprehensible when you wrote it.")
123 (license license:gpl3+)))
125 (define-public global ; a global variable
131 (uri (string-append "mirror://gnu/global/global-"
135 "10vvsgx8v54whb4j9mk5qqyb5h3rdd9da0il3wir8pcpksyk0dww"))))
136 (build-system gnu-build-system)
137 (inputs `(("ncurses" ,ncurses)
140 ("python-wrapper" ,python-wrapper)))
143 (list (string-append "--with-ncurses="
144 (assoc-ref %build-inputs "ncurses"))
145 (string-append "--with-sqlite3="
146 (assoc-ref %build-inputs "sqlite"))
150 (modify-phases %standard-phases
151 (add-after 'install 'post-install
152 (lambda* (#:key outputs #:allow-other-keys)
153 ;; Install the plugin files in the right place.
154 (let* ((out (assoc-ref outputs "out"))
155 (data (string-append out "/share/gtags"))
156 (vim (string-append out "/share/vim/vimfiles/plugin"))
157 (lisp (string-append out "/share/emacs/site-lisp")))
160 (rename-file (string-append data "/gtags.el")
161 (string-append lisp "/gtags.el"))
162 (rename-file (string-append data "/gtags.vim")
163 (string-append vim "/gtags.vim"))
164 (rename-file (string-append data "/gtags-cscope.vim")
165 (string-append vim "/gtags-cscope.vim"))
167 (home-page "https://www.gnu.org/software/global/")
168 (synopsis "Cross-environment source code tag system")
170 "GNU GLOBAL is a source code tagging system that functions in the same
171 way across a wide array of environments, such as different text editors,
172 shells and web browsers. The resulting tags are useful for quickly moving
173 around in a large, deeply nested project.")
174 (license license:gpl3+)))
176 (define-public sloccount
182 (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
186 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
187 (build-system gnu-build-system)
189 '(#:phases (modify-phases %standard-phases
191 (add-before 'build 'make-dotl-files-older
193 ;; Make the '.l' files as old as the '.c'
194 ;; files to avoid triggering the rule that
199 (for-each (lambda (file)
200 (set-file-time file ref))
201 (find-files "." "\\.[chl]$"))
203 (add-before 'install 'make-target-directories
204 (lambda* (#:key outputs #:allow-other-keys)
205 (let ((out (assoc-ref outputs "out")))
206 (mkdir-p (string-append out "/bin"))
207 (mkdir-p (string-append out
209 (mkdir-p (string-append out
214 (setenv "HOME" (getcwd))
216 (string-append (getcwd) ":"
218 (invoke "make" "test"))))
220 #:make-flags (list (string-append "PREFIX="
221 (assoc-ref %outputs "out")))))
222 (inputs `(("perl" ,perl)))
223 (home-page "http://www.dwheeler.com/sloccount/")
224 (synopsis "Count physical source lines of code (SLOC)")
226 "SLOCCount is a set of the programs for counting source lines of
227 code (SLOC) in large software systems. It can automatically identify and
228 measure a wide range of programming languages. It automatically estimates the
229 effort, time, and money it would take to develop the software, using the
230 COCOMO model or user-provided parameters.")
231 (license license:gpl2+)))
241 (url "https://github.com/AlDanial/cloc")
243 (file-name (git-file-name name version))
245 (base32 "082gj2b3x11bilz8c572dd60vn6n0fhld5zhi7wk7g1wy9wlgm9w"))))
246 (build-system gnu-build-system)
248 `(("coreutils" ,coreutils)
250 ("perl-algorithm-diff" ,perl-algorithm-diff)
251 ("perl-digest-md5" ,perl-digest-md5)
252 ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
253 ("perl-regexp-common" ,perl-regexp-common)))
255 `(#:phases (modify-phases %standard-phases
256 (delete 'configure) ; nothing to configure
257 (delete 'build) ; nothing to build
259 (lambda* (#:key inputs outputs #:allow-other-keys)
260 (let* ((out (assoc-ref outputs "out")))
261 (invoke "make" "-C" "Unix"
262 (string-append "prefix=" out)
263 (string-append "INSTALL="
264 (assoc-ref inputs "coreutils")
268 (add-after 'install 'wrap-program
269 (lambda* (#:key inputs outputs #:allow-other-keys)
270 (let ((out (assoc-ref outputs "out")))
271 (wrap-program (string-append out "/bin/cloc")
273 ,(string-split (getenv "PERL5LIB") #\:)))
276 ;; Tests require some other packages.
278 (home-page "https://github.com/AlDanial/cloc")
279 (synopsis "Count source lines of code (SLOC) and other source code metrics")
280 (description "cloc counts blank lines, comment lines, and physical lines
281 of source code in many programming languages. Given two versions of a code
282 base, cloc can compute differences in blank, comment, and source lines.
284 cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
285 cloc can handle a greater variety of programming languages.")
286 (license license:gpl2+)))
288 (define-public the-silver-searcher
290 (name "the-silver-searcher")
295 "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
299 "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
300 (build-system gnu-build-system)
302 `(("pkg-config" ,pkg-config)))
307 (home-page "https://geoff.greer.fm/ag/")
308 (synopsis "Fast code searching tool")
310 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
311 numbers of files. It's intended primarily for source code repositories, and
312 respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
313 of magnitude faster than its inspiration, @command{ack}, and less specialised
314 tools such as @command{grep}.")
315 (license license:asl2.0)))
323 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
327 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
328 (build-system gnu-build-system)
329 (home-page "https://daniel.haxx.se/projects/trio/")
330 (synopsis "Portable and extendable printf and string functions")
332 "Trio is a set of @code{printf} and string functions designed be used by
333 applications with a focus on portability or with the need for additional
334 features that are not supported by the standard @code{stdio} implementation.")
335 ;; This license is very similar to the ISC license, but the wording is
336 ;; slightly different.
337 (license (license:non-copyleft
338 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
340 (define-public universal-ctags
341 ;; The project is unable to decide whether to use 1.0 or 6.0 as the
342 ;; first public release version (it started as a fork of another ctags
343 ;; project that was on version 5.8), and five years later have been
344 ;; unable to tag a release. Thus, we just take the master branch.
345 (let ((commit "0c78c0c4a68030df0d025c90bad291108b5e7107")
348 (name "universal-ctags")
349 (version (git-version "0.0.0" revision commit))
354 (url "https://github.com/universal-ctags/ctags")
356 (file-name (git-file-name name version))
359 "0lnxc3kwi6srw0015m16vyjfdc7pdr9d1qzxjsbfv3c69ag87jhc"))
360 (modules '((guix build utils)))
363 ;; Remove the bundled PackCC and associated build rules.
364 (substitute* "Makefile.am"
365 (("\\$\\(packcc_verbose\\)\\$\\(PACKCC\\)")
367 (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): packcc\\$\\(EXEEXT\\)")
368 "$(PEG_SRCS) $(PEG_HEADS):")
369 (("noinst_PROGRAMS \\+= packcc")
371 (delete-file-recursively "misc/packcc")
373 (build-system gnu-build-system)
375 '(#:phases (modify-phases %standard-phases
376 (add-after 'unpack 'make-files-writable
378 (for-each make-file-writable (find-files "."))
380 (add-before 'bootstrap 'patch-optlib2c
382 ;; The autogen.sh script calls out to optlib2c to
383 ;; generate translations, so we can not wait for the
384 ;; patch-source-shebangs phase.
385 (patch-shebang "misc/optlib2c")
387 (add-before 'check 'patch-tests
389 (substitute* "misc/units"
391 (string-append "SHELL=" (which "sh"))))
392 (substitute* "Tmain/utils.sh"
393 (("/bin/echo") (which "echo")))
396 `(("autoconf" ,autoconf)
397 ("automake" ,automake)
400 ("pkg-config" ,pkg-config)))
402 `(("jansson" ,jansson)
403 ("libseccomp" ,libseccomp)
405 ("libyaml" ,libyaml)))
406 (home-page "https://ctags.io/")
407 (synopsis "Generate tag files for source code")
409 "Universal Ctags generates an index (or tag) file of language objects
410 found in source files for many popular programming languages. This index
411 makes it easy for text editors and other tools to locate the indexed items.
412 Universal Ctags improves on traditional ctags because of its multilanguage
413 support, its ability for the user to define new languages searched by regular
414 expressions, and its ability to generate emacs-style TAGS files.")
415 (license license:gpl2+))))
417 (define-public withershins
425 (url "https://github.com/cameronwhite/withershins")
426 (commit (string-append "v" version))))
427 (file-name (git-file-name name version))
429 (base32 "1cviqvbbcwljm1zx12j6511hazr3kscwrvcyifrkfi4fpy5z985m"))))
430 (build-system cmake-build-system)
432 `(#:out-of-source? #f
434 ;; XXX A (justified!) misleading-indentation error breaks the build.
435 (list "-DENABLE_WERROR=OFF")
437 (modify-phases %standard-phases
439 'unpack 'find-libiberty
441 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
442 (substitute* "cmake/FindIberty.cmake"
443 (("/usr/include") (string-append libiberty "/include"))
444 (("libiberty.a iberty")
445 (string-append "NAMES libiberty.a iberty\nPATHS \""
446 libiberty "/lib" "\"")))
450 (lambda* (#:key outputs #:allow-other-keys)
451 (let* ((out (assoc-ref outputs "out"))
452 (include (string-append out "/include"))
453 (lib (string-append out "/lib")))
455 (install-file "src/withershins.hpp" include)
457 (install-file "src/libwithershins.a" lib))
459 (home-page "https://github.com/cameronwhite/withershins")
461 `(("libiberty" ,libiberty)
462 ("binutils" ,binutils) ;for libbfd
464 (synopsis "C++11 library for generating stack traces")
466 "Withershins is a simple cross-platform C++11 library for generating
468 ;; Sources are released under Expat license, but since BFD is licensed
469 ;; under the GPLv3+ the combined work is GPLv3+ as well.
470 (license license:gpl3+)))
473 ;; Use a recent commit from upstream since the latest official release
474 ;; (1.14) doesn't support GCC 9 (see:
475 ;; https://github.com/linux-test-project/lcov/issues/58).
476 (let* ((commit "40580cd65909bc8324ae09b36bca2e178652ff3f")
478 (version (git-version "1.14" revision commit)))
485 (url "https://github.com/linux-test-project/lcov")
487 (file-name (git-file-name name version))
490 "0shgmh6fzhnj1qfdl90jgjmlbb1ih1qh879dca8hc58yggy3hqgb"))))
491 (build-system gnu-build-system)
493 '(#:test-target "test"
494 #:make-flags (list (string-append "PREFIX="
495 (assoc-ref %outputs "out")))
497 (modify-phases %standard-phases
498 (add-after 'unpack 'patch-pwd
499 ;; Lift the requirement of having a shell in PATH.
501 (substitute* "bin/geninfo"
503 "qw/abs_path getcwd/"))
504 (substitute* '("bin/lcov" "bin/geninfo")
508 (delete 'configure) ;no configure script
509 (add-after 'install 'wrap
510 (lambda* (#:key outputs #:allow-other-keys)
511 (let ((out (assoc-ref outputs "out")))
512 (wrap-program (string-append out "/bin/geninfo")
513 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))
515 (inputs `(("perl" ,perl)
516 ("perl-json" ,perl-json)
517 ("perl-perlio-gzip" ,perl-perlio-gzip)))
518 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
519 (synopsis "Code coverage tool that enhances GNU gcov")
520 (description "LCOV is an extension of @command{gcov}, a tool part of the
521 GNU@tie{}Binutils, which provides information about what parts of a program
522 are actually executed (i.e., \"covered\") while running a particular test
523 case. The extension consists of a set of Perl scripts which build on the
524 textual @command{gcov} output to implement the following enhanced
525 functionality such as HTML output.")
526 (license license:gpl2+))))
535 (url "https://github.com/SimonKagstrom/kcov")
537 (file-name (git-file-name name version))
540 "0zqg21xwivi16csl6a5wby6679ny01bjaw4am3y4qcgjdyihifp8"))))
541 (build-system cmake-build-system)
543 `(#:tests? #f ;no test target
545 (modify-phases %standard-phases
546 (add-after 'unpack 'fix-/bin/bash-references
548 (substitute* (find-files "src" ".*\\.cc?$")
549 (("/bin/bash") (which "bash"))
550 (("/bin/sh") (which "sh")))
554 ("elfutils" ,elfutils)
558 `(("python" ,python)))
559 (home-page "https://github.com/SimonKagstrom/kcov")
560 (synopsis "Code coverage tester for compiled languages, Python and Bash")
561 (description "Kcov is a FreeBSD/Linux/OSX code coverage tester for compiled
562 languages, Python and Bash. Kcov was originally a fork of Bcov, but has since
563 evolved to support a large feature set in addition to that of Bcov.
565 Kcov uses DWARF debugging information for compiled programs to make it
566 possible to collect coverage information without special compiler switches.")
567 (license license:gpl2+)))
577 (url "https://github.com/Andersbakken/rtags")
578 (commit (string-append "v" version))))
579 (file-name (git-file-name name version))
580 (patches (search-patches "rtags-separate-rct.patch"))
581 (modules '((guix build utils)))
583 ;; Part of spliting rct with rtags.
584 ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
585 '(with-directory-excursion "src"
586 (delete-file-recursively "rct") ;remove bundled copy
587 (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
589 (("#include ?\"rct/(.*.h)\"" all header)
590 (string-append "#include <rct/" header ">")))
594 "0raqjbkl1ykga4ahgl9xw49cgh3cyqcf42z36z7d6fz1fw192kg0"))))
595 (build-system cmake-build-system)
597 '(#:build-type "RelWithDebInfo"
599 '("-DRTAGS_NO_ELISP_FILES=1"
600 "-DBUILD_TESTING=FALSE")
603 `(("pkg-config" ,pkg-config)))
605 `(("bash-completion" ,bash-completion)
611 (home-page "https://github.com/Andersbakken/rtags")
612 (synopsis "Indexer for the C language family with Emacs integration")
614 "RTags is a client/server application that indexes C/C++ code and keeps a
615 persistent file-based database of references, declarations, definitions,
616 symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
617 to find symbols by name (including nested class and namespace scope). Most
618 importantly we give you proper follow-symbol and find-references support.")
619 (license license:gpl3+)))
621 (define-public colormake
624 (version "0.9.20140503")
629 (url "https://github.com/pagekite/Colormake")
631 (file-name (git-file-name name version))
633 (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
634 (build-system trivial-build-system)
639 `(#:modules ((guix build utils))
642 (use-modules (guix build utils))
643 (copy-recursively (assoc-ref %build-inputs "source") "source")
645 (patch-shebang "colormake.pl"
646 (list (string-append (assoc-ref %build-inputs "perl")
648 (let* ((out (assoc-ref %outputs "out"))
649 (bin (string-append out "/bin"))
650 (doc (string-append out "/share/doc"))
651 (install-files (lambda (files directory)
652 (for-each (lambda (file)
653 (install-file file directory))
655 (substitute* "colormake"
656 (("colormake\\.pl") (string-append bin "/colormake.pl"))
658 (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
659 (install-file "colormake.1" (string-append doc "/man/man1"))
660 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
661 (install-files '("colormake" "colormake-short" "clmake"
662 "clmake-short" "colormake.pl")
665 (home-page "https://bre.klaki.net/programs/colormake/")
666 (synopsis "Wrapper around @command{make} to produce colored output")
667 (description "This package provides a wrapper around @command{make} to
668 produce colored output.")
669 (license license:gpl2+)))
671 (define-public makefile2graph
673 (name "makefile2graph")
679 (url "https://github.com/lindenb/makefile2graph")
680 (commit (string-append "v" version))))
681 (file-name (git-file-name name version))
683 (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
684 (build-system gnu-build-system)
686 '(#:test-target "test"
687 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
689 (modify-phases %standard-phases
690 (delete 'configure))))
692 `(("graphviz" ,graphviz)))
693 (home-page "https://github.com/lindenb/makefile2graph")
694 (synopsis "Creates a graph of dependencies from GNU Make")
696 "@code{make2graph} creates a graph of dependencies from GNU Make. The
697 output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
698 independent targets.")
699 (license license:expat)))
701 (define-public uncrustify
708 (url "https://github.com/uncrustify/uncrustify/")
709 (commit (string-append name "-" version))))
710 (file-name (git-file-name name version))
713 "0sqrg13kp8fwymq40976bq380bzw40g4ss7ihlbq45d0f90ifa1k"))))
714 (build-system cmake-build-system)
717 ("python" ,python-wrapper)))
720 (modify-phases %standard-phases
721 (add-after 'unpack 'unpack-etc
722 (lambda* (#:key inputs outputs #:allow-other-keys)
723 ;; Configuration samples are not installed by default.
724 (let* ((output (assoc-ref outputs "out"))
725 (etcdir (string-append output "/etc")))
726 (for-each (lambda (l)
727 (install-file l etcdir))
728 (find-files "etc" "\\.cfg$")))
730 (home-page "http://uncrustify.sourceforge.net/")
731 (synopsis "Code formatter for C and other related languages")
733 "Beautify source code in many languages of the C family (C, C++, C#,
734 Objective@tie{}C, D, Java, Pawn, and Vala). Features:
736 @item Indent and align code.
737 @item Reformat comments (a little bit).
738 @item Fix inter-character spacing.
739 @item Add or remove parens / braces.
740 @item Supports embedded SQL @code{EXEC SQL} stuff.
741 @item Highly configurable - More than 600 configurable options.
743 (license license:gpl2+)))
745 (define-public astyle
752 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
753 version "/astyle_" version "_linux.tar.gz"))
756 "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"))))
757 (build-system gnu-build-system)
759 `(#:tests? #f ;no tests
760 #:make-flags (list (string-append "prefix=" %output)
763 #:modules ((guix build gnu-build-system) ;; FIXME use %default-modules
767 (modify-phases %standard-phases
769 (lambda _ (chdir "build/gcc") #t))
770 (add-after 'install 'install-libs
771 (lambda* (#:key outputs #:allow-other-keys)
772 ;; Libraries and includes are not installed by default
773 (let* ((output (assoc-ref outputs "out"))
774 (incdir (string-append output "/include"))
775 (libdir (string-append output "/lib")))
776 (define (make-so-link sofile strip-pattern)
779 (regexp-substitute #f
780 (string-match strip-pattern sofile)
783 (copy-file "../../src/astyle.h"
784 (string-append incdir "/astyle.h"))
786 (for-each (lambda (l)
788 l (string-append libdir "/" (basename l))))
789 (find-files "bin" "lib*"))
792 (make-so-link sofile "(\\.[0-9]){3}$") ;; link .so
793 (make-so-link sofile "(\\.[0-9]){2}$")) ;; link .so.3
794 (find-files libdir "lib.*\\.so\\..*")))
796 (home-page "http://astyle.sourceforge.net/")
797 (synopsis "Source code indenter, formatter, and beautifier")
799 "Artistic Style is a source code indenter, formatter, and beautifier for
800 the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
801 (license license:lgpl3+)))
803 (define-public indent
809 (uri (string-append "mirror://gnu/indent/indent-" version
812 (base32 "12xvcd16cwilzglv9h7sgh4h1qqjd1h8s48ji2dla58m4706hzg7"))))
813 (build-system gnu-build-system)
816 (modify-phases %standard-phases
817 (add-after 'unpack 'fix-docdir
819 ;; Although indent uses a modern autoconf in which docdir
820 ;; defaults to PREFIX/share/doc, the doc/Makefile.am
821 ;; overrides this to be in PREFIX/doc. Fix this.
822 (substitute* "doc/Makefile.in"
823 (("^docdir = .*$") "docdir = @docdir@\n"))
825 (add-after 'unpack 'fix-configure
826 (lambda* (#:key inputs native-inputs #:allow-other-keys)
827 ;; Replace outdated config.sub and config.guess:
828 (with-directory-excursion "config"
829 (for-each (lambda (file)
831 (string-append (assoc-ref
832 (or native-inputs inputs) "automake")
834 ,(version-major+minor
835 (package-version automake))
837 '("config.sub" "config.guess")))
840 `(("texinfo" ,texinfo)
841 ("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
842 (synopsis "Code reformatter")
844 "Indent is a program that makes source code easier to read by
845 reformatting it in a consistent style. It can change the style to one of
846 several different styles such as GNU, BSD or K&R. It has some flexibility to
847 deal with incomplete or malformed syntax. GNU indent offers several
848 extensions over the standard utility.")
849 (license license:gpl3+)
850 (home-page "https://www.gnu.org/software/indent/")))
852 (define-public amalgamate
853 (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
855 (version (git-version "1.1.1" revision commit)))
859 (home-page "https://github.com/edlund/amalgamate")
868 "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
869 (file-name (git-file-name name version))
870 (modules '((guix build utils)))
872 '(substitute* "test.sh"
873 (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
874 "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
875 (build-system gnu-build-system)
877 `(("python" ,python-wrapper)))
880 (modify-phases %standard-phases
884 (lambda* (#:key outputs #:allow-other-keys)
885 (let* ((out (assoc-ref outputs "out"))
886 (bin (string-append out "/bin")))
887 (install-file "amalgamate.py" bin))))
890 (invoke "./test.sh"))))))
891 (synopsis "Tool for amalgamating C source and header files")
892 ;; The package is indeed a script file, and the term "amalgamate.py" is
894 (description "amalgamate.py aims to make it easy to use SQLite-style C
895 source and header amalgamation in projects.")
896 (license license:bsd-3))))