1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2018, 2020, 2021 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 python)
43 #:use-module (guix build-system trivial)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages autogen)
46 #:use-module (gnu packages autotools)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages bash)
49 #:use-module (gnu packages c)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages cpp)
52 #:use-module (gnu packages curl)
53 #:use-module (gnu packages elf)
54 #:use-module (gnu packages emacs)
55 #:use-module (gnu packages gcc)
56 #:use-module (gnu packages graphviz)
57 #:use-module (gnu packages llvm)
58 #:use-module (gnu packages linux)
59 #:use-module (gnu packages lua)
60 #:use-module (gnu packages ncurses)
61 #:use-module (gnu packages pcre)
62 #:use-module (gnu packages perl)
63 #:use-module (gnu packages perl-compression)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages sqlite)
67 #:use-module (gnu packages texinfo)
68 #:use-module (gnu packages web)
69 #:use-module (gnu packages xml))
71 ;;; Tools to deal with source code: metrics, cross-references, etc.
79 (uri (string-append "mirror://gnu/cflow/cflow-"
83 "1mzd3yf0dfv8h2av5vsxxlhpk21nw064h91b2kgfrdz92r0pnj1l"))))
84 (build-system gnu-build-system)
86 ;; Needed to have cflow-mode.el installed.
87 (native-inputs `(("emacs" ,emacs-minimal)))
89 '(#:configure-flags (list (string-append "CPPFLAGS="
90 "-D" "CFLOW_PREPROC=\\\""
91 (assoc-ref %build-inputs "gcc")
93 (home-page "https://www.gnu.org/software/cflow/")
94 (synopsis "Create a graph of control flow within a program")
96 "GNU cflow analyzes C source files and produces a graph charting the
97 control flow of the program. It can output the graph in several styles and
98 in either the POSIX format or in an extended GNU format. cflow also includes
99 a major mode for Emacs for examining the flowcharts that it produces.")
100 (license license:gpl3+)))
102 (define-public complexity
108 (uri (string-append "mirror://gnu/complexity/complexity-"
112 "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
113 (build-system gnu-build-system)
115 `(("texinfo" ,texinfo)
116 ("autogen" ,autogen)))
117 (home-page "https://www.gnu.org/software/complexity/")
118 (synopsis "Analyze complexity of C functions")
120 "GNU complexity provides tools for finding procedures that are
121 convoluted, overly long or otherwise difficult to understand. This
122 may help in learning or reviewing unfamiliar code or perhaps
123 highlighting your own code that seemed comprehensible when you wrote it.")
124 (license license:gpl3+)))
126 (define-public global ; a global variable
132 (uri (string-append "mirror://gnu/global/global-"
136 "10vvsgx8v54whb4j9mk5qqyb5h3rdd9da0il3wir8pcpksyk0dww"))))
137 (build-system gnu-build-system)
138 (inputs `(("ncurses" ,ncurses)
141 ("python-wrapper" ,python-wrapper)))
144 (list (string-append "--with-ncurses="
145 (assoc-ref %build-inputs "ncurses"))
146 (string-append "--with-sqlite3="
147 (assoc-ref %build-inputs "sqlite"))
151 (modify-phases %standard-phases
152 (add-after 'install 'post-install
153 (lambda* (#:key outputs #:allow-other-keys)
154 ;; Install the plugin files in the right place.
155 (let* ((out (assoc-ref outputs "out"))
156 (data (string-append out "/share/gtags"))
157 (vim (string-append out "/share/vim/vimfiles/plugin"))
158 (lisp (string-append out "/share/emacs/site-lisp")))
161 (rename-file (string-append data "/gtags.el")
162 (string-append lisp "/gtags.el"))
163 (rename-file (string-append data "/gtags.vim")
164 (string-append vim "/gtags.vim"))
165 (rename-file (string-append data "/gtags-cscope.vim")
166 (string-append vim "/gtags-cscope.vim"))
168 (home-page "https://www.gnu.org/software/global/")
169 (synopsis "Cross-environment source code tag system")
171 "GNU GLOBAL is a source code tagging system that functions in the same
172 way across a wide array of environments, such as different text editors,
173 shells and web browsers. The resulting tags are useful for quickly moving
174 around in a large, deeply nested project.")
175 (license license:gpl3+)))
177 (define-public sloccount
183 (uri (string-append "https://dwheeler.com/sloccount/sloccount-"
187 "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
188 (build-system gnu-build-system)
190 '(#:phases (modify-phases %standard-phases
192 (add-before 'build 'make-dotl-files-older
194 ;; Make the '.l' files as old as the '.c'
195 ;; files to avoid triggering the rule that
200 (for-each (lambda (file)
201 (set-file-time file ref))
202 (find-files "." "\\.[chl]$"))
204 (add-before 'install 'make-target-directories
205 (lambda* (#:key outputs #:allow-other-keys)
206 (let ((out (assoc-ref outputs "out")))
207 (mkdir-p (string-append out "/bin"))
208 (mkdir-p (string-append out
210 (mkdir-p (string-append out
215 (setenv "HOME" (getcwd))
217 (string-append (getcwd) ":"
219 (invoke "make" "test"))))
221 #:make-flags (list (string-append "PREFIX="
222 (assoc-ref %outputs "out")))))
223 (inputs `(("perl" ,perl)))
224 (home-page "https://dwheeler.com/sloccount/")
225 (synopsis "Count physical source lines of code (SLOC)")
227 "SLOCCount is a set of the programs for counting source lines of
228 code (SLOC) in large software systems. It can automatically identify and
229 measure a wide range of programming languages. It automatically estimates the
230 effort, time, and money it would take to develop the software, using the
231 COCOMO model or user-provided parameters.")
232 (license license:gpl2+)))
242 (url "https://github.com/AlDanial/cloc")
244 (file-name (git-file-name name version))
246 (base32 "1ixgswzbzv63bl50gb2kgaqr0jcicjz6w610hi9fal1i7744zraw"))))
247 (build-system gnu-build-system)
249 `(("coreutils" ,coreutils)
251 ("perl-algorithm-diff" ,perl-algorithm-diff)
252 ("perl-digest-md5" ,perl-digest-md5)
253 ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
254 ("perl-regexp-common" ,perl-regexp-common)))
256 `(#:phases (modify-phases %standard-phases
257 (delete 'configure) ; nothing to configure
258 (delete 'build) ; nothing to build
260 (lambda* (#:key inputs outputs #:allow-other-keys)
261 (let* ((out (assoc-ref outputs "out")))
262 (invoke "make" "-C" "Unix"
263 (string-append "prefix=" out)
264 (string-append "INSTALL="
265 (assoc-ref inputs "coreutils")
269 (add-after 'install 'wrap-program
270 (lambda* (#:key inputs outputs #:allow-other-keys)
271 (let ((out (assoc-ref outputs "out")))
272 (wrap-program (string-append out "/bin/cloc")
274 ,(string-split (getenv "PERL5LIB") #\:)))
277 ;; Tests require some other packages.
279 (home-page "https://github.com/AlDanial/cloc")
280 (synopsis "Count source lines of code (SLOC) and other source code metrics")
281 (description "cloc counts blank lines, comment lines, and physical lines
282 of source code in many programming languages. Given two versions of a code
283 base, cloc can compute differences in blank, comment, and source lines.
285 cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
286 cloc can handle a greater variety of programming languages.")
287 (license license:gpl2+)))
289 (define-public the-silver-searcher
291 (name "the-silver-searcher")
296 "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
300 "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
301 (build-system gnu-build-system)
303 `(("pkg-config" ,pkg-config)))
308 (home-page "https://geoff.greer.fm/ag/")
309 (synopsis "Fast code searching tool")
311 "The Silver Searcher (@command{ag}) is a tool for quickly searching large
312 numbers of files. It's intended primarily for source code repositories, and
313 respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
314 of magnitude faster than its inspiration, @command{ack}, and less specialised
315 tools such as @command{grep}.")
316 (license license:asl2.0)))
324 (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
328 "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
329 (build-system gnu-build-system)
330 (home-page "https://daniel.haxx.se/projects/trio/")
331 (synopsis "Portable and extendable printf and string functions")
333 "Trio is a set of @code{printf} and string functions designed be used by
334 applications with a focus on portability or with the need for additional
335 features that are not supported by the standard @code{stdio} implementation.")
336 ;; This license is very similar to the ISC license, but the wording is
337 ;; slightly different.
338 (license (license:non-copyleft
339 "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
341 (define-public universal-ctags
343 (name "universal-ctags")
344 (version "5.9.20201018.0")
349 (url "https://github.com/universal-ctags/ctags")
350 (commit (string-append "p" version))))
351 (file-name (git-file-name name version))
354 "174p1w20pl25k996hfw61inw4mqhskmmic1lyw2m65firmkyvs7x"))
355 (modules '((guix build utils)))
358 ;; Remove the bundled PackCC and associated build rules.
359 (substitute* "Makefile.am"
360 (("\\$\\(packcc_verbose\\)\\$\\(PACKCC\\)")
362 (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): packcc\\$\\(EXEEXT\\)")
363 "$(PEG_SRCS) $(PEG_HEADS):")
364 (("noinst_PROGRAMS \\+= packcc")
366 (delete-file-recursively "misc/packcc")
368 (build-system gnu-build-system)
370 '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime.
371 #:configure-flags '("--enable-tmpdir=/tmp")
372 #:phases (modify-phases %standard-phases
373 (add-after 'unpack 'make-files-writable
375 (for-each make-file-writable (find-files "."))
377 (add-before 'bootstrap 'patch-optlib2c
379 ;; The autogen.sh script calls out to optlib2c to
380 ;; generate translations, so we can not wait for the
381 ;; patch-source-shebangs phase.
382 (patch-shebang "misc/optlib2c")
384 (add-before 'check 'patch-tests
386 (substitute* "misc/units"
388 (string-append "SHELL=" (which "sh"))))
389 (substitute* "Tmain/utils.sh"
390 (("/bin/echo") (which "echo")))
393 `(("autoconf" ,autoconf)
394 ("automake" ,automake)
395 ;; XXX: Use ctags' own packcc fork even though we meticolously unbundle
396 ;; it above. Mainly for historical reasons, and perhaps their changes
397 ;; get upstreamed in the future.
399 ,(let ((commit "03402b79505dc0024f90d5bebfd7e5d3fb62da9a"))
405 (url "https://github.com/universal-ctags/packcc")
407 (file-name (git-file-name "packcc-for-ctags"
408 (string-take commit 7)))
411 "0vxpdk9l2lf7f32nx1p3b3xmw2kw2wp95vnf9bc4lyqrg69pblm0")))))))
413 ("pkg-config" ,pkg-config)))
415 `(("jansson" ,jansson)
416 ("libseccomp" ,libseccomp)
418 ("libyaml" ,libyaml)))
419 (home-page "https://ctags.io/")
420 (synopsis "Generate tag files for source code")
422 "Universal Ctags generates an index (or tag) file of language objects
423 found in source files for many popular programming languages. This index
424 makes it easy for text editors and other tools to locate the indexed items.
425 Universal Ctags improves on traditional ctags because of its multilanguage
426 support, its ability for the user to define new languages searched by regular
427 expressions, and its ability to generate emacs-style TAGS files.")
428 (license license:gpl2+)))
430 (define-public withershins
438 (url "https://github.com/cameronwhite/withershins")
439 (commit (string-append "v" version))))
440 (file-name (git-file-name name version))
442 (base32 "1cviqvbbcwljm1zx12j6511hazr3kscwrvcyifrkfi4fpy5z985m"))))
443 (build-system cmake-build-system)
445 `(#:out-of-source? #f
447 ;; XXX A (justified!) misleading-indentation error breaks the build.
448 (list "-DENABLE_WERROR=OFF")
450 (modify-phases %standard-phases
452 'unpack 'find-libiberty
454 (let ((libiberty (assoc-ref %build-inputs "libiberty")))
455 (substitute* "cmake/FindIberty.cmake"
456 (("/usr/include") (string-append libiberty "/include"))
457 (("libiberty.a iberty")
458 (string-append "NAMES libiberty.a iberty\nPATHS \""
459 libiberty "/lib" "\"")))
463 (lambda* (#:key outputs #:allow-other-keys)
464 (let* ((out (assoc-ref outputs "out"))
465 (include (string-append out "/include"))
466 (lib (string-append out "/lib")))
468 (install-file "src/withershins.hpp" include)
470 (install-file "src/libwithershins.a" lib))
472 (home-page "https://github.com/cameronwhite/withershins")
474 `(("libiberty" ,libiberty)
475 ("binutils" ,binutils) ;for libbfd
477 (synopsis "C++11 library for generating stack traces")
479 "Withershins is a simple cross-platform C++11 library for generating
481 ;; Sources are released under Expat license, but since BFD is licensed
482 ;; under the GPLv3+ the combined work is GPLv3+ as well.
483 (license license:gpl3+)))
492 (uri (string-append "https://github.com/linux-test-project/lcov"
493 "/releases/download/v" version
494 "/lcov-" version ".tar.gz"))
496 (base32 "0fh5z0q5wg2jxr2nn5w7321y0zg9rwk75j3k5hnamjdy6gxa5kf1"))))
497 (build-system gnu-build-system)
499 '(#:test-target "test"
500 #:make-flags (list (string-append "PREFIX="
501 (assoc-ref %outputs "out")))
503 (modify-phases %standard-phases
504 (add-after 'unpack 'patch-pwd
505 ;; Lift the requirement of having a shell in PATH.
507 (substitute* "bin/geninfo"
509 "qw/abs_path getcwd/"))
510 (substitute* '("bin/lcov" "bin/geninfo")
514 (delete 'configure) ;no configure script
515 (add-after 'install 'wrap
516 (lambda* (#:key outputs #:allow-other-keys)
517 (let ((out (assoc-ref outputs "out")))
518 (wrap-program (string-append out "/bin/geninfo")
519 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))
521 (inputs `(("perl" ,perl)
522 ("perl-io-compress" ,perl-io-compress)
523 ("perl-json" ,perl-json)))
524 (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
525 (synopsis "Code coverage tool that enhances GNU gcov")
526 (description "LCOV is an extension of @command{gcov}, a tool part of the
527 GNU@tie{}Binutils, which provides information about what parts of a program
528 are actually executed (i.e., \"covered\") while running a particular test
529 case. The extension consists of a set of Perl scripts which build on the
530 textual @command{gcov} output to implement the following enhanced
531 functionality such as HTML output.")
532 (license license:gpl2+)))
534 (define-public lcov-cobertura
536 (name "python-lcov-cobertura")
541 (uri (pypi-uri "lcov_cobertura" version))
544 "02ar6yjazlxq4p64cz9gag08bvakmzjrp147jara9wlnlbc96j8g"))))
545 (build-system python-build-system)
546 (home-page "https://eriwen.github.io/lcov-to-cobertura-xml/")
547 (synopsis "LCOV to Cobertura XML converter")
549 "The lcov-to-cobertura Python module converts code coverage report files
550 in the lcov format to the XML format of
551 @uref{http://cobertura.github.io/cobertura/, Cobertura}, a Java code coverage
552 tool. It allows continuous integration servers like Jenkins to aggregate
553 results and determine build stability.")
554 (license license:asl2.0)))
563 (url "https://github.com/SimonKagstrom/kcov")
565 (file-name (git-file-name name version))
568 "0zqg21xwivi16csl6a5wby6679ny01bjaw4am3y4qcgjdyihifp8"))))
569 (build-system cmake-build-system)
571 `(#:tests? #f ;no test target
573 (modify-phases %standard-phases
574 (add-after 'unpack 'fix-/bin/bash-references
576 (substitute* (find-files "src" ".*\\.cc?$")
577 (("/bin/bash") (which "bash"))
578 (("/bin/sh") (which "sh")))
582 ("elfutils" ,elfutils)
586 `(("python" ,python)))
587 (home-page "https://github.com/SimonKagstrom/kcov")
588 (synopsis "Code coverage tester for compiled languages, Python and Bash")
589 (description "Kcov is a FreeBSD/Linux/OSX code coverage tester for compiled
590 languages, Python and Bash. Kcov was originally a fork of Bcov, but has since
591 evolved to support a large feature set in addition to that of Bcov.
593 Kcov uses DWARF debugging information for compiled programs to make it
594 possible to collect coverage information without special compiler switches.")
595 (license license:gpl2+)))
605 (url "https://github.com/Andersbakken/rtags")
606 (commit (string-append "v" version))))
607 (file-name (git-file-name name version))
608 (patches (search-patches "rtags-separate-rct.patch"))
609 (modules '((guix build utils)))
611 ;; Part of spliting rct with rtags.
612 ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
613 '(with-directory-excursion "src"
614 (delete-file-recursively "rct") ;remove bundled copy
615 (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
617 (("#include ?\"rct/(.*.h)\"" all header)
618 (string-append "#include <rct/" header ">")))
622 "0raqjbkl1ykga4ahgl9xw49cgh3cyqcf42z36z7d6fz1fw192kg0"))))
623 (build-system cmake-build-system)
625 '(#:build-type "RelWithDebInfo"
627 '("-DRTAGS_NO_ELISP_FILES=1"
628 "-DBUILD_TESTING=FALSE")
631 `(("pkg-config" ,pkg-config)))
633 `(("bash-completion" ,bash-completion)
639 (home-page "https://github.com/Andersbakken/rtags")
640 (synopsis "Indexer for the C language family with Emacs integration")
642 "RTags is a client/server application that indexes C/C++ code and keeps a
643 persistent file-based database of references, declarations, definitions,
644 symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
645 to find symbols by name (including nested class and namespace scope). Most
646 importantly we give you proper follow-symbol and find-references support.")
647 (license license:gpl3+)))
649 (define-public colormake
652 (version "0.9.20140503")
657 (url "https://github.com/pagekite/Colormake")
659 (file-name (git-file-name name version))
661 (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
662 (build-system trivial-build-system)
667 `(#:modules ((guix build utils))
670 (use-modules (guix build utils))
671 (copy-recursively (assoc-ref %build-inputs "source") "source")
673 (patch-shebang "colormake.pl"
674 (list (string-append (assoc-ref %build-inputs "perl")
676 (let* ((out (assoc-ref %outputs "out"))
677 (bin (string-append out "/bin"))
678 (doc (string-append out "/share/doc"))
679 (install-files (lambda (files directory)
680 (for-each (lambda (file)
681 (install-file file directory))
683 (substitute* "colormake"
684 (("colormake\\.pl") (string-append bin "/colormake.pl"))
686 (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
687 (install-file "colormake.1" (string-append doc "/man/man1"))
688 (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
689 (install-files '("colormake" "colormake-short" "clmake"
690 "clmake-short" "colormake.pl")
693 (home-page "https://bre.klaki.net/programs/colormake/")
694 (synopsis "Wrapper around @command{make} to produce colored output")
695 (description "This package provides a wrapper around @command{make} to
696 produce colored output.")
697 (license license:gpl2+)))
699 (define-public makefile2graph
701 (name "makefile2graph")
707 (url "https://github.com/lindenb/makefile2graph")
708 (commit (string-append "v" version))))
709 (file-name (git-file-name name version))
711 (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
712 (build-system gnu-build-system)
714 '(#:test-target "test"
715 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
717 (modify-phases %standard-phases
718 (delete 'configure))))
720 `(("graphviz" ,graphviz)))
721 (home-page "https://github.com/lindenb/makefile2graph")
722 (synopsis "Creates a graph of dependencies from GNU Make")
724 "@code{make2graph} creates a graph of dependencies from GNU Make. The
725 output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
726 independent targets.")
727 (license license:expat)))
729 (define-public uncrustify
736 (url "https://github.com/uncrustify/uncrustify/")
737 (commit (string-append name "-" version))))
738 (file-name (git-file-name name version))
741 "0sqrg13kp8fwymq40976bq380bzw40g4ss7ihlbq45d0f90ifa1k"))))
742 (build-system cmake-build-system)
745 ("python" ,python-wrapper)))
748 (modify-phases %standard-phases
749 (add-after 'unpack 'unpack-etc
750 (lambda* (#:key inputs outputs #:allow-other-keys)
751 ;; Configuration samples are not installed by default.
752 (let* ((output (assoc-ref outputs "out"))
753 (etcdir (string-append output "/etc")))
754 (for-each (lambda (l)
755 (install-file l etcdir))
756 (find-files "etc" "\\.cfg$")))
758 (home-page "http://uncrustify.sourceforge.net/")
759 (synopsis "Code formatter for C and other related languages")
761 "Beautify source code in many languages of the C family (C, C++, C#,
762 Objective@tie{}C, D, Java, Pawn, and Vala). Features:
764 @item Indent and align code.
765 @item Reformat comments (a little bit).
766 @item Fix inter-character spacing.
767 @item Add or remove parens / braces.
768 @item Supports embedded SQL @code{EXEC SQL} stuff.
769 @item Highly configurable - More than 600 configurable options.
771 (license license:gpl2+)))
773 (define-public astyle
780 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
781 version "/astyle_" version "_linux.tar.gz"))
784 "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"))))
785 (build-system gnu-build-system)
787 `(#:tests? #f ;no tests
788 #:make-flags (list (string-append "prefix=" %output)
791 #:modules ((guix build gnu-build-system) ;; FIXME use %default-modules
795 (modify-phases %standard-phases
797 (lambda _ (chdir "build/gcc") #t))
798 (add-after 'install 'install-libs
799 (lambda* (#:key outputs #:allow-other-keys)
800 ;; Libraries and includes are not installed by default
801 (let* ((output (assoc-ref outputs "out"))
802 (incdir (string-append output "/include"))
803 (libdir (string-append output "/lib")))
804 (define (make-so-link sofile strip-pattern)
807 (regexp-substitute #f
808 (string-match strip-pattern sofile)
811 (copy-file "../../src/astyle.h"
812 (string-append incdir "/astyle.h"))
814 (for-each (lambda (l)
816 l (string-append libdir "/" (basename l))))
817 (find-files "bin" "lib*"))
820 (make-so-link sofile "(\\.[0-9]){3}$") ;; link .so
821 (make-so-link sofile "(\\.[0-9]){2}$")) ;; link .so.3
822 (find-files libdir "lib.*\\.so\\..*")))
824 (home-page "http://astyle.sourceforge.net/")
825 (synopsis "Source code indenter, formatter, and beautifier")
827 "Artistic Style is a source code indenter, formatter, and beautifier for
828 the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
829 (license license:lgpl3+)))
831 (define-public indent
837 (uri (string-append "mirror://gnu/indent/indent-" version
840 (base32 "12xvcd16cwilzglv9h7sgh4h1qqjd1h8s48ji2dla58m4706hzg7"))))
841 (build-system gnu-build-system)
844 (modify-phases %standard-phases
845 (add-after 'unpack 'fix-docdir
847 ;; Although indent uses a modern autoconf in which docdir
848 ;; defaults to PREFIX/share/doc, the doc/Makefile.am
849 ;; overrides this to be in PREFIX/doc. Fix this.
850 (substitute* "doc/Makefile.in"
851 (("^docdir = .*$") "docdir = @docdir@\n"))
853 (add-after 'unpack 'fix-configure
854 (lambda* (#:key inputs native-inputs #:allow-other-keys)
855 ;; Replace outdated config.sub and config.guess:
856 (with-directory-excursion "config"
857 (for-each (lambda (file)
859 (string-append (assoc-ref
860 (or native-inputs inputs) "automake")
862 ,(version-major+minor
863 (package-version automake))
865 '("config.sub" "config.guess")))
868 `(("texinfo" ,texinfo)
869 ("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
870 (synopsis "Code reformatter")
872 "Indent is a program that makes source code easier to read by
873 reformatting it in a consistent style. It can change the style to one of
874 several different styles such as GNU, BSD or K&R. It has some flexibility to
875 deal with incomplete or malformed syntax. GNU indent offers several
876 extensions over the standard utility.")
877 (license license:gpl3+)
878 (home-page "https://www.gnu.org/software/indent/")))
880 (define-public amalgamate
881 (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
883 (version (git-version "1.1.1" revision commit)))
887 (home-page "https://github.com/edlund/amalgamate")
896 "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
897 (file-name (git-file-name name version))
898 (modules '((guix build utils)))
900 '(substitute* "test.sh"
901 (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
902 "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
903 (build-system gnu-build-system)
905 `(("python" ,python-wrapper)))
908 (modify-phases %standard-phases
912 (lambda* (#:key outputs #:allow-other-keys)
913 (let* ((out (assoc-ref outputs "out"))
914 (bin (string-append out "/bin")))
915 (install-file "amalgamate.py" bin))))
918 (invoke "./test.sh"))))))
919 (synopsis "Tool for amalgamating C source and header files")
920 ;; The package is indeed a script file, and the term "amalgamate.py" is
922 (description "amalgamate.py aims to make it easy to use SQLite-style C
923 source and header amalgamation in projects.")
924 (license license:bsd-3))))