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