1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2018, 2019 Pierre Neidhardt <mail@ambrevar.xyz>
6 ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
8 ;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
9 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
10 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
11 ;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
12 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
13 ;;; Copyright © 2020 Greg Hogan <code@greghogan.com>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages c)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix utils)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system trivial)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages bootstrap)
41 #:use-module (gnu packages bison)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages flex)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages texinfo)
46 #:use-module (gnu packages guile)
47 #:use-module (gnu packages lua)
48 #:use-module (gnu packages multiprecision)
49 #:use-module (gnu packages pcre)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages autotools)
53 #:use-module (gnu packages gettext)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages xml))
59 (name "tcc") ;aka. "tinycc"
63 (uri (string-append "mirror://savannah/tinycc/tcc-"
67 "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
68 (build-system gnu-build-system)
69 (native-inputs `(("perl" ,perl)
70 ("texinfo" ,texinfo)))
72 `(#:configure-flags (list (string-append "--elfinterp="
73 (assoc-ref %build-inputs "libc")
74 ,(glibc-dynamic-linker))
75 (string-append "--crtprefix="
76 (assoc-ref %build-inputs "libc")
78 (string-append "--sysincludepaths="
79 (assoc-ref %build-inputs "libc")
81 (assoc-ref %build-inputs
83 "/include:{B}/include")
84 (string-append "--libpaths="
85 (assoc-ref %build-inputs "libc")
87 ,@(if (string-prefix? "armhf-linux"
88 (or (%current-target-system)
90 `("--triplet=arm-linux-gnueabihf")
92 #:test-target "test"))
94 (list (search-path-specification
97 (search-path-specification
98 (variable "LIBRARY_PATH")
99 (files '("lib" "lib64")))))
100 ;; Fails to build on MIPS: "Unsupported CPU"
101 (supported-systems (delete "mips64el-linux" %supported-systems))
102 (synopsis "Tiny and fast C compiler")
104 "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
105 written in C. It supports ANSI C with GNU and extensions and most of the C99
107 (home-page "http://www.tinycc.org/")
108 ;; An attempt to re-licence tcc under the Expat licence is underway but not
109 ;; (if ever) complete. See the RELICENSING file for more information.
110 (license license:lgpl2.1+)))
118 (uri (string-append "http://pcc.ludd.ltu.se/ftp/pub/pcc/pcc-"
122 "1p34w496095mi0473f815w6wbi57zxil106mg7pj6sg6gzpjcgww"))))
123 (build-system gnu-build-system)
126 (modify-phases %standard-phases
128 (lambda _ (invoke "make" "-C" "cc/cpp" "test") #t)))))
132 (synopsis "Portable C compiler")
134 "PCC is a portable C compiler. The project goal is to write a C99
135 compiler while still keeping it small, simple, fast and understandable.")
136 (home-page "http://pcc.ludd.ltu.se")
137 (supported-systems (delete "aarch64-linux" %supported-systems))
138 ;; PCC incorporates code under various BSD licenses; for new code bsd-2 is
139 ;; preferred. See http://pcc.ludd.ltu.se/licenses/ for more details.
140 (license (list license:bsd-2 license:bsd-3))))
142 (define-public libbytesize
149 "https://github.com/storaged-project/libbytesize/releases/"
150 "download/" version "/libbytesize-" version ".tar.gz"))
153 "1aivwypmnqcaj2230pifvf3jcgl5chja8rspkxf0j3480asm8g5r"))))
154 (build-system gnu-build-system)
158 `(("gettext" ,gettext-minimal)
159 ("pkg-config" ,pkg-config)
164 (home-page "https://github.com/storaged-project/libbytesize")
165 (synopsis "Tiny C library for working with arbitrary big sizes in bytes")
167 "The goal of this project is to provide a tiny library that would
168 facilitate the common operations with sizes in bytes. Many projects need to
169 work with sizes in bytes (be it sizes of storage space, memory...) and all of
170 them need to deal with the same issues like:
173 @item How to get a human-readable string for the given size?
174 @item How to store the given size so that no significant information is lost?
175 @item If we store the size in bytes, what if the given size gets over the
177 @item How to interpret sizes entered by users according to their locale and
179 @item How to deal with the decimal/binary units (MB versus MiB) ambiguity?
182 @code{libbytesize} offers a generally usable solution that could be used by
183 every project that needs to deal with sizes in bytes. It is written in the C
184 language with thin bindings for other languages.")
185 (license license:lgpl2.1+)))
187 (define-public udunits
190 ;; Four-part version numbers are development snapshots, not releases. See
191 ;; <https://github.com/Unidata/UDUNITS-2/issues/99#issuecomment-732323472>.
195 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/udunits/"
196 "udunits-" version ".tar.gz"))
199 "0v9mqw4drnkzkm57331ail6yvs9485jmi37s40lhvmf7r5lli3rn"))))
200 (build-system gnu-build-system)
203 (home-page "https://www.unidata.ucar.edu/software/udunits/")
204 (synopsis "C library for units of physical quantities and value-conversion utils")
206 "The UDUNITS-2 package provides support for units of physical quantities.
207 Its three main components are:
210 @item @code{udunits2lib}, a C library for units of physical quantities;
211 @item @code{udunits2prog}, a utility for obtaining the definition of a unit
212 and for converting numeric values between compatible units; and
213 @item an extensive database of units.
215 ;; Like the BSD-3 license but with an extra anti patent clause.
216 (license (license:non-copyleft "file://COPYRIGHT"))))
218 (define-public libfixposix
222 (home-page "https://github.com/sionescu/libfixposix")
228 (commit (string-append "v" version))))
229 (file-name (git-file-name name version))
232 "1x4q6yspi5g2s98vq4qszw4z3zjgk9l5zs8471w4d4cs6l97w08j"))))
233 (build-system gnu-build-system)
235 `(("autoconf" ,autoconf)
236 ("automake" ,automake)
238 ("pkg-config" ,pkg-config)
240 (synopsis "Thin wrapper over POSIX syscalls")
242 "The purpose of libfixposix is to offer replacements for parts of POSIX
243 whose behaviour is inconsistent across *NIX flavours.")
244 (license license:boost1.0)))
253 (uri (string-append "mirror://sourceforge/libhx/libHX/"
254 "libHX-" version ".tar.xz"))
256 (base32 "12avn16f8aqb0cq6jplz0sv7rh6f07m85dwc8dasnnwsvijwbpbj"))))
257 (build-system gnu-build-system)
258 (home-page "http://libhx.sourceforge.net")
259 (synopsis "C library with common data structures and functions")
261 "This is a C library (with some C++ bindings available) that provides data
262 structures and functions commonly needed, such as maps, deques, linked lists,
263 string formatting and autoresizing, option and config file parsing, type
264 checking casts and more.")
265 (license license:lgpl2.1+)))
267 (define-public libwuya
268 ;; This commit is the one before "wuy_pool.h" was removed from libwuya,
269 ;; which libleak currently requires.
271 (commit "883502041044f4616cfbf75c8f2bb60059f704a9"))
274 (version (git-version "0.0" revision commit))
278 (url "https://github.com/WuBingzheng/libwuya")
280 (file-name (git-file-name name version))
283 "1xrsqbgr13g2v0ag165ryp7xrwzv41xfygzk2a3445ca98c1qpdc"))))
284 (build-system gnu-build-system)
286 `(#:tests? #f ;no test suite
287 #:phases (modify-phases %standard-phases
288 (add-after 'unpack 'patch-lua-includes
290 (substitute* '("wuy_cflua.h" "wuy_cflua.c")
291 (("<lua5\\.1/") "<"))
293 (add-after 'unpack 'add--fPIC-to-CFLAGS
295 (substitute* "Makefile"
296 (("CFLAGS[^\n]*" all)
297 (string-append all " -fPIC")))
299 (add-before 'build 'set-CC
303 (delete 'configure) ;no configure script
305 (lambda* (#:key outputs #:allow-other-keys)
306 (let* ((out (assoc-ref outputs "out"))
307 (include-dir (string-append out "/include"))
308 (headers (find-files "." "\\.h$")))
309 (for-each (lambda (h)
310 (install-file h include-dir))
312 (install-file "libwuya.a" (string-append out "/lib"))
314 (inputs `(("lua" ,lua)))
315 (home-page "https://github.com/WuBingzheng/libwuya/")
316 (synopsis "C library implementing various data structures")
317 (description "The @code{libwuya} library implements data structures such
318 as dictionaries, skip lists, and memory pools.")
319 ;; There is no clear information as to what license this is distributed
320 ;; under, but it is included (bundled) with libleak from the same author
321 ;; under the GNU GPL v2 or later license, so use this here until it is
322 ;; clarified (see: https://github.com/WuBingzheng/libwuya/issues/2).
323 (license license:gpl2+))))
325 (define-public packcc
328 ;; We need a few fixes on top of the latest release to prevent test
329 ;; failures in Universal Ctags.
330 (version "1.2.5-19-g58d1b9d")
331 (home-page "https://github.com/enechaev/packcc")
336 (commit (string-append "v" version))))
337 (file-name (git-file-name name version))
340 "0biyv835jlk43fvmmd3p8jafs7k2iw9qlaj37hvsl604ai6rd5aj"))))
341 (build-system gnu-build-system)
343 '(#:tests? #f ;no tests
344 #:make-flags '("-DUSE_SYSTEM_STRNLEN=1")
345 #:phases (modify-phases %standard-phases
346 ;; The project consists of a single source file and has
347 ;; no actual build system, so we need to do it manually.
350 (lambda* (#:key make-flags #:allow-other-keys)
351 (apply invoke "gcc" "-o" "packcc" "packcc.c"
354 (lambda* (#:key outputs #:allow-other-keys)
355 (let ((out (assoc-ref outputs "out")))
356 (install-file "packcc" (string-append out "/bin"))
357 (install-file "README.md"
358 (string-append out "/share/doc/packcc"))
360 (synopsis "Packrat parser generator for C")
362 "PackCC is a packrat parser generator for the C programming language.
363 Its main features are:
365 @item Generates a parser in C from a grammar described in a PEG.
366 @item Gives your parser great efficiency by packrat parsing.
367 @item Supports direct and indirect left-recursive grammar rules.
369 The grammar of your parser can be described in a @acronym{PEG, Parsing
370 Expression Grammar}. The PEG is a top-down parsing language, and is similar
371 to the regular-expression grammar. The PEG does not require tokenization to
372 be a separate step, and tokenization rules can be written in the same way as
373 any other grammar rules.")
374 (license license:expat)))
376 (define-public sparse
383 (string-append "mirror://kernel.org/software/devel/sparse/dist/"
384 "sparse-" version ".tar.xz"))
387 "16d8c4dhipjzjf8z4z7pix1pdpqydz0v4r7i345f5s09hjnxpxnl"))))
388 (build-system gnu-build-system)
389 (inputs `(("perl" ,perl)))
391 '(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out")))
392 #:phases (modify-phases %standard-phases
394 (add-after 'unpack 'patch-cgcc
397 (("'cc'") (string-append "'" (which "gcc") "'")))
399 (synopsis "Semantic C parser for Linux development")
401 "Sparse is a semantic parser for C and is required for Linux development.
402 It provides a compiler frontend capable of parsing most of ANSI C as well as
403 many GCC extensions, and a collection of sample compiler backends, including a
404 static analyzer also called @file{sparse}. Sparse provides a set of
405 annotations designed to convey semantic information about types, such as what
406 address space pointers point to, or what locks a function acquires or
408 (home-page "https://sparse.wiki.kernel.org/index.php/Main_Page")
409 (license license:expat)))
411 (define-public libestr
419 (url "https://github.com/rsyslog/libestr")
420 (commit (string-append "v" version))))
421 (file-name (git-file-name name version))
424 "1ca4rj90c0dn7kqpbcchkflxjw88a7rxcnwbr0gply4a28i01nd8"))))
425 (build-system gnu-build-system)
428 (modify-phases %standard-phases
429 ;; autogen.sh calls configure at the end of the script.
431 (lambda _ (invoke "autoreconf" "-vfi"))))))
433 `(("autoconf" ,autoconf)
434 ("automake" ,automake)
435 ("pkg-config" ,pkg-config)
436 ("libtool" ,libtool)))
437 (home-page "https://github.com/rsyslog/libestr")
438 (synopsis "Helper functions for handling strings")
440 "This C library contains some essential string manipulation functions and
441 more, like escaping special characters.")
442 (license license:lgpl2.1+)))
444 (define-public libfastjson
452 (url "https://github.com/rsyslog/libfastjson")
453 (commit (string-append "v" version))))
454 (file-name (git-file-name name version))
457 "0qhs0g9slj3p0v2z4s3cnsx44msrlb4k78ljg7714qiziqbrbwyl"))))
458 (build-system gnu-build-system)
460 `(("autoconf" ,autoconf)
461 ("automake" ,automake)
462 ("libtool" ,libtool)))
463 (home-page "https://github.com/rsyslog/libfastjson")
464 (synopsis "Fast JSON library for C")
466 "libfastjson is a fork from json-c aiming to provide: a small library
467 with essential JSON handling functions, sufficiently good JSON support (not
468 100% standards compliant), and very fast processing.")
469 (license license:expat)))
471 (define-public liblogging
479 (url "https://github.com/rsyslog/liblogging")
480 (commit (string-append "v" version))))
481 (file-name (git-file-name name version))
484 "1l32m0y65svf5vxsgw935jnqs6842rcqr56dmzwqvr00yfrjhjkp"))))
485 (build-system gnu-build-system)
488 (modify-phases %standard-phases
489 ;; autogen.sh calls configure at the end of the script.
491 (lambda _ (invoke "autoreconf" "-vfi"))))))
493 `(("autoconf" ,autoconf)
494 ("automake" ,automake)
495 ("pkg-config" ,pkg-config)
498 ("python-docutils" ,python-docutils)))
499 (home-page "https://github.com/rsyslog/liblogging")
500 (synopsis "Easy to use and lightweight signal-safe logging library")
502 "Liblogging is an easy to use library for logging. It offers an enhanced
503 replacement for the syslog() call, but retains its ease of use.")
504 (license license:bsd-2)))
506 (define-public unifdef
512 ;; https://dotat.at/prog/unifdef/unifdef-2.12.tar.xz
513 (uri (string-append "https://dotat.at/prog/" name "/"
514 name "-" version ".tar.xz"))
517 "00647bp3m9n01ck6ilw6r24fk4mivmimamvm4hxp5p6wxh10zkj3"))
518 (modules '((guix build utils)))
520 '(begin (delete-file-recursively "FreeBSD")
521 (delete-file-recursively "win32")
523 (build-system gnu-build-system)
525 `(#:phases (modify-phases %standard-phases
527 #:make-flags (list (string-append "CC=" ,(cc-for-target))
528 (string-append "prefix=" %output))
529 #:tests? #f)) ;no test suite
532 (home-page "https://dotat.at/prog/unifdef/")
533 (synopsis "Utility to selectively processes conditional C preprocessor")
534 (description "The @command{unifdef} utility selectively processes
535 conditional C preprocessor @code{#if} and @code{#ifdef} directives. It
536 removes from a file both the directives and the additional text that they
537 delimit, while otherwise leaving the file alone. It can be useful for
538 avoiding distractions when studying code that uses @code{#ifdef} heavily for
540 (license (list license:bsd-2 ;all files except...
541 license:bsd-3)))) ;...the unidef.1 manual page
543 (define-public aws-c-common
545 (name "aws-c-common")
550 (url (string-append "https://github.com/awslabs/" name))
551 (commit (string-append "v" version))))
552 (file-name (git-file-name name version))
555 "16bc6fn1gq3nqcrzgpi2kjphq7xkkr73aljakrg89ysm6hyzyim9"))))
556 (build-system cmake-build-system)
557 (synopsis "Amazon Web Services core C library")
559 "This library provides common C99 primitives, configuration, data
560 structures, and error handling for the @acronym{AWS,Amazon Web Services} SDK.")
561 (home-page "https://github.com/awslabs/aws-c-common")
562 (license license:asl2.0)))
564 (define-public aws-checksums
566 (name "aws-checksums")
571 (url (string-append "https://github.com/awslabs/" name))
572 (commit (string-append "v" version))))
573 (file-name (git-file-name name version))
576 "1f9scl5734pgjlsixspwljrrlndzhllwlfygdcr1gx5p0za08zjb"))
577 (patches (search-patches "aws-checksums-cmake-prefix.patch"))))
578 (build-system cmake-build-system)
580 `(("aws-c-common" ,aws-c-common)))
581 (synopsis "Amazon Web Services checksum library")
583 "This library provides cross-Platform hardware accelerated CRC32c and CRC32
584 with fallback to efficient C99 software implementations.")
585 (home-page "https://github.com/awslabs/aws-checksums")
586 (license license:asl2.0)))
588 (define-public aws-c-event-stream
590 (name "aws-c-event-stream")
595 (url (string-append "https://github.com/awslabs/" name))
596 (commit (string-append "v" version))))
597 (file-name (git-file-name name version))
600 "1vl9ainc4klv0g9gk1iv4833bsllni6jxn6mwb0fnv2dnlz7zv9q"))
601 (patches (search-patches "aws-c-event-stream-cmake-prefix.patch"))))
602 (build-system cmake-build-system)
604 `(("aws-c-common" ,aws-c-common)))
606 `(("aws-checksums" ,aws-checksums)))
607 (synopsis "Amazon Web Services client-server message format library")
609 "This library is a C99 implementation for @acronym{AWS,Amazon Web Services}
610 event stream encoding, a binary format for bidirectional client-server
612 (home-page "https://github.com/awslabs/aws-c-event-stream")
613 (license license:asl2.0)))