gnu: alacritty: Embed absolute references to required libraries.
[jackhill/guix/guix.git] / gnu / packages / markup.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
3 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
4 ;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017 Nikita <nikita@n0.is>
6 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages markup)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix packages)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system perl)
33 #:use-module (guix utils)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages web))
40
41 (define-public hoedown
42 (package
43 (name "hoedown")
44 (version "3.0.7")
45 (source (origin
46 (method git-fetch)
47 (uri (git-reference
48 (url "https://github.com/hoedown/hoedown")
49 (commit version)))
50 (file-name (git-file-name name version))
51 (sha256
52 (base32
53 "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
54 (build-system gnu-build-system)
55 (arguments
56 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
57 #:phases (modify-phases %standard-phases
58 (delete 'configure)) ; no configure script
59 #:test-target "test"))
60 (native-inputs
61 `(("python" ,python-2)
62 ("tidy" ,tidy)))
63 (synopsis "Markdown processing library")
64 (description "Hoedown is a standards compliant, fast, secure markdown
65 processing library written in C.")
66 (home-page "https://github.com/hoedown/hoedown")
67 (license expat)))
68
69 (define-public markdown
70 (package
71 (name "markdown")
72 (version "1.0.1")
73 (source
74 (origin
75 (method url-fetch)
76 (uri (string-append
77 "http://daringfireball.net/projects/downloads/"
78 (string-capitalize name) "_" version ".zip"))
79 (sha256
80 (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
81 (build-system trivial-build-system)
82 (arguments
83 '(#:modules ((guix build utils))
84 #:builder
85 (begin
86 (use-modules (guix build utils))
87 (let ((source (assoc-ref %build-inputs "source"))
88 (out (assoc-ref %outputs "out"))
89 (perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
90 (unzip (string-append (assoc-ref %build-inputs "unzip")
91 "/bin/unzip")))
92 (mkdir-p out)
93 (with-directory-excursion out
94 (invoke unzip source)
95 (mkdir "bin")
96 (mkdir-p "share/doc")
97 (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
98 (rename-file "Markdown_1.0.1/Markdown Readme.text"
99 "share/doc/README")
100 (patch-shebang "bin/markdown" (list perlbd))
101 (delete-file-recursively "Markdown_1.0.1"))
102 #t))))
103 (native-inputs `(("unzip" ,unzip)))
104 (inputs `(("perl" ,perl)))
105 (home-page "http://daringfireball.net/projects/markdown")
106 (synopsis "Text-to-HTML conversion tool")
107 (description
108 "Markdown is a text-to-HTML conversion tool for web writers. It allows
109 you to write using an easy-to-read, easy-to-write plain text format, then
110 convert it to structurally valid XHTML (or HTML).")
111 (license (non-copyleft "file://License.text"
112 "See License.text in the distribution."))))
113
114 (define-public discount
115 (package
116 (name "discount")
117 (version "2.2.7")
118 (source (origin
119 (method url-fetch)
120 (uri (string-append
121 "http://www.pell.portland.or.us/~orc/Code/"
122 "discount/discount-" version ".tar.bz2"))
123 (sha256
124 (base32
125 "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
126 (build-system gnu-build-system)
127 (arguments
128 `(#:test-target "test"
129 #:parallel-build? #f ; libmarkdown won't be built in time
130 #:make-flags (list
131 (string-append "LFLAGS=-L. -Wl,-rpath="
132 (assoc-ref %outputs "out") "/lib"))
133 #:phases
134 (modify-phases %standard-phases
135 (add-before 'configure 'set-AC_PATH
136 (lambda _
137 ;; The default value is not suitable, so override using an
138 ;; environment variable. This just affects the build, and not the
139 ;; resulting store item.
140 (setenv "AC_PATH" (getenv "PATH"))
141 #t))
142 (replace 'configure
143 (lambda* (#:key inputs outputs #:allow-other-keys)
144 (let ((out (assoc-ref outputs "out")))
145 (setenv "CC" ,(cc-for-target))
146 ;; The ‘validate-runpath’ phase fails otherwise.
147 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
148 (invoke "./configure.sh"
149 (string-append "--prefix=" out)
150 "--shared")))))))
151 (native-inputs
152 `(("pkg-config" ,pkg-config)))
153 (synopsis "Markdown processing library, written in C")
154 (description
155 "Discount is a markdown implementation, written in C. It provides a
156 @command{markdown} command, and a library.")
157 (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
158 (license bsd-3)))
159
160 (define-public perl-text-markdown-discount
161 (package
162 (name "perl-text-markdown-discount")
163 (version "0.11")
164 (source
165 (origin
166 (method url-fetch)
167 (uri (string-append
168 "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
169 version
170 ".tar.gz"))
171 (sha256
172 (base32
173 "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
174 (patches
175 (search-patches "perl-text-markdown-discount-unbundle.patch"))))
176 (build-system perl-build-system)
177 (arguments
178 `(#:phases
179 (modify-phases %standard-phases
180 (add-before 'build 'set-ldflags
181 (lambda* (#:key inputs #:allow-other-keys)
182 (substitute* "Makefile"
183 (("OTHERLDFLAGS = ")
184 (string-append
185 "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
186 (assoc-ref inputs "discount")
187 "/lib")))
188 #t)))))
189 (inputs
190 `(("discount" ,discount)))
191 (home-page
192 "https://metacpan.org/release/Text-Markdown-Discount")
193 (synopsis
194 "Fast function for converting Markdown to HTML using Discount")
195 (description
196 "Text::Markdown::Discount is a Perl extension to the Discount markdown
197 implementation.
198
199 @example
200 use Text::Markdown::Discount;
201 my $html = markdown($text)
202 @end example")
203 (license perl-license)))
204
205 (define-public cmark
206 (package
207 (name "cmark")
208 (version "0.29.0")
209 (source (origin
210 (method git-fetch)
211 (uri (git-reference
212 (url "https://github.com/jgm/cmark")
213 (commit version)))
214 (file-name (git-file-name name version))
215 (sha256
216 (base32
217 "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
218 (modules '((guix build utils)))
219 (snippet
220 '(begin
221 ;; Mimic upstream commit 68c3a91166347 to fix a test failure
222 ;; when using Python 3.8. Remove for versions > 0.29.
223 ;; See <https://github.com/commonmark/cmark/issues/313>.
224 (substitute* "test/normalize.py"
225 (("cgi") "html"))
226 #t))))
227 (build-system cmake-build-system)
228 (arguments
229 '(#:test-target "test"))
230 (native-inputs `(("python" ,python)))
231 (synopsis "CommonMark Markdown reference implementation")
232 (description "CommonMark is a strongly defined, highly compatible
233 specification of Markdown. cmark is the C reference implementation of
234 CommonMark. It provides @code{libcmark} shared library for parsing
235 CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
236 as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
237 AST. The package also provides the command-line program @command{cmark}
238 for parsing and rendering CommonMark.")
239 (home-page "https://commonmark.org")
240 ;; cmark is distributed with a BSD-2 license, but some components are Expat
241 ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
242 ;; licensed. See 'COPYING' in the source distribution for more information.
243 (license (list bsd-2 expat cc-by-sa4.0))))
244
245 (define-public smu
246 (package
247 (name "smu")
248 (version "1.5")
249 (source
250 (origin
251 (method git-fetch)
252 (uri (git-reference
253 (url "https://github.com/Gottox/smu")
254 (commit (string-append "v" version))))
255 (file-name (git-file-name name version))
256 (sha256
257 (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
258 (build-system gnu-build-system)
259 (arguments
260 `(#:make-flags (list "CC=gcc"
261 (string-append "PREFIX="
262 (assoc-ref %outputs "out")))
263 #:tests? #f ; no tests included
264 #:phases
265 (modify-phases %standard-phases
266 (delete 'configure))))
267 (home-page "https://github.com/Gottox/smu")
268 (synopsis "Simple markup")
269 (description
270 "Smu is a very simple and minimal markup language. It is
271 designed for using in wiki-like environments. Smu makes it very
272 easy to write your documents on the fly and convert them into HTML.
273 Smu is capable to parse very large documents. As long as you avoid an huge
274 amount of indents it scales just great.
275
276 Smu was started as a rewrite of Markdown but became something more
277 lightweight and consistent. The biggest difference between Markdown
278 and smu is that smu doesn't support reference style links.")
279 (license x11)))