code.scm 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  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, 2021 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, 2021 Marius Bakke <marius@gnu.org>
  17. ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
  18. ;;; Copyright © 2021 lu hui <luhuins@163.com>
  19. ;;;
  20. ;;; This file is part of GNU Guix.
  21. ;;;
  22. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  23. ;;; under the terms of the GNU General Public License as published by
  24. ;;; the Free Software Foundation; either version 3 of the License, or (at
  25. ;;; your option) any later version.
  26. ;;;
  27. ;;; GNU Guix is distributed in the hope that it will be useful, but
  28. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  29. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. ;;; GNU General Public License for more details.
  31. ;;;
  32. ;;; You should have received a copy of the GNU General Public License
  33. ;;; 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 python-xyz)
  67. #:use-module (gnu packages serialization)
  68. #:use-module (gnu packages sqlite)
  69. #:use-module (gnu packages texinfo)
  70. #:use-module (gnu packages web)
  71. #:use-module (gnu packages xml))
  72. ;;; Tools to deal with source code: metrics, cross-references, etc.
  73. (define-public cflow
  74. (package
  75. (name "cflow")
  76. (version "1.6")
  77. (source (origin
  78. (method url-fetch)
  79. (uri (string-append "mirror://gnu/cflow/cflow-"
  80. version ".tar.bz2"))
  81. (sha256
  82. (base32
  83. "1mzd3yf0dfv8h2av5vsxxlhpk21nw064h91b2kgfrdz92r0pnj1l"))))
  84. (build-system gnu-build-system)
  85. ;; Needed to have cflow-mode.el installed.
  86. (native-inputs `(("emacs" ,emacs-minimal)))
  87. (arguments
  88. '(#:configure-flags (list (string-append "CPPFLAGS="
  89. "-D" "CFLOW_PREPROC=\\\""
  90. (assoc-ref %build-inputs "gcc")
  91. "/bin/cpp\\\""))))
  92. (home-page "https://www.gnu.org/software/cflow/")
  93. (synopsis "Create a graph of control flow within a program")
  94. (description
  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+)))
  100. (define-public complexity
  101. (package
  102. (name "complexity")
  103. (version "1.10")
  104. (source (origin
  105. (method url-fetch)
  106. (uri (string-append "mirror://gnu/complexity/complexity-"
  107. version ".tar.xz"))
  108. (sha256
  109. (base32
  110. "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
  111. (build-system gnu-build-system)
  112. (native-inputs
  113. `(("texinfo" ,texinfo)
  114. ("autogen" ,autogen)))
  115. (home-page "https://www.gnu.org/software/complexity/")
  116. (synopsis "Analyze complexity of C functions")
  117. (description
  118. "GNU complexity provides tools for finding procedures that are
  119. convoluted, overly long or otherwise difficult to understand. This
  120. may help in learning or reviewing unfamiliar code or perhaps
  121. highlighting your own code that seemed comprehensible when you wrote it.")
  122. (license license:gpl3+)))
  123. (define-public global ; a global variable
  124. (package
  125. (name "global")
  126. (version "6.6.7")
  127. (source (origin
  128. (method url-fetch)
  129. (uri (string-append "mirror://gnu/global/global-"
  130. version ".tar.gz"))
  131. (sha256
  132. (base32
  133. "0g4aslm2zajq605py11s4rs1wdnzcqhkh7bc2xl5az42adzzg839"))))
  134. (build-system gnu-build-system)
  135. (inputs
  136. `(("bash" ,bash-minimal) ; for wrap-program
  137. ("coreutils" ,coreutils)
  138. ("ctags" ,universal-ctags)
  139. ("libltdl" ,libltdl)
  140. ("ncurses" ,ncurses)
  141. ("python-pygments" ,python-pygments)
  142. ("python-wrapper" ,python-wrapper)
  143. ("sqlite" ,sqlite)))
  144. (arguments
  145. `(#:configure-flags
  146. (list (string-append "--with-ncurses="
  147. (assoc-ref %build-inputs "ncurses"))
  148. (string-append "--with-sqlite3="
  149. (assoc-ref %build-inputs "sqlite"))
  150. (string-append "--with-universal-ctags="
  151. (assoc-ref %build-inputs "ctags") "/bin/ctags")
  152. (string-append "--sysconfdir="
  153. (assoc-ref %outputs "out") "/share/gtags")
  154. "--localstatedir=/var" ; This needs to be a writable location.
  155. "--disable-static")
  156. #:phases
  157. (modify-phases %standard-phases
  158. (add-after 'unpack 'fix-globash
  159. (lambda* (#:key inputs #:allow-other-keys)
  160. (let* ((echo (string-append
  161. (assoc-ref inputs "coreutils") "/bin/echo")))
  162. (substitute* "globash/globash.in"
  163. (("/bin/echo") echo)))))
  164. (add-after 'post-install 'install-plugins
  165. (lambda _
  166. (with-directory-excursion "plugin-factory"
  167. (invoke "make" "install"))))
  168. (add-before 'install 'dont-install-to-/var
  169. (lambda _
  170. (substitute* "gozilla/Makefile"
  171. (("DESTDIR\\)\\$\\{localstatedir\\}") "TMPDIR)"))))
  172. (add-after 'install-plugins 'wrap-program
  173. (lambda* (#:key inputs outputs #:allow-other-keys)
  174. (wrap-program
  175. (string-append (assoc-ref outputs "out")
  176. "/share/gtags/script/pygments_parser.py")
  177. `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH"))))))
  178. (add-after 'install 'post-install
  179. (lambda* (#:key outputs #:allow-other-keys)
  180. ;; Install the plugin files in the right place.
  181. (let* ((out (assoc-ref outputs "out"))
  182. (data (string-append out "/share/gtags"))
  183. (vim (string-append out "/share/vim/vimfiles/plugin"))
  184. (lisp (string-append out "/share/emacs/site-lisp/"
  185. ,(package-name this-package) "-"
  186. ,(package-version this-package))))
  187. (mkdir-p lisp)
  188. (mkdir-p vim)
  189. (rename-file (string-append data "/gtags.el")
  190. (string-append lisp "/gtags.el"))
  191. (rename-file (string-append data "/gtags.vim")
  192. (string-append vim "/gtags.vim"))
  193. (rename-file (string-append data "/gtags-cscope.vim")
  194. (string-append vim "/gtags-cscope.vim"))
  195. #t))))))
  196. (home-page "https://www.gnu.org/software/global/")
  197. (synopsis "Cross-environment source code tag system")
  198. (description
  199. "GNU GLOBAL is a source code tagging system that functions in the same
  200. way across a wide array of environments, such as different text editors,
  201. shells and web browsers. The resulting tags are useful for quickly moving
  202. around in a large, deeply nested project.")
  203. (license license:gpl3+)))
  204. (define-public sloccount
  205. (package
  206. (name "sloccount")
  207. (version "2.26")
  208. (source (origin
  209. (method url-fetch)
  210. (uri (string-append "https://dwheeler.com/sloccount/sloccount-"
  211. version ".tar.gz"))
  212. (sha256
  213. (base32
  214. "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
  215. (build-system gnu-build-system)
  216. (arguments
  217. '(#:phases (modify-phases %standard-phases
  218. (delete 'configure)
  219. (add-before 'build 'make-dotl-files-older
  220. (lambda _
  221. ;; Make the '.l' files as old as the '.c'
  222. ;; files to avoid triggering the rule that
  223. ;; requires Flex.
  224. (define ref
  225. (stat "README"))
  226. (for-each (lambda (file)
  227. (set-file-time file ref))
  228. (find-files "." "\\.[chl]$"))
  229. #t))
  230. (add-before 'install 'make-target-directories
  231. (lambda* (#:key outputs #:allow-other-keys)
  232. (let ((out (assoc-ref outputs "out")))
  233. (mkdir-p (string-append out "/bin"))
  234. (mkdir-p (string-append out
  235. "/share/man/man1"))
  236. (mkdir-p (string-append out
  237. "/share/doc"))
  238. #t)))
  239. (replace 'check
  240. (lambda _
  241. (setenv "HOME" (getcwd))
  242. (setenv "PATH"
  243. (string-append (getcwd) ":"
  244. (getenv "PATH")))
  245. (invoke "make" "test"))))
  246. #:make-flags (list (string-append "PREFIX="
  247. (assoc-ref %outputs "out")))))
  248. (inputs `(("perl" ,perl)))
  249. (home-page "https://dwheeler.com/sloccount/")
  250. (synopsis "Count physical source lines of code (SLOC)")
  251. (description
  252. "SLOCCount is a set of the programs for counting source lines of
  253. code (SLOC) in large software systems. It can automatically identify and
  254. measure a wide range of programming languages. It automatically estimates the
  255. effort, time, and money it would take to develop the software, using the
  256. COCOMO model or user-provided parameters.")
  257. (license license:gpl2+)))
  258. (define-public cloc
  259. (package
  260. (name "cloc")
  261. (version "1.90")
  262. (source
  263. (origin
  264. (method git-fetch)
  265. (uri (git-reference
  266. (url "https://github.com/AlDanial/cloc")
  267. (commit (string-append "v" version))))
  268. (file-name (git-file-name name version))
  269. (sha256
  270. (base32 "0ic9q6qqw5f1wafp9lpmhr0miasbdb9zr59c0jlymnzffdmnliyc"))))
  271. (build-system gnu-build-system)
  272. (inputs
  273. `(("coreutils" ,coreutils)
  274. ("perl" ,perl)
  275. ("perl-algorithm-diff" ,perl-algorithm-diff)
  276. ("perl-digest-md5" ,perl-digest-md5)
  277. ("perl-parallel-forkmanager" ,perl-parallel-forkmanager)
  278. ("perl-regexp-common" ,perl-regexp-common)))
  279. (arguments
  280. `(#:phases (modify-phases %standard-phases
  281. (delete 'configure) ; nothing to configure
  282. (delete 'build) ; nothing to build
  283. (replace 'install
  284. (lambda* (#:key inputs outputs #:allow-other-keys)
  285. (let* ((out (assoc-ref outputs "out")))
  286. (invoke "make" "-C" "Unix"
  287. (string-append "prefix=" out)
  288. (string-append "INSTALL="
  289. (assoc-ref inputs "coreutils")
  290. "/bin/install")
  291. "install")
  292. #t)))
  293. (add-after 'install 'wrap-program
  294. (lambda* (#:key inputs outputs #:allow-other-keys)
  295. (let ((out (assoc-ref outputs "out")))
  296. (wrap-program (string-append out "/bin/cloc")
  297. `("PERL5LIB" ":" =
  298. ,(string-split (getenv "PERL5LIB") #\:)))
  299. #t))))
  300. #:out-of-source? #t
  301. ;; Tests require some other packages.
  302. #:tests? #f))
  303. (home-page "https://github.com/AlDanial/cloc")
  304. (synopsis "Count source lines of code (SLOC) and other source code metrics")
  305. (description "cloc counts blank lines, comment lines, and physical lines
  306. of source code in many programming languages. Given two versions of a code
  307. base, cloc can compute differences in blank, comment, and source lines.
  308. cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
  309. cloc can handle a greater variety of programming languages.")
  310. (license license:gpl2+)))
  311. (define-public the-silver-searcher
  312. (package
  313. (name "the-silver-searcher")
  314. (version "2.2.0")
  315. (source (origin
  316. (method url-fetch)
  317. (uri (string-append
  318. "https://geoff.greer.fm/ag/releases/the_silver_searcher-"
  319. version ".tar.gz"))
  320. (sha256
  321. (base32
  322. "0w1icjqd8hd45rn1y6nbfznk1a6ip54whwbfbhxp7ws2hn3ilqnr"))))
  323. (build-system gnu-build-system)
  324. (arguments
  325. ;; Required since GCC 10, see:
  326. ;; https://gcc.gnu.org/gcc-10/porting_to.html.
  327. `(#:configure-flags (list "CFLAGS=-fcommon")))
  328. (native-inputs
  329. `(("pkg-config" ,pkg-config)))
  330. (inputs
  331. `(("pcre" ,pcre)
  332. ("xz" ,xz)
  333. ("zlib" ,zlib)))
  334. (home-page "https://geoff.greer.fm/ag/")
  335. (synopsis "Fast code searching tool")
  336. (description
  337. "The Silver Searcher (@command{ag}) is a tool for quickly searching large
  338. numbers of files. It's intended primarily for source code repositories, and
  339. respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
  340. of magnitude faster than its inspiration, @command{ack}, and less specialised
  341. tools such as @command{grep}.")
  342. (license license:asl2.0)))
  343. (define-public trio
  344. (package
  345. (name "trio")
  346. (version "1.16")
  347. (source (origin
  348. (method url-fetch)
  349. (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
  350. version ".tar.gz"))
  351. (sha256
  352. (base32
  353. "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
  354. (build-system gnu-build-system)
  355. (home-page "https://daniel.haxx.se/projects/trio/")
  356. (synopsis "Portable and extendable printf and string functions")
  357. (description
  358. "Trio is a set of @code{printf} and string functions designed be used by
  359. applications with a focus on portability or with the need for additional
  360. features that are not supported by the standard @code{stdio} implementation.")
  361. ;; This license is very similar to the ISC license, but the wording is
  362. ;; slightly different.
  363. (license (license:non-copyleft
  364. "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
  365. (define-public universal-ctags
  366. (package
  367. (name "universal-ctags")
  368. (version "5.9.20210509.0")
  369. (source
  370. (origin
  371. (method git-fetch)
  372. (uri (git-reference
  373. (url "https://github.com/universal-ctags/ctags")
  374. (commit (string-append "p" version))))
  375. (file-name (git-file-name name version))
  376. (sha256
  377. (base32
  378. "1sq94bnbzr40zwihfnsna759bbak0lw27j0yn12iwpg4xgb4hhwp"))
  379. (modules '((guix build utils)))
  380. (snippet
  381. '(begin
  382. ;; Remove the bundled PackCC and associated build rules.
  383. (substitute* "Makefile.am"
  384. (("^PACKCC = .*")
  385. "PACKCC = packcc")
  386. (("\\$\\(PACKCC_FILES\\)")
  387. "")
  388. (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): \\$\\(PACKCC\\)")
  389. "$(PEG_SRCS) $(PEG_HEADS):"))
  390. (delete-file-recursively "misc/packcc")))))
  391. (build-system gnu-build-system)
  392. (arguments
  393. '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime.
  394. #:configure-flags '("--enable-tmpdir=/tmp")
  395. #:test-target "units"
  396. #:phases (modify-phases %standard-phases
  397. (add-after 'unpack 'make-files-writable
  398. (lambda _
  399. (for-each make-file-writable (find-files "."))))
  400. (add-before 'bootstrap 'patch-misc
  401. (lambda _
  402. ;; The autogen.sh script calls out to these scripts, so
  403. ;; we cannot wait for the patch-source-shebangs phase.
  404. (for-each patch-shebang (find-files "misc"))))
  405. (add-before 'check 'patch-tests
  406. (lambda _
  407. (substitute* "misc/units"
  408. (("SHELL=/bin/sh")
  409. (string-append "SHELL=" (which "sh"))))
  410. (substitute* "Tmain/utils.sh"
  411. (("/bin/echo") (which "echo"))))))))
  412. (native-inputs
  413. `(("autoconf" ,autoconf)
  414. ("automake" ,automake)
  415. ("packcc" ,packcc)
  416. ("perl" ,perl)
  417. ("pkg-config" ,pkg-config)))
  418. (inputs
  419. `(("jansson" ,jansson)
  420. ("libseccomp" ,libseccomp)
  421. ("libxml2" ,libxml2)
  422. ("libyaml" ,libyaml)))
  423. (home-page "https://ctags.io/")
  424. (synopsis "Generate tag files for source code")
  425. (description
  426. "Universal Ctags generates an index (or tag) file of language objects
  427. found in source files for many popular programming languages. This index
  428. makes it easy for text editors and other tools to locate the indexed items.
  429. Universal Ctags improves on traditional ctags because of its multilanguage
  430. support, its ability for the user to define new languages searched by regular
  431. expressions, and its ability to generate emacs-style TAGS files.")
  432. (license license:gpl2+)))
  433. (define-public withershins
  434. (package
  435. (name "withershins")
  436. (version "0.1")
  437. (source
  438. (origin
  439. (method git-fetch)
  440. (uri (git-reference
  441. (url "https://github.com/cameronwhite/withershins")
  442. (commit (string-append "v" version))))
  443. (file-name (git-file-name name version))
  444. (sha256
  445. (base32 "1cviqvbbcwljm1zx12j6511hazr3kscwrvcyifrkfi4fpy5z985m"))))
  446. (build-system cmake-build-system)
  447. (arguments
  448. `(#:out-of-source? #f
  449. #:configure-flags
  450. ;; XXX A (justified!) misleading-indentation error breaks the build.
  451. (list "-DENABLE_WERROR=OFF")
  452. #:phases
  453. (modify-phases %standard-phases
  454. (add-after
  455. 'unpack 'find-libiberty
  456. (lambda _
  457. (let ((libiberty (assoc-ref %build-inputs "libiberty")))
  458. (substitute* "cmake/FindIberty.cmake"
  459. (("/usr/include") (string-append libiberty "/include"))
  460. (("libiberty.a iberty")
  461. (string-append "NAMES libiberty.a iberty\nPATHS \""
  462. libiberty "/lib" "\"")))
  463. #t)))
  464. (replace
  465. 'install
  466. (lambda* (#:key outputs #:allow-other-keys)
  467. (let* ((out (assoc-ref outputs "out"))
  468. (include (string-append out "/include"))
  469. (lib (string-append out "/lib")))
  470. (mkdir-p include)
  471. (install-file "src/withershins.hpp" include)
  472. (mkdir-p lib)
  473. (install-file "src/libwithershins.a" lib))
  474. #t)))))
  475. (home-page "https://github.com/cameronwhite/withershins")
  476. (inputs
  477. `(("libiberty" ,libiberty)
  478. ("binutils" ,binutils) ;for libbfd
  479. ("zlib" ,zlib)))
  480. (synopsis "C++11 library for generating stack traces")
  481. (description
  482. "Withershins is a simple cross-platform C++11 library for generating
  483. stack traces.")
  484. ;; Sources are released under Expat license, but since BFD is licensed
  485. ;; under the GPLv3+ the combined work is GPLv3+ as well.
  486. (license license:gpl3+)))
  487. (define-public lcov
  488. (package
  489. (name "lcov")
  490. (version "1.15")
  491. (source
  492. (origin
  493. (method url-fetch)
  494. (uri (string-append "https://github.com/linux-test-project/lcov"
  495. "/releases/download/v" version
  496. "/lcov-" version ".tar.gz"))
  497. (sha256
  498. (base32 "0fh5z0q5wg2jxr2nn5w7321y0zg9rwk75j3k5hnamjdy6gxa5kf1"))))
  499. (build-system gnu-build-system)
  500. (arguments
  501. '(#:test-target "test"
  502. #:make-flags (list (string-append "PREFIX="
  503. (assoc-ref %outputs "out")))
  504. #:phases
  505. (modify-phases %standard-phases
  506. (add-after 'unpack 'patch-pwd
  507. ;; Lift the requirement of having a shell in PATH.
  508. (lambda _
  509. (substitute* "bin/geninfo"
  510. (("qw/abs_path/")
  511. "qw/abs_path getcwd/"))
  512. (substitute* '("bin/lcov" "bin/geninfo")
  513. (("`pwd`")
  514. "getcwd()"))
  515. #t))
  516. (delete 'configure) ;no configure script
  517. (add-after 'install 'wrap
  518. (lambda* (#:key outputs #:allow-other-keys)
  519. (let ((out (assoc-ref outputs "out")))
  520. (wrap-program (string-append out "/bin/geninfo")
  521. `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))
  522. #t)))))
  523. (inputs `(("perl" ,perl)
  524. ("perl-io-compress" ,perl-io-compress)
  525. ("perl-json" ,perl-json)))
  526. (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
  527. (synopsis "Code coverage tool that enhances GNU gcov")
  528. (description "LCOV is an extension of @command{gcov}, a tool part of the
  529. GNU@tie{}Binutils, which provides information about what parts of a program
  530. are actually executed (i.e., \"covered\") while running a particular test
  531. case. The extension consists of a set of Perl scripts which build on the
  532. textual @command{gcov} output to implement the following enhanced
  533. functionality such as HTML output.")
  534. (license license:gpl2+)))
  535. (define-public lcov-cobertura
  536. (package
  537. (name "python-lcov-cobertura")
  538. (version "1.6")
  539. (source
  540. (origin
  541. (method url-fetch)
  542. (uri (pypi-uri "lcov_cobertura" version))
  543. (sha256
  544. (base32
  545. "02ar6yjazlxq4p64cz9gag08bvakmzjrp147jara9wlnlbc96j8g"))))
  546. (build-system python-build-system)
  547. (home-page "https://eriwen.github.io/lcov-to-cobertura-xml/")
  548. (synopsis "LCOV to Cobertura XML converter")
  549. (description
  550. "The lcov-to-cobertura Python module converts code coverage report files
  551. in the lcov format to the XML format of
  552. @uref{http://cobertura.github.io/cobertura/, Cobertura}, a Java code coverage
  553. tool. It allows continuous integration servers like Jenkins to aggregate
  554. results and determine build stability.")
  555. (license license:asl2.0)))
  556. (define-public kcov
  557. (package
  558. (name "kcov")
  559. (version "38")
  560. (source (origin
  561. (method git-fetch)
  562. (uri (git-reference
  563. (url "https://github.com/SimonKagstrom/kcov")
  564. (commit version)))
  565. (file-name (git-file-name name version))
  566. (sha256
  567. (base32
  568. "0zqg21xwivi16csl6a5wby6679ny01bjaw4am3y4qcgjdyihifp8"))))
  569. (build-system cmake-build-system)
  570. (arguments
  571. `(#:tests? #f ;no test target
  572. #:phases
  573. (modify-phases %standard-phases
  574. (add-after 'unpack 'fix-/bin/bash-references
  575. (lambda _
  576. (substitute* (find-files "src" ".*\\.cc?$")
  577. (("/bin/bash") (which "bash"))
  578. (("/bin/sh") (which "sh")))
  579. #t)))))
  580. (inputs
  581. `(("curl" ,curl)
  582. ("elfutils" ,elfutils)
  583. ("libelf" ,libelf)
  584. ("zlib" ,zlib)))
  585. (native-inputs
  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.
  592. Kcov uses DWARF debugging information for compiled programs to make it
  593. possible to collect coverage information without special compiler switches.")
  594. (license license:gpl2+)))
  595. (define-public rtags
  596. (package
  597. (name "rtags")
  598. (version "2.18")
  599. (source
  600. (origin
  601. (method git-fetch)
  602. (uri (git-reference
  603. (url "https://github.com/Andersbakken/rtags")
  604. (commit (string-append "v" version))))
  605. (file-name (git-file-name name version))
  606. (patches (search-patches "rtags-separate-rct.patch"))
  607. (modules '((guix build utils)))
  608. (snippet
  609. ;; Part of spliting rct with rtags.
  610. ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
  611. '(with-directory-excursion "src"
  612. (delete-file-recursively "rct") ;remove bundled copy
  613. (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
  614. (substitute* files
  615. (("#include ?\"rct/(.*.h)\"" all header)
  616. (string-append "#include <rct/" header ">")))
  617. #t)))
  618. (sha256
  619. (base32
  620. "0raqjbkl1ykga4ahgl9xw49cgh3cyqcf42z36z7d6fz1fw192kg0"))))
  621. (build-system cmake-build-system)
  622. (arguments
  623. '(#:build-type "RelWithDebInfo"
  624. #:configure-flags
  625. '("-DRTAGS_NO_ELISP_FILES=1"
  626. "-DBUILD_TESTING=FALSE")
  627. #:tests? #f))
  628. (native-inputs
  629. `(("pkg-config" ,pkg-config)))
  630. (inputs
  631. `(("bash-completion" ,bash-completion)
  632. ("clang" ,clang)
  633. ("llvm" ,llvm)
  634. ("lua" ,lua)
  635. ("rct" ,rct)
  636. ("selene" ,selene)))
  637. (home-page "https://github.com/Andersbakken/rtags")
  638. (synopsis "Indexer for the C language family with Emacs integration")
  639. (description
  640. "RTags is a client/server application that indexes C/C++ code and keeps a
  641. persistent file-based database of references, declarations, definitions,
  642. symbolnames etc. There’s also limited support for ObjC/ObjC++. It allows you
  643. to find symbols by name (including nested class and namespace scope). Most
  644. importantly we give you proper follow-symbol and find-references support.")
  645. (license license:gpl3+)))
  646. (define-public colormake
  647. (package
  648. (name "colormake")
  649. (version "0.9.20140503")
  650. (source
  651. (origin
  652. (method git-fetch)
  653. (uri (git-reference
  654. (url "https://github.com/pagekite/Colormake")
  655. (commit version)))
  656. (file-name (git-file-name name version))
  657. (sha256
  658. (base32 "1f9v5s0viq4yc9iv6701h3pv7j21zz1ckl37lpp9hsnliiizv03p"))))
  659. (build-system trivial-build-system)
  660. (native-inputs
  661. `(("bash" ,bash)
  662. ("perl" ,perl)))
  663. (arguments
  664. `(#:modules ((guix build utils))
  665. #:builder
  666. (begin
  667. (use-modules (guix build utils))
  668. (copy-recursively (assoc-ref %build-inputs "source") "source")
  669. (chdir "source")
  670. (patch-shebang "colormake.pl"
  671. (list (string-append (assoc-ref %build-inputs "perl")
  672. "/bin")))
  673. (let* ((out (assoc-ref %outputs "out"))
  674. (bin (string-append out "/bin"))
  675. (doc (string-append out "/share/doc"))
  676. (install-files (lambda (files directory)
  677. (for-each (lambda (file)
  678. (install-file file directory))
  679. files))))
  680. (substitute* "colormake"
  681. (("colormake\\.pl") (string-append bin "/colormake.pl"))
  682. (("/bin/bash")
  683. (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
  684. (install-file "colormake.1" (string-append doc "/man/man1"))
  685. (install-files '("AUTHORS" "BUGS" "ChangeLog" "README") doc)
  686. (install-files '("colormake" "colormake-short" "clmake"
  687. "clmake-short" "colormake.pl")
  688. bin)
  689. #t))))
  690. (home-page "https://bre.klaki.net/programs/colormake/")
  691. (synopsis "Wrapper around @command{make} to produce colored output")
  692. (description "This package provides a wrapper around @command{make} to
  693. produce colored output.")
  694. (license license:gpl2+)))
  695. (define-public makefile2graph
  696. (package
  697. (name "makefile2graph")
  698. (version "1.5.0")
  699. (source
  700. (origin
  701. (method git-fetch)
  702. (uri (git-reference
  703. (url "https://github.com/lindenb/makefile2graph")
  704. (commit (string-append "v" version))))
  705. (file-name (git-file-name name version))
  706. (sha256
  707. (base32 "1gjfk3d8qg3cla7qd2y7r9s03whlfwy83q8k76xfcnqrjjfavdgk"))))
  708. (build-system gnu-build-system)
  709. (arguments
  710. '(#:test-target "test"
  711. #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
  712. #:phases
  713. (modify-phases %standard-phases
  714. (delete 'configure))))
  715. (native-inputs
  716. `(("graphviz" ,graphviz)))
  717. (home-page "https://github.com/lindenb/makefile2graph")
  718. (synopsis "Creates a graph of dependencies from GNU Make")
  719. (description
  720. "@code{make2graph} creates a graph of dependencies from GNU Make. The
  721. output is a graphviz-dot file, a Gexf-XML file or a list of the deepest
  722. independent targets.")
  723. (license license:expat)))
  724. (define-public uncrustify
  725. (package
  726. (name "uncrustify")
  727. (version "0.69.0")
  728. (source (origin
  729. (method git-fetch)
  730. (uri (git-reference
  731. (url "https://github.com/uncrustify/uncrustify/")
  732. (commit (string-append name "-" version))))
  733. (file-name (git-file-name name version))
  734. (sha256
  735. (base32
  736. "0sqrg13kp8fwymq40976bq380bzw40g4ss7ihlbq45d0f90ifa1k"))))
  737. (build-system cmake-build-system)
  738. (native-inputs
  739. `(("unzip" ,unzip)
  740. ("python" ,python-wrapper)))
  741. (arguments
  742. `(#:phases
  743. (modify-phases %standard-phases
  744. (add-after 'unpack 'unpack-etc
  745. (lambda* (#:key inputs outputs #:allow-other-keys)
  746. ;; Configuration samples are not installed by default.
  747. (let* ((output (assoc-ref outputs "out"))
  748. (etcdir (string-append output "/etc")))
  749. (for-each (lambda (l)
  750. (install-file l etcdir))
  751. (find-files "etc" "\\.cfg$")))
  752. #t)))))
  753. (home-page "http://uncrustify.sourceforge.net/")
  754. (synopsis "Code formatter for C and other related languages")
  755. (description
  756. "Beautify source code in many languages of the C family (C, C++, C#,
  757. Objective@tie{}C, D, Java, Pawn, and Vala). Features:
  758. @itemize
  759. @item Indent and align code.
  760. @item Reformat comments (a little bit).
  761. @item Fix inter-character spacing.
  762. @item Add or remove parens / braces.
  763. @item Supports embedded SQL @code{EXEC SQL} stuff.
  764. @item Highly configurable - More than 600 configurable options.
  765. @end itemize\n")
  766. (license license:gpl2+)))
  767. (define-public astyle
  768. (package
  769. (name "astyle")
  770. (version "3.1")
  771. (source
  772. (origin
  773. (method url-fetch)
  774. (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
  775. version "/astyle_" version "_linux.tar.gz"))
  776. (sha256
  777. (base32
  778. "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"))))
  779. (build-system gnu-build-system)
  780. (arguments
  781. `(#:tests? #f ;no tests
  782. #:make-flags (list (string-append "prefix=" %output)
  783. "INSTALL=install"
  784. "all")
  785. #:modules ((guix build gnu-build-system) ;; FIXME use %default-modules
  786. (guix build utils)
  787. (ice-9 regex))
  788. #:phases
  789. (modify-phases %standard-phases
  790. (replace 'configure
  791. (lambda _ (chdir "build/gcc") #t))
  792. (add-after 'install 'install-libs
  793. (lambda* (#:key outputs #:allow-other-keys)
  794. ;; Libraries and includes are not installed by default
  795. (let* ((output (assoc-ref outputs "out"))
  796. (incdir (string-append output "/include"))
  797. (libdir (string-append output "/lib")))
  798. (define (make-so-link sofile strip-pattern)
  799. (symlink
  800. (basename sofile)
  801. (regexp-substitute #f
  802. (string-match strip-pattern sofile)
  803. 'pre)))
  804. (mkdir-p incdir)
  805. (copy-file "../../src/astyle.h"
  806. (string-append incdir "/astyle.h"))
  807. (mkdir-p libdir)
  808. (for-each (lambda (l)
  809. (copy-file
  810. l (string-append libdir "/" (basename l))))
  811. (find-files "bin" "lib*"))
  812. (for-each
  813. (lambda (sofile)
  814. (make-so-link sofile "(\\.[0-9]){3}$") ;; link .so
  815. (make-so-link sofile "(\\.[0-9]){2}$")) ;; link .so.3
  816. (find-files libdir "lib.*\\.so\\..*")))
  817. #t)))))
  818. (home-page "http://astyle.sourceforge.net/")
  819. (synopsis "Source code indenter, formatter, and beautifier")
  820. (description
  821. "Artistic Style is a source code indenter, formatter, and beautifier for
  822. the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
  823. (license license:lgpl3+)))
  824. (define-public indent
  825. (package
  826. (name "indent")
  827. (version "2.2.12")
  828. (source (origin
  829. (method url-fetch)
  830. (uri (string-append "mirror://gnu/indent/indent-" version
  831. ".tar.gz"))
  832. (sha256
  833. (base32 "12xvcd16cwilzglv9h7sgh4h1qqjd1h8s48ji2dla58m4706hzg7"))))
  834. (build-system gnu-build-system)
  835. (arguments
  836. `(#:phases
  837. (modify-phases %standard-phases
  838. (add-after 'unpack 'fix-docdir
  839. (lambda _
  840. ;; Although indent uses a modern autoconf in which docdir
  841. ;; defaults to PREFIX/share/doc, the doc/Makefile.am
  842. ;; overrides this to be in PREFIX/doc. Fix this.
  843. (substitute* "doc/Makefile.in"
  844. (("^docdir = .*$") "docdir = @docdir@\n"))
  845. #t))
  846. (add-after 'unpack 'fix-configure
  847. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  848. ;; Replace outdated config.sub and config.guess:
  849. (with-directory-excursion "config"
  850. (for-each (lambda (file)
  851. (install-file
  852. (string-append (assoc-ref
  853. (or native-inputs inputs) "automake")
  854. "/share/automake-"
  855. ,(version-major+minor
  856. (package-version automake))
  857. "/" file) "."))
  858. '("config.sub" "config.guess")))
  859. #t)))))
  860. (native-inputs
  861. `(("texinfo" ,texinfo)
  862. ("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
  863. (synopsis "Code reformatter")
  864. (description
  865. "Indent is a program that makes source code easier to read by
  866. reformatting it in a consistent style. It can change the style to one of
  867. several different styles such as GNU, BSD or K&R. It has some flexibility to
  868. deal with incomplete or malformed syntax. GNU indent offers several
  869. extensions over the standard utility.")
  870. (license license:gpl3+)
  871. (home-page "https://www.gnu.org/software/indent/")))
  872. (define-public amalgamate
  873. (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208")
  874. (revision "0")
  875. (version (git-version "1.1.1" revision commit)))
  876. (package
  877. (name "amalgamate")
  878. (version version)
  879. (home-page "https://github.com/edlund/amalgamate")
  880. (source
  881. (origin
  882. (method git-fetch)
  883. (uri (git-reference
  884. (url home-page)
  885. (commit commit)))
  886. (sha256
  887. (base32
  888. "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb"))
  889. (file-name (git-file-name name version))
  890. (modules '((guix build utils)))
  891. (snippet
  892. '(substitute* "test.sh"
  893. (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all)
  894. "test_command \"gcc -Wall -Wextra -o source.out source.c\"")))))
  895. (build-system gnu-build-system)
  896. (inputs
  897. `(("python" ,python-wrapper)))
  898. (arguments
  899. `(#:phases
  900. (modify-phases %standard-phases
  901. (delete 'configure)
  902. (delete 'build)
  903. (replace 'install
  904. (lambda* (#:key outputs #:allow-other-keys)
  905. (let* ((out (assoc-ref outputs "out"))
  906. (bin (string-append out "/bin")))
  907. (install-file "amalgamate.py" bin))))
  908. (replace 'check
  909. (lambda _
  910. (invoke "./test.sh"))))))
  911. (synopsis "Tool for amalgamating C source and header files")
  912. ;; The package is indeed a script file, and the term "amalgamate.py" is
  913. ;; used by upstream.
  914. (description "amalgamate.py aims to make it easy to use SQLite-style C
  915. source and header amalgamation in projects.")
  916. (license license:bsd-3))))