pretty-print.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
  3. ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
  5. ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
  6. ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu packages pretty-print)
  23. #:use-module (guix packages)
  24. #:use-module (guix licenses)
  25. #:use-module (guix download)
  26. #:use-module (guix build-system cmake)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (guix utils)
  29. #:use-module (gnu packages)
  30. #:use-module (gnu packages ghostscript)
  31. #:use-module (gnu packages groff)
  32. #:use-module (gnu packages imagemagick)
  33. #:use-module (gnu packages gv)
  34. #:use-module (gnu packages boost)
  35. #:use-module (gnu packages bison)
  36. #:use-module (gnu packages flex)
  37. #:use-module (gnu packages gperf)
  38. #:use-module (gnu packages lua)
  39. #:use-module (gnu packages perl)
  40. #:use-module (gnu packages pkg-config)
  41. #:use-module (gnu packages compression))
  42. (define-public a2ps
  43. (package
  44. (name "a2ps")
  45. (version "4.14")
  46. (source (origin
  47. (method url-fetch)
  48. (uri (string-append "mirror://gnu/a2ps/a2ps-"
  49. version ".tar.gz"))
  50. (sha256
  51. (base32
  52. "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
  53. (modules '((guix build utils)))
  54. (snippet
  55. ;; Remove timestamp from the installed 'README' file.
  56. '(begin
  57. (substitute* "etc/README.in"
  58. (("@date@")
  59. "1st of some month, sometime after 1970"))
  60. #t))
  61. (patches (search-patches
  62. "a2ps-CVE-2001-1593.patch"
  63. "a2ps-CVE-2014-0466.patch"))))
  64. (build-system gnu-build-system)
  65. (inputs
  66. `(("psutils" ,psutils)
  67. ("groff" ,groff)
  68. ("gv" ,gv)
  69. ("imagemagick" ,imagemagick)))
  70. (native-inputs
  71. `(("gperf" ,gperf)
  72. ("perl" ,perl)))
  73. (arguments
  74. '(#:phases
  75. (modify-phases %standard-phases
  76. (add-before 'build 'patch-scripts
  77. (lambda _
  78. (substitute*
  79. '("afm/make_fonts_map.sh"
  80. "tests/defs"
  81. "tests/backup.tst"
  82. "tests/styles.tst")
  83. (("/bin/rm") (which "rm")))))
  84. (add-before 'check 'patch-test-files
  85. ;; Alternatively, we could unpatch the shebangs in tstfiles
  86. (lambda* (#:key inputs #:allow-other-keys)
  87. (let ((perl (assoc-ref inputs "perl")))
  88. (substitute* '("tests/ps-ref/includeres.ps"
  89. "tests/gps-ref/includeres.ps")
  90. (("/usr/local/bin/perl")
  91. (string-append perl "/bin/perl"))))
  92. ;; Some of the reference postscript contain a 'version 3'
  93. ;; string that in inconsistent with the source text in the
  94. ;; tstfiles directory. Erroneous search-and-replace?
  95. (substitute* '("tests/ps-ref/InsertBlock.ps"
  96. "tests/gps-ref/InsertBlock.ps"
  97. "tests/ps-ref/bookie.ps"
  98. "tests/gps-ref/bookie.ps")
  99. (("version 3") "version 2"))
  100. (substitute* '("tests/ps-ref/psmandup.ps"
  101. "tests/gps-ref/psmandup.ps")
  102. (("#! */bin/sh") (string-append
  103. "#!" (which "sh")))))))))
  104. (home-page "https://www.gnu.org/software/a2ps/")
  105. (synopsis "Any file to PostScript, including pretty-printing")
  106. (description
  107. "GNU a2ps converts almost anything to a PostScript file, ready for
  108. printing. It accomplishes this by being able to delegate files to external
  109. handlers, such as Groff and Gzip. It handles as many steps as is necessary to
  110. produce a pretty-printed file. It also includes some extra abilities for
  111. special cases, such as pretty-printing \"--help\" output.")
  112. (license gpl3+)))
  113. (define-public trueprint
  114. (package
  115. (name "trueprint")
  116. (version "5.4")
  117. (source
  118. (origin
  119. (method url-fetch)
  120. (uri (string-append "mirror://gnu/trueprint/trueprint-"
  121. version ".tar.gz"))
  122. (sha256
  123. (base32
  124. "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
  125. (build-system gnu-build-system)
  126. (arguments
  127. ;; Must define DIFF_CMD for tests to pass
  128. '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
  129. (home-page "https://www.gnu.org/software/trueprint/")
  130. (synopsis "Pretty-print C sources and other plain text to PostScript")
  131. (description
  132. "GNU Trueprint translates C source code files as PostScript files.
  133. In addition to the basic source code output, it can also perform diff-marking,
  134. indentation counting, function and file indices and more.")
  135. (license gpl2)))
  136. (define-public enscript
  137. (package
  138. (name "enscript")
  139. (version "1.6.6")
  140. (source
  141. (origin
  142. (method url-fetch)
  143. (uri (string-append "mirror://gnu/enscript/enscript-"
  144. version ".tar.gz"))
  145. (sha256
  146. (base32
  147. "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
  148. (build-system gnu-build-system)
  149. (home-page "https://www.gnu.org/software/enscript/")
  150. (synopsis "Generating PostScript, including pretty-printing")
  151. (description
  152. "GNU Enscript is a program to convert ASCII text files to PostScript,
  153. HTML or RTF formats, to be stored in files or sent immediately to a printer.
  154. It also includes the capability to perform syntax highlighting for several
  155. different programming languages.")
  156. (license gpl3+)))
  157. (define-public fmt
  158. (package
  159. (name "fmt")
  160. (version "4.1.0")
  161. (source (origin
  162. (method url-fetch)
  163. (uri (string-append
  164. "https://github.com/fmtlib/fmt/releases/download/"
  165. version "/fmt-" version ".zip"))
  166. (sha256
  167. (base32
  168. "1swyqw3dn2vx5sw2yh5vk0vrvrkp7fv07cj4272yxl5rrq1byjcx"))))
  169. (build-system cmake-build-system)
  170. (native-inputs
  171. `(("unzip" ,unzip)))
  172. (arguments
  173. `(#:configure-flags
  174. (list (string-append "-DCMAKE_INSTALL_LIBDIR="
  175. (assoc-ref %outputs "out") "/lib"))))
  176. (home-page "http://fmtlib.net/")
  177. (synopsis "Small and fast C++ formatting library")
  178. (description
  179. "@code{fmt} (formerly @code{cppformat}) is a formatting library for C++.
  180. It can be used as a safe alternative to @code{printf} or as a fast alternative
  181. to @code{IOStreams}.")
  182. ;; The library is bsd-2, but documentation and tests include other licenses.
  183. (license (list bsd-2 bsd-3 psfl))))
  184. (define-public source-highlight
  185. (package
  186. (name "source-highlight")
  187. (version "3.1.8")
  188. (source
  189. (origin
  190. (method url-fetch)
  191. (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
  192. version ".tar.gz"))
  193. (sha256
  194. (base32
  195. "18xdalxg7yzrxc1njzgw7aryq2jdm7zq2yqz41sc7k6il5z6lcq1"))))
  196. (build-system gnu-build-system)
  197. ;; The ctags that comes with emacs does not support the --excmd options,
  198. ;; so can't be used
  199. (inputs
  200. `(("boost" ,boost)))
  201. (native-inputs
  202. `(("bison" ,bison)
  203. ("flex" ,flex)))
  204. (arguments
  205. `(#:configure-flags
  206. (list (string-append "--with-boost="
  207. (assoc-ref %build-inputs "boost")))
  208. #:parallel-tests? #f ;There appear to be race conditions
  209. #:phases
  210. (modify-phases %standard-phases
  211. (add-before 'check 'patch-test-files
  212. (lambda _
  213. ;; Unpatch shebangs in test input so that source-highlight
  214. ;; is still able to infer input language
  215. (substitute* '("tests/test.sh"
  216. "tests/test2.sh"
  217. "tests/test.tcl")
  218. (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
  219. ;; Initial patching unrecoverably removes whitespace, so
  220. ;; remove it also in the comparison output.
  221. (substitute* '("tests/test.sh.html"
  222. "tests/test2.sh.html"
  223. "tests/test.tcl.html")
  224. (("#! */bin/sh") "#!/bin/sh"))
  225. #t)))))
  226. (home-page "https://www.gnu.org/software/src-highlite/")
  227. (synopsis "Produce a document with syntax highlighting from a source file")
  228. (description
  229. "GNU source-highlight reads in a source code file and produces an output
  230. file in which the keywords are highlighted in different colors to designate
  231. their syntactic role. It supports over 150 different languages and it can
  232. output to 8 different formats, including HTML, LaTeX and ODF. It can also
  233. output to ANSI color escape sequences, so that highlighted source code can be
  234. seen in a terminal.")
  235. (license gpl3+)
  236. (properties '((ftp-directory . "/gnu/src-highlite")))))
  237. (define-public highlight
  238. (package
  239. (name "highlight")
  240. (version "3.47")
  241. (source
  242. (origin
  243. (method url-fetch)
  244. (uri (string-append "http://www.andre-simon.de/zip/highlight-"
  245. version ".tar.bz2"))
  246. (sha256
  247. (base32
  248. "0xidf8755lnx55x6p4ajgg4l145akjqswny41483fvg5lpa41i6f"))))
  249. (build-system gnu-build-system)
  250. (arguments
  251. `(#:tests? #f ; no tests
  252. #:make-flags
  253. (let ((confdir (string-append %output "/share/highlight/config/")))
  254. (list (string-append "PREFIX=" %output)
  255. (string-append "HL_CONFIG_DIR=" confdir)
  256. (string-append "conf_dir=" confdir)))
  257. #:phases
  258. (modify-phases %standard-phases
  259. (delete 'configure) ; no configure script
  260. (add-after 'unpack 'fix-search-for-lua
  261. (lambda _
  262. (substitute* "src/makefile"
  263. (("(pkg-config.*)lua" _ prefix)
  264. (string-append prefix "lua-" ,(version-major+minor
  265. (package-version lua)))))
  266. #t)))))
  267. (inputs
  268. `(("lua" ,lua)
  269. ("boost" ,boost)))
  270. (native-inputs
  271. `(("pkg-config" ,pkg-config)))
  272. (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php")
  273. (synopsis "Convert code to documents with syntax highlighting")
  274. (description "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
  275. TeX, SVG, BBCode and terminal escape sequences with colored syntax
  276. highlighting. Language definitions and color themes are customizable.")
  277. (license gpl3+)))