code.scm 29 KB

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