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