gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[jackhill/guix/guix.git] / gnu / packages / c.scm
CommitLineData
a5e2c9a9 1;;; GNU Guix --- Functional package management for GNU
350f50cb 2;;; Copyright © 2016, 2018 Ludovic Courtès <ludo@gnu.org>
011ec1e5 3;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
e48390cb 4;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
07592c77 5;;; Copyright © 2018, 2019 Pierre Neidhardt <mail@ambrevar.xyz>
0270b24b 6;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
f170603e 7;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
4c16ffd3 8;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
7adb5299 9;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
d1c6b097 10;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
70a49ef7 11;;; Copyright @ 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
5bc13b8e 12;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
a5e2c9a9
LC
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages c)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
c229fb3d 33 #:use-module (guix git-download)
a5e2c9a9 34 #:use-module (guix build-system gnu)
9f088725 35 #:use-module (guix build-system trivial)
a5e2c9a9 36 #:use-module (gnu packages bootstrap)
f0316832 37 #:use-module (gnu packages bison)
07592c77 38 #:use-module (gnu packages check)
f0316832 39 #:use-module (gnu packages flex)
a5e2c9a9 40 #:use-module (gnu packages perl)
9f088725 41 #:use-module (gnu packages texinfo)
97b7201f 42 #:use-module (gnu packages guile)
c229fb3d
PN
43 #:use-module (gnu packages multiprecision)
44 #:use-module (gnu packages pcre)
45 #:use-module (gnu packages python)
7def5056 46 #:use-module (gnu packages python-xyz)
c229fb3d
PN
47 #:use-module (gnu packages autotools)
48 #:use-module (gnu packages gettext)
011ec1e5
RW
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages xml))
a5e2c9a9
LC
51
52(define-public tcc
53 (package
54 (name "tcc") ;aka. "tinycc"
5d0bd1fb 55 (version "0.9.27")
a5e2c9a9
LC
56 (source (origin
57 (method url-fetch)
58 (uri (string-append "mirror://savannah/tinycc/tcc-"
59 version ".tar.bz2"))
60 (sha256
61 (base32
5d0bd1fb 62 "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
a5e2c9a9
LC
63 (build-system gnu-build-system)
64 (native-inputs `(("perl" ,perl)
65 ("texinfo" ,texinfo)))
66 (arguments
67 `(#:configure-flags (list (string-append "--elfinterp="
68 (assoc-ref %build-inputs "libc")
69 ,(glibc-dynamic-linker))
70 (string-append "--crtprefix="
71 (assoc-ref %build-inputs "libc")
72 "/lib")
73 (string-append "--sysincludepaths="
74 (assoc-ref %build-inputs "libc")
75 "/include:"
76 (assoc-ref %build-inputs
ce430bd6 77 "kernel-headers")
a5e2c9a9
LC
78 "/include:{B}/include")
79 (string-append "--libpaths="
80 (assoc-ref %build-inputs "libc")
9117d6df
EF
81 "/lib")
82 ,@(if (string-prefix? "armhf-linux"
83 (or (%current-target-system)
84 (%current-system)))
85 `("--triplet=arm-linux-gnueabihf")
86 '()))
a5e2c9a9 87 #:test-target "test"))
4c16ffd3
AE
88 (native-search-paths
89 (list (search-path-specification
90 (variable "CPATH")
91 (files '("include")))
92 (search-path-specification
93 (variable "LIBRARY_PATH")
94 (files '("lib" "lib64")))))
57a31efb 95 ;; Fails to build on MIPS: "Unsupported CPU"
0270b24b 96 (supported-systems (delete "mips64el-linux" %supported-systems))
a5e2c9a9
LC
97 (synopsis "Tiny and fast C compiler")
98 (description
99 "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
100written in C. It supports ANSI C with GNU and extensions and most of the C99
101standard.")
102 (home-page "http://www.tinycc.org/")
5d0bd1fb
TGR
103 ;; An attempt to re-licence tcc under the Expat licence is underway but not
104 ;; (if ever) complete. See the RELICENSING file for more information.
a5e2c9a9 105 (license license:lgpl2.1+)))
9f088725 106
f0316832
RW
107(define-public pcc
108 (package
109 (name "pcc")
110 (version "20170109")
111 (source (origin
112 (method url-fetch)
113 (uri (string-append "http://pcc.ludd.ltu.se/ftp/pub/pcc/pcc-"
114 version ".tgz"))
115 (sha256
116 (base32
117 "1p34w496095mi0473f815w6wbi57zxil106mg7pj6sg6gzpjcgww"))))
118 (build-system gnu-build-system)
119 (arguments
120 `(#:phases
121 (modify-phases %standard-phases
122 (replace 'check
9c30cba4 123 (lambda _ (invoke "make" "-C" "cc/cpp" "test") #t)))))
f0316832
RW
124 (native-inputs
125 `(("bison" ,bison)
126 ("flex" ,flex)))
127 (synopsis "Portable C compiler")
128 (description
129 "PCC is a portable C compiler. The project goal is to write a C99
130compiler while still keeping it small, simple, fast and understandable.")
131 (home-page "http://pcc.ludd.ltu.se")
6a052473 132 (supported-systems (delete "aarch64-linux" %supported-systems))
f0316832
RW
133 ;; PCC incorporates code under various BSD licenses; for new code bsd-2 is
134 ;; preferred. See http://pcc.ludd.ltu.se/licenses/ for more details.
135 (license (list license:bsd-2 license:bsd-3))))
c229fb3d
PN
136
137(define-public libbytesize
138 (package
139 (name "libbytesize")
e48390cb 140 (version "2.2")
c229fb3d
PN
141 (source (origin
142 (method url-fetch)
143 (uri (string-append
94617bdd
TGR
144 "https://github.com/storaged-project/libbytesize/releases/"
145 "download/" version "/libbytesize-" version ".tar.gz"))
c229fb3d
PN
146 (sha256
147 (base32
e48390cb 148 "1aivwypmnqcaj2230pifvf3jcgl5chja8rspkxf0j3480asm8g5r"))))
c229fb3d 149 (build-system gnu-build-system)
bf6859e4 150 (arguments
2414997a 151 `(#:tests? #f))
c229fb3d
PN
152 (native-inputs
153 `(("gettext" ,gettext-minimal)
154 ("pkg-config" ,pkg-config)
155 ("python" ,python)))
156 (inputs
157 `(("mpfr" ,mpfr)
2414997a 158 ("pcre2" ,pcre2)))
c229fb3d
PN
159 (home-page "https://github.com/storaged-project/libbytesize")
160 (synopsis "Tiny C library for working with arbitrary big sizes in bytes")
161 (description
162 "The goal of this project is to provide a tiny library that would
163facilitate the common operations with sizes in bytes. Many projects need to
164work with sizes in bytes (be it sizes of storage space, memory...) and all of
165them need to deal with the same issues like:
166
167@itemize
168@item How to get a human-readable string for the given size?
169@item How to store the given size so that no significant information is lost?
170@item If we store the size in bytes, what if the given size gets over the
171MAXUINT64 value?
172@item How to interpret sizes entered by users according to their locale and
173typing conventions?
174@item How to deal with the decimal/binary units (MB versus MiB) ambiguity?
175@end itemize
176
177@code{libbytesize} offers a generally usable solution that could be used by
178every project that needs to deal with sizes in bytes. It is written in the C
179language with thin bindings for other languages.")
180 (license license:lgpl2.1+)))
011ec1e5
RW
181
182(define-public udunits
183 (package
184 (name "udunits")
185 (version "2.2.26")
186 (source (origin
187 (method url-fetch)
188 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/udunits/"
189 "udunits-" version ".tar.gz"))
190 (sha256
191 (base32
192 "0v9mqw4drnkzkm57331ail6yvs9485jmi37s40lhvmf7r5lli3rn"))))
193 (build-system gnu-build-system)
194 (inputs
195 `(("expat" ,expat)))
196 (home-page "https://www.unidata.ucar.edu/software/udunits/")
197 (synopsis "C library for units of physical quantities and value-conversion utils")
198 (description
199 "The UDUNITS-2 package provides support for units of physical quantities.
200Its three main components are:
201
202@enumerate
203@item @code{udunits2lib}, a C library for units of physical quantities;
204@item @code{udunits2prog}, a utility for obtaining the definition of a unit
205 and for converting numeric values between compatible units; and
206@item an extensive database of units.
207@end enumerate\n")
208 ;; Like the BSD-3 license but with an extra anti patent clause.
209 (license (license:non-copyleft "file://COPYRIGHT"))))
07592c77
PN
210
211(define-public libfixposix
212 (package
213 (name "libfixposix")
214 (version "0.4.3")
215 (home-page "https://github.com/sionescu/libfixposix")
216 (source
217 (origin
218 (method git-fetch)
219 (uri (git-reference
220 (url home-page)
221 (commit (string-append "v" version))))
222 (file-name (git-file-name name version))
223 (sha256
224 (base32
225 "1x4q6yspi5g2s98vq4qszw4z3zjgk9l5zs8471w4d4cs6l97w08j"))))
226 (build-system gnu-build-system)
227 (native-inputs
228 `(("autoconf" ,autoconf)
229 ("automake" ,automake)
230 ("libtool" ,libtool)
231 ("pkg-config" ,pkg-config)
232 ("check" ,check)))
233 (synopsis "Thin wrapper over POSIX syscalls")
234 (description
235 "The purpose of libfixposix is to offer replacements for parts of POSIX
236whose behaviour is inconsistent across *NIX flavours.")
237 (license license:boost1.0)))
f170603e
GLV
238
239(define-public libhx
240 (package
241 (name "libhx")
d9a7102c 242 (version "3.25")
f170603e
GLV
243 (source
244 (origin
245 (method url-fetch)
246 (uri (string-append "mirror://sourceforge/libhx/libHX/"
247 "libHX-" version ".tar.xz"))
248 (sha256
d9a7102c 249 (base32 "12avn16f8aqb0cq6jplz0sv7rh6f07m85dwc8dasnnwsvijwbpbj"))))
f170603e
GLV
250 (build-system gnu-build-system)
251 (home-page "http://libhx.sourceforge.net")
252 (synopsis "C library with common data structures and functions")
253 (description
254 "This is a C library (with some C++ bindings available) that provides data
255structures and functions commonly needed, such as maps, deques, linked lists,
256string formatting and autoresizing, option and config file parsing, type
257checking casts and more.")
258 (license license:lgpl2.1+)))
7adb5299 259
d1c6b097
MB
260(define-public packcc
261 (package
262 (name "packcc")
263 ;; We need a few fixes on top of the latest release to prevent test
264 ;; failures in Universal Ctags.
265 (version "1.2.5-19-g58d1b9d")
266 (home-page "https://github.com/enechaev/packcc")
267 (source (origin
268 (method git-fetch)
269 (uri (git-reference
270 (url home-page)
271 (commit (string-append "v" version))))
272 (file-name (git-file-name name version))
273 (sha256
274 (base32
275 "0biyv835jlk43fvmmd3p8jafs7k2iw9qlaj37hvsl604ai6rd5aj"))))
276 (build-system gnu-build-system)
277 (arguments
278 '(#:tests? #f ;no tests
279 #:make-flags '("-DUSE_SYSTEM_STRNLEN=1")
280 #:phases (modify-phases %standard-phases
281 ;; The project consists of a single source file and has
282 ;; no actual build system, so we need to do it manually.
283 (delete 'configure)
284 (replace 'build
285 (lambda* (#:key make-flags #:allow-other-keys)
286 (apply invoke "gcc" "-o" "packcc" "packcc.c"
287 make-flags)))
288 (replace 'install
289 (lambda* (#:key outputs #:allow-other-keys)
290 (let ((out (assoc-ref outputs "out")))
291 (install-file "packcc" (string-append out "/bin"))
292 (install-file "README.md"
293 (string-append out "/share/doc/packcc"))
294 #t))))))
295 (synopsis "Packrat parser generator for C")
296 (description
297 "PackCC is a packrat parser generator for the C programming language.
298Its main features are:
299@itemize
300@item Generates a parser in C from a grammar described in a PEG.
301@item Gives your parser great efficiency by packrat parsing.
302@item Supports direct and indirect left-recursive grammar rules.
303@end itemize
304The grammar of your parser can be described in a @acronym{PEG, Parsing
305Expression Grammar}. The PEG is a top-down parsing language, and is similar
306to the regular-expression grammar. The PEG does not require tokenization to
307be a separate step, and tokenization rules can be written in the same way as
308any other grammar rules.")
309 (license license:expat)))
310
7adb5299
JN
311(define-public sparse
312 (package
313 (name "sparse")
b3808d1f 314 (version "0.6.2")
7adb5299
JN
315 (source (origin
316 (method url-fetch)
317 (uri
318 (string-append "mirror://kernel.org/software/devel/sparse/dist/"
319 "sparse-" version ".tar.xz"))
320 (sha256
321 (base32
b3808d1f 322 "1z11chawwcmf5xxx5v52cj7wrr3warz6q5wlcjvxpif1jbga172i"))))
7adb5299
JN
323 (build-system gnu-build-system)
324 (inputs `(("perl" ,perl)))
325 (arguments
326 '(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out")))
327 #:phases (modify-phases %standard-phases
328 (delete 'configure)
329 (add-after 'unpack 'patch-cgcc
330 (lambda _
331 (substitute* "cgcc"
332 (("'cc'") (string-append "'" (which "gcc") "'")))
333 #t)))))
334 (synopsis "Semantic C parser for Linux development")
335 (description
336 "Sparse is a semantic parser for C and is required for Linux development.
337It provides a compiler frontend capable of parsing most of ANSI C as well as
338many GCC extensions, and a collection of sample compiler backends, including a
339static analyzer also called @file{sparse}. Sparse provides a set of
340annotations designed to convey semantic information about types, such as what
341address space pointers point to, or what locks a function acquires or
342releases.")
343 (home-page "https://sparse.wiki.kernel.org/index.php/Main_Page")
344 (license license:expat)))
70a49ef7
KCB
345
346(define-public libestr
347 (package
348 (name "libestr")
349 (version "0.1.11")
350 (source
351 (origin
352 (method git-fetch)
353 (uri (git-reference
b0e7b699 354 (url "https://github.com/rsyslog/libestr")
70a49ef7
KCB
355 (commit (string-append "v" version))))
356 (file-name (git-file-name name version))
357 (sha256
358 (base32
359 "1ca4rj90c0dn7kqpbcchkflxjw88a7rxcnwbr0gply4a28i01nd8"))))
360 (build-system gnu-build-system)
361 (arguments
362 `(#:phases
363 (modify-phases %standard-phases
364 ;; autogen.sh calls configure at the end of the script.
365 (replace 'bootstrap
366 (lambda _ (invoke "autoreconf" "-vfi"))))))
367 (native-inputs
368 `(("autoconf" ,autoconf)
369 ("automake" ,automake)
370 ("pkg-config" ,pkg-config)
371 ("libtool" ,libtool)))
372 (home-page "https://github.com/rsyslog/libestr")
373 (synopsis "Helper functions for handling strings")
374 (description
375 "This C library contains some essential string manipulation functions and
376more, like escaping special characters.")
377 (license license:lgpl2.1+)))
0aee6e51
KCB
378
379(define-public libfastjson
380 (package
381 (name "libfastjson")
382 (version "0.99.8")
383 (source
384 (origin
385 (method git-fetch)
386 (uri (git-reference
b0e7b699 387 (url "https://github.com/rsyslog/libfastjson")
0aee6e51
KCB
388 (commit (string-append "v" version))))
389 (file-name (git-file-name name version))
390 (sha256
391 (base32
392 "0qhs0g9slj3p0v2z4s3cnsx44msrlb4k78ljg7714qiziqbrbwyl"))))
393 (build-system gnu-build-system)
394 (native-inputs
395 `(("autoconf" ,autoconf)
396 ("automake" ,automake)
397 ("libtool" ,libtool)))
398 (home-page "https://github.com/rsyslog/libfastjson")
399 (synopsis "Fast JSON library for C")
400 (description
401 "libfastjson is a fork from json-c aiming to provide: a small library
402with essential JSON handling functions, sufficiently good JSON support (not
403100% standards compliant), and very fast processing.")
404 (license license:expat)))
7def5056
KCB
405
406(define-public liblogging
407 (package
408 (name "liblogging")
409 (version "1.0.6")
410 (source
411 (origin
412 (method git-fetch)
413 (uri (git-reference
b0e7b699 414 (url "https://github.com/rsyslog/liblogging")
7def5056
KCB
415 (commit (string-append "v" version))))
416 (file-name (git-file-name name version))
417 (sha256
418 (base32
419 "1l32m0y65svf5vxsgw935jnqs6842rcqr56dmzwqvr00yfrjhjkp"))))
420 (build-system gnu-build-system)
421 (arguments
422 `(#:phases
423 (modify-phases %standard-phases
424 ;; autogen.sh calls configure at the end of the script.
425 (replace 'bootstrap
426 (lambda _ (invoke "autoreconf" "-vfi"))))))
427 (native-inputs
428 `(("autoconf" ,autoconf)
429 ("automake" ,automake)
430 ("pkg-config" ,pkg-config)
431 ("libtool" ,libtool)
432 ;; For rst2man.py
433 ("python-docutils" ,python-docutils)))
434 (home-page "https://github.com/rsyslog/liblogging")
435 (synopsis "Easy to use and lightweight signal-safe logging library")
436 (description
437 "Liblogging is an easy to use library for logging. It offers an enhanced
438replacement for the syslog() call, but retains its ease of use.")
439 (license license:bsd-2)))
5bc13b8e
MC
440
441(define-public unifdef
442 (package
443 (name "unifdef")
444 (version "2.12")
445 (source (origin
446 (method url-fetch)
447 ;; https://dotat.at/prog/unifdef/unifdef-2.12.tar.xz
448 (uri (string-append "https://dotat.at/prog/" name "/"
449 name "-" version ".tar.xz"))
450 (sha256
451 (base32
452 "00647bp3m9n01ck6ilw6r24fk4mivmimamvm4hxp5p6wxh10zkj3"))
453 (modules '((guix build utils)))
454 (snippet
455 '(begin (delete-file-recursively "FreeBSD")
456 (delete-file-recursively "win32")
457 #t))))
458 (build-system gnu-build-system)
459 (arguments
460 `(#:phases (modify-phases %standard-phases
461 (delete 'configure))
462 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
463 #:tests? #f)) ;no test suite
464 (native-inputs
465 `(("perl" ,perl)))
466 (home-page "https://dotat.at/prog/unifdef/")
467 (synopsis "Utility to selectively processes conditional C preprocessor")
468 (description "The @command{unifdef} utility selectively processes
469conditional C preprocessor @code{#if} and @code{#ifdef} directives. It
470removes from a file both the directives and the additional text that they
471delimit, while otherwise leaving the file alone. It can be useful for
472avoiding distractions when studying code that uses @code{#ifdef} heavily for
473portability.")
474 (license (list license:bsd-2 ;all files except...
475 license:bsd-3)))) ;...the unidef.1 manual page