code.scm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
  4. ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
  5. ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
  8. ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
  9. ;;;
  10. ;;; This file is part of GNU Guix.
  11. ;;;
  12. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  13. ;;; under the terms of the GNU General Public License as published by
  14. ;;; the Free Software Foundation; either version 3 of the License, or (at
  15. ;;; your option) any later version.
  16. ;;;
  17. ;;; GNU Guix is distributed in the hope that it will be useful, but
  18. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ;;; GNU General Public License for more details.
  21. ;;;
  22. ;;; You should have received a copy of the GNU General Public License
  23. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  24. (define-module (gnu packages code)
  25. #:use-module (guix packages)
  26. #:use-module (guix download)
  27. #:use-module ((guix licenses) #:prefix license:)
  28. #:use-module (guix build-system gnu)
  29. #:use-module (guix build-system cmake)
  30. #:use-module (gnu packages base)
  31. #:use-module (gnu packages compression)
  32. #:use-module (gnu packages databases)
  33. #:use-module (gnu packages emacs)
  34. #:use-module (gnu packages gcc)
  35. #:use-module (gnu packages pcre)
  36. #:use-module (gnu packages pkg-config)
  37. #:use-module (gnu packages perl)
  38. #:use-module (gnu packages texinfo)
  39. #:use-module (gnu packages autogen)
  40. #:use-module (gnu packages ncurses)
  41. #:use-module (gnu packages autotools))
  42. ;;; Tools to deal with source code: metrics, cross-references, etc.
  43. (define-public cflow
  44. (package
  45. (name "cflow")
  46. (version "1.5")
  47. (source (origin
  48. (method url-fetch)
  49. (uri (string-append "mirror://gnu/cflow/cflow-"
  50. version ".tar.bz2"))
  51. (sha256
  52. (base32
  53. "0yq33k5ap1zpnja64n89iai4zh018ffr72wki5a6mzczd880mr3g"))))
  54. (build-system gnu-build-system)
  55. ;; Needed to have cflow-mode.el installed.
  56. (native-inputs `(("emacs" ,emacs-minimal)))
  57. (arguments
  58. '(#:configure-flags (list (string-append "CPPFLAGS="
  59. "-D" "CFLOW_PREPROC=\\\""
  60. (assoc-ref %build-inputs "gcc")
  61. "/bin/cpp\\\""))))
  62. (home-page "https://www.gnu.org/software/cflow/")
  63. (synopsis "Create a graph of control flow within a program")
  64. (description
  65. "GNU cflow analyzes C source files and produces a graph charting the
  66. control flow of the program. It can output the graph in several styles and
  67. in either the POSIX format or in an extended GNU format. cflow also includes
  68. a major mode for Emacs for examining the flowcharts that it produces.")
  69. (license license:gpl3+)))
  70. (define-public complexity
  71. (package
  72. (name "complexity")
  73. (version "1.10")
  74. (source (origin
  75. (method url-fetch)
  76. (uri (string-append "mirror://gnu/complexity/complexity-"
  77. version ".tar.xz"))
  78. (sha256
  79. (base32
  80. "0lr0l9kj2w3jilz9h9y4np9pf9i9ccpy6331lanki2fnz4z8ldvd"))))
  81. (build-system gnu-build-system)
  82. (native-inputs
  83. `(("texinfo" ,texinfo)
  84. ("autogen" ,autogen)))
  85. (home-page "https://www.gnu.org/software/complexity/")
  86. (synopsis "Analyze complexity of C functions")
  87. (description
  88. "GNU complexity provides tools for finding procedures that are
  89. convoluted, overly long or otherwise difficult to understand. This
  90. may help in learning or reviewing unfamiliar code or perhaps
  91. highlighting your own code that seemed comprehensible when you wrote it.")
  92. (license license:gpl3+)))
  93. (define-public global ; a global variable
  94. (package
  95. (name "global")
  96. (version "6.6.1")
  97. (source (origin
  98. (method url-fetch)
  99. (uri (string-append "mirror://gnu/global/global-"
  100. version ".tar.gz"))
  101. (sha256
  102. (base32
  103. "1r2r6z41lmgbszzwx7h3jqhwnqb9jj32pndzhr3lb0id710c8gcl"))))
  104. (build-system gnu-build-system)
  105. (inputs `(("ncurses" ,ncurses)
  106. ("libltdl" ,libltdl)
  107. ("sqlite" ,sqlite)))
  108. (arguments
  109. `(#:configure-flags
  110. (list (string-append "--with-ncurses="
  111. (assoc-ref %build-inputs "ncurses"))
  112. (string-append "--with-sqlite3="
  113. (assoc-ref %build-inputs "sqlite")))
  114. #:phases
  115. (modify-phases %standard-phases
  116. (add-after 'install 'post-install
  117. (lambda* (#:key outputs #:allow-other-keys)
  118. ;; Install the Emacs Lisp file in the right place.
  119. (let* ((out (assoc-ref outputs "out"))
  120. (data (string-append out "/share/gtags"))
  121. (lisp (string-append out "/share/emacs/site-lisp")))
  122. (install-file (string-append data "/gtags.el") lisp)
  123. (delete-file (string-append data "/gtags.el"))
  124. #t))))))
  125. (home-page "https://www.gnu.org/software/global/")
  126. (synopsis "Cross-environment source code tag system")
  127. (description
  128. "GLOBAL is a source code tagging system that functions in the same way
  129. across a wide array of environments, such as different text editors, shells
  130. and web browsers. The resulting tags are useful for quickly moving around in
  131. a large, deeply nested project.")
  132. (license license:gpl3+)))
  133. (define-public sloccount
  134. (package
  135. (name "sloccount")
  136. (version "2.26")
  137. (source (origin
  138. (method url-fetch)
  139. (uri (string-append "http://www.dwheeler.com/sloccount/sloccount-"
  140. version ".tar.gz"))
  141. (sha256
  142. (base32
  143. "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"))))
  144. (build-system gnu-build-system)
  145. (arguments
  146. '(#:phases (modify-phases %standard-phases
  147. (delete 'configure)
  148. (add-before 'build 'make-dotl-files-older
  149. (lambda _
  150. ;; Make the '.l' files as old as the '.c'
  151. ;; files to avoid triggering the rule that
  152. ;; requires Flex.
  153. (define ref
  154. (stat "README"))
  155. (for-each (lambda (file)
  156. (set-file-time file ref))
  157. (find-files "." "\\.[chl]$"))
  158. #t))
  159. (add-before 'install 'make-target-directories
  160. (lambda* (#:key outputs #:allow-other-keys)
  161. (let ((out (assoc-ref outputs "out")))
  162. (mkdir-p (string-append out "/bin"))
  163. (mkdir-p (string-append out
  164. "/share/man/man1"))
  165. (mkdir-p (string-append out
  166. "/share/doc")))))
  167. (replace 'check
  168. (lambda _
  169. (setenv "HOME" (getcwd))
  170. (setenv "PATH"
  171. (string-append (getcwd) ":"
  172. (getenv "PATH")))
  173. (zero? (system* "make" "test")))))
  174. #:make-flags (list (string-append "PREFIX="
  175. (assoc-ref %outputs "out")))))
  176. (inputs `(("perl" ,perl)))
  177. (home-page "http://www.dwheeler.com/sloccount/")
  178. (synopsis "Count physical source lines of code (SLOC)")
  179. (description
  180. "SLOCCount is a set of the programs for counting source lines of
  181. code (SLOC) in large software systems. It can automatically identify and
  182. measure a wide range of programming languages. It automatically estimates the
  183. effort, time, and money it would take to develop the software, using the
  184. COCOMO model or user-provided parameters.")
  185. (license license:gpl2+)))
  186. (define-public cloc
  187. (package
  188. (name "cloc")
  189. (version "1.74")
  190. (source
  191. (origin
  192. (method url-fetch)
  193. (uri (string-append
  194. "https://github.com/AlDanial/cloc/releases/download/" version
  195. "/cloc-" version ".tar.gz"))
  196. (sha256
  197. (base32
  198. "0rq5xfiln1wlv3yr9mg18ax4gskbss786iqaf0v45iv6awyl5b2m"))))
  199. (build-system gnu-build-system)
  200. (inputs
  201. `(("coreutils" ,coreutils)
  202. ("perl" ,perl)
  203. ("perl-algorithm-diff" ,perl-algorithm-diff)
  204. ("perl-regexp-common" ,perl-regexp-common)
  205. ("perl-digest-md5" ,perl-digest-md5)))
  206. (arguments
  207. `(#:phases (modify-phases %standard-phases
  208. (delete 'configure)
  209. (delete 'build)
  210. (replace 'install
  211. (lambda* (#:key inputs outputs #:allow-other-keys)
  212. (let* ((out (assoc-ref outputs "out")))
  213. (zero?
  214. (system* "make" "-C" "Unix"
  215. (string-append "prefix=" out)
  216. (string-append "INSTALL="
  217. (assoc-ref inputs "coreutils")
  218. "/bin/install")
  219. "install")))))
  220. (add-after 'install 'wrap-program
  221. (lambda* (#:key inputs outputs #:allow-other-keys)
  222. (let ((out (assoc-ref outputs "out")))
  223. (wrap-program (string-append out "/bin/cloc")
  224. `("PERL5LIB" ":" =
  225. ,(string-split (getenv "PERL5LIB") #\:)))
  226. #t))))
  227. #:out-of-source? #t
  228. ;; Tests require some other packages.
  229. #:tests? #f))
  230. (home-page "https://github.com/AlDanial/cloc")
  231. (synopsis "Count source lines of code (SLOC) and other source code metrics")
  232. (description "cloc counts blank lines, comment lines, and physical lines
  233. of source code in many programming languages. Given two versions of a code
  234. base, cloc can compute differences in blank, comment, and source lines.
  235. cloc contains code from David Wheeler's SLOCCount. Compared to SLOCCount,
  236. cloc can handle a greater variety of programming languages.")
  237. (license license:gpl2+)))
  238. (define-public the-silver-searcher
  239. (package
  240. (name "the-silver-searcher")
  241. (version "2.0.0")
  242. (source (origin
  243. (method url-fetch)
  244. (uri (string-append
  245. "http://geoff.greer.fm/ag/releases/the_silver_searcher-"
  246. version ".tar.gz"))
  247. (sha256
  248. (base32
  249. "04wm3r5p2mgv8mdkvysak0d5199h5y0yzl032624brfxpzmqfcq0"))))
  250. (build-system gnu-build-system)
  251. (native-inputs
  252. `(("pkg-config" ,pkg-config)))
  253. (inputs
  254. `(("pcre" ,pcre)
  255. ("xz" ,xz)
  256. ("zlib" ,zlib)))
  257. (home-page "http://geoff.greer.fm/ag/")
  258. (synopsis "Fast code searching tool")
  259. (description
  260. "The Silver Searcher (@command{ag}) is a tool for quickly searching large
  261. numbers of files. It's intended primarily for source code repositories, and
  262. respects files like @file{.gitignore} and @file{.hgignore}. It's also an order
  263. of magnitude faster than its inspiration, @command{ack}, and less specialised
  264. tools such as @command{grep}.")
  265. (license license:asl2.0)))
  266. (define-public trio
  267. (package
  268. (name "trio")
  269. (version "1.16")
  270. (source (origin
  271. (method url-fetch)
  272. (uri (string-append "mirror://sourceforge/ctrio/trio/trio-"
  273. version ".tar.gz"))
  274. (sha256
  275. (base32
  276. "02pwd5m5vq7hbrffgm2na1dfc249z50yyr5jv73vdw15bd7ygl44"))))
  277. (build-system gnu-build-system)
  278. (home-page "http://daniel.haxx.se/projects/trio/")
  279. (synopsis "Portable and extendable printf and string functions")
  280. (description
  281. "Trio is a set of @code{printf} and string functions designed be used by
  282. applications with a focus on portability or with the need for additional
  283. features that are not supported by the standard @code{stdio} implementation.")
  284. ;; This license is very similar to the ISC license, but the wording is
  285. ;; slightly different.
  286. (license (license:non-copyleft
  287. "http://sourceforge.net/p/ctrio/git/ci/master/tree/README"))))
  288. (define-public withershins
  289. (package
  290. (name "withershins")
  291. (version "0.1")
  292. (source (origin
  293. (method url-fetch)
  294. (uri (string-append
  295. "https://github.com/cameronwhite/withershins/archive/v"
  296. version ".tar.gz"))
  297. (file-name (string-append name "-" version ".tar.gz"))
  298. (sha256
  299. (base32
  300. "08z3lyvswx7sad10637vfpwglbcbgzzcpfihw0x8lzr74f3b70bh"))))
  301. (build-system cmake-build-system)
  302. (arguments
  303. `(#:out-of-source? #f
  304. #:phases
  305. (modify-phases %standard-phases
  306. (add-after
  307. 'unpack 'find-libiberty
  308. (lambda _
  309. (let ((libiberty (assoc-ref %build-inputs "libiberty")))
  310. (substitute* "cmake/FindIberty.cmake"
  311. (("/usr/include") (string-append libiberty "/include"))
  312. (("libiberty.a iberty")
  313. (string-append "NAMES libiberty.a iberty\nPATHS \""
  314. libiberty "/lib" "\"")))
  315. #t)))
  316. (replace
  317. 'install
  318. (lambda* (#:key outputs #:allow-other-keys)
  319. (let* ((out (assoc-ref outputs "out"))
  320. (include (string-append out "/include"))
  321. (lib (string-append out "/lib")))
  322. (mkdir-p include)
  323. (install-file "src/withershins.hpp" include)
  324. (mkdir-p lib)
  325. (install-file "src/libwithershins.a" lib))
  326. #t)))))
  327. (home-page "https://github.com/cameronwhite/withershins")
  328. (inputs
  329. `(("libiberty" ,libiberty)
  330. ("binutils" ,binutils) ;for libbfd
  331. ("zlib" ,zlib)))
  332. (synopsis "C++11 library for generating stack traces")
  333. (description
  334. "Withershins is a simple cross-platform C++11 library for generating
  335. stack traces.")
  336. ;; Sources are released under Expat license, but since BFD is licensed
  337. ;; under the GPLv3+ the combined work is GPLv3+ as well.
  338. (license license:gpl3+)))
  339. (define-public lcov
  340. (package
  341. (name "lcov")
  342. (version "1.12")
  343. (source (origin
  344. (method url-fetch)
  345. (uri (string-append "mirror://sourceforge/ltp/Coverage%20Analysis"
  346. "/LCOV-" version "/lcov-" version ".tar.gz"))
  347. (sha256
  348. (base32
  349. "19wfifdpxxivhq9adbphanjfga9bg9spms9v7c3589wndjff8x5l"))))
  350. (build-system gnu-build-system)
  351. (arguments
  352. '(#:make-flags (let ((out (assoc-ref %outputs "out")))
  353. (list (string-append "PREFIX=" out)
  354. (string-append "BIN_DIR=" out "/bin")
  355. (string-append "MAN_DIR=" out "/share/man")))
  356. #:phases (modify-phases %standard-phases
  357. (delete 'configure))
  358. #:tests? #f)) ;no 'check' target
  359. (inputs `(("perl" ,perl)))
  360. (home-page "http://ltp.sourceforge.net/coverage/lcov.php")
  361. (synopsis "Code coverage tool that enhances GNU gcov")
  362. (description
  363. "LCOV is an extension of @command{gcov}, a tool part of the
  364. GNU@tie{}Binutils, which provides information about what parts of a program
  365. are actually executed (i.e., \"covered\") while running a particular test
  366. case. The extension consists of a set of Perl scripts which build on the
  367. textual @command{gcov} output to implement the following enhanced
  368. functionality such as HTML output.")
  369. (license license:gpl2+)))