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 bootstrap)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages flex)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages guile)
46 #:use-module (gnu packages lua)
47 #:use-module (gnu packages multiprecision)
48 #:use-module (gnu packages pcre)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages python-xyz)
51 #:use-module (gnu packages autotools)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages xml))
58 (name "tcc") ;aka. "tinycc"
62 (uri (string-append "mirror://savannah/tinycc/tcc-"
66 "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
67 (build-system gnu-build-system)
68 (native-inputs `(("perl" ,perl)
69 ("texinfo" ,texinfo)))
71 `(#:configure-flags (list (string-append "--elfinterp="
72 (assoc-ref %build-inputs "libc")
73 ,(glibc-dynamic-linker))
74 (string-append "--crtprefix="
75 (assoc-ref %build-inputs "libc")
77 (string-append "--sysincludepaths="
78 (assoc-ref %build-inputs "libc")
80 (assoc-ref %build-inputs
82 "/include:{B}/include")
83 (string-append "--libpaths="
84 (assoc-ref %build-inputs "libc")
86 ,@(if (string-prefix? "armhf-linux"
87 (or (%current-target-system)
89 `("--triplet=arm-linux-gnueabihf")
91 #:test-target "test"))
93 (list (search-path-specification
96 (search-path-specification
97 (variable "LIBRARY_PATH")
98 (files '("lib" "lib64")))))
99 ;; Fails to build on MIPS: "Unsupported CPU"
100 (supported-systems (delete "mips64el-linux" %supported-systems))
101 (synopsis "Tiny and fast C compiler")
103 "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
104 written in C. It supports ANSI C with GNU and extensions and most of the C99
106 (home-page "http://www.tinycc.org/")
107 ;; An attempt to re-licence tcc under the Expat licence is underway but not
108 ;; (if ever) complete. See the RELICENSING file for more information.
109 (license license:lgpl2.1+)))
117 (uri (string-append "http://pcc.ludd.ltu.se/ftp/pub/pcc/pcc-"
121 "1p34w496095mi0473f815w6wbi57zxil106mg7pj6sg6gzpjcgww"))))
122 (build-system gnu-build-system)
125 (modify-phases %standard-phases
127 (lambda _ (invoke "make" "-C" "cc/cpp" "test") #t)))))
131 (synopsis "Portable C compiler")
133 "PCC is a portable C compiler. The project goal is to write a C99
134 compiler while still keeping it small, simple, fast and understandable.")
135 (home-page "http://pcc.ludd.ltu.se")
136 (supported-systems (delete "aarch64-linux" %supported-systems))
137 ;; PCC incorporates code under various BSD licenses; for new code bsd-2 is
138 ;; preferred. See http://pcc.ludd.ltu.se/licenses/ for more details.
139 (license (list license:bsd-2 license:bsd-3))))
141 (define-public libbytesize
148 "https://github.com/storaged-project/libbytesize/releases/"
149 "download/" version "/libbytesize-" version ".tar.gz"))
152 "1aivwypmnqcaj2230pifvf3jcgl5chja8rspkxf0j3480asm8g5r"))))
153 (build-system gnu-build-system)
157 `(("gettext" ,gettext-minimal)
158 ("pkg-config" ,pkg-config)
163 (home-page "https://github.com/storaged-project/libbytesize")
164 (synopsis "Tiny C library for working with arbitrary big sizes in bytes")
166 "The goal of this project is to provide a tiny library that would
167 facilitate the common operations with sizes in bytes. Many projects need to
168 work with sizes in bytes (be it sizes of storage space, memory...) and all of
169 them need to deal with the same issues like:
172 @item How to get a human-readable string for the given size?
173 @item How to store the given size so that no significant information is lost?
174 @item If we store the size in bytes, what if the given size gets over the
176 @item How to interpret sizes entered by users according to their locale and
178 @item How to deal with the decimal/binary units (MB versus MiB) ambiguity?
181 @code{libbytesize} offers a generally usable solution that could be used by
182 every project that needs to deal with sizes in bytes. It is written in the C
183 language with thin bindings for other languages.")
184 (license license:lgpl2.1+)))
186 (define-public udunits
189 ;; Four-part version numbers are development snapshots, not releases. See
190 ;; <https://github.com/Unidata/UDUNITS-2/issues/99#issuecomment-732323472>.
194 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/udunits/"
195 "udunits-" version ".tar.gz"))
198 "0v9mqw4drnkzkm57331ail6yvs9485jmi37s40lhvmf7r5lli3rn"))))
199 (build-system gnu-build-system)
202 (home-page "https://www.unidata.ucar.edu/software/udunits/")
203 (synopsis "C library for units of physical quantities and value-conversion utils")
205 "The UDUNITS-2 package provides support for units of physical quantities.
206 Its three main components are:
209 @item @code{udunits2lib}, a C library for units of physical quantities;
210 @item @code{udunits2prog}, a utility for obtaining the definition of a unit
211 and for converting numeric values between compatible units; and
212 @item an extensive database of units.
214 ;; Like the BSD-3 license but with an extra anti patent clause.
215 (license (license:non-copyleft "file://COPYRIGHT"))))
217 (define-public libfixposix
221 (home-page "https://github.com/sionescu/libfixposix")
227 (commit (string-append "v" version))))
228 (file-name (git-file-name name version))
231 "1x4q6yspi5g2s98vq4qszw4z3zjgk9l5zs8471w4d4cs6l97w08j"))))
232 (build-system gnu-build-system)
234 `(("autoconf" ,autoconf)
235 ("automake" ,automake)
237 ("pkg-config" ,pkg-config)
239 (synopsis "Thin wrapper over POSIX syscalls")
241 "The purpose of libfixposix is to offer replacements for parts of POSIX
242 whose behaviour is inconsistent across *NIX flavours.")
243 (license license:boost1.0)))
252 (uri (string-append "mirror://sourceforge/libhx/libHX/"
253 "libHX-" version ".tar.xz"))
255 (base32 "12avn16f8aqb0cq6jplz0sv7rh6f07m85dwc8dasnnwsvijwbpbj"))))
256 (build-system gnu-build-system)
257 (home-page "http://libhx.sourceforge.net")
258 (synopsis "C library with common data structures and functions")
260 "This is a C library (with some C++ bindings available) that provides data
261 structures and functions commonly needed, such as maps, deques, linked lists,
262 string formatting and autoresizing, option and config file parsing, type
263 checking casts and more.")
264 (license license:lgpl2.1+)))
266 (define-public libwuya
267 ;; This commit is the one before "wuy_pool.h" was removed from libwuya,
268 ;; which libleak currently requires.
270 (commit "883502041044f4616cfbf75c8f2bb60059f704a9"))
273 (version (git-version "0.0" revision commit))
277 (url "https://github.com/WuBingzheng/libwuya")
279 (file-name (git-file-name name version))
282 "1xrsqbgr13g2v0ag165ryp7xrwzv41xfygzk2a3445ca98c1qpdc"))))
283 (build-system gnu-build-system)
285 `(#:tests? #f ;no test suite
286 #:phases (modify-phases %standard-phases
287 (add-after 'unpack 'patch-lua-includes
289 (substitute* '("wuy_cflua.h" "wuy_cflua.c")
290 (("<lua5\\.1/") "<"))
292 (add-after 'unpack 'add--fPIC-to-CFLAGS
294 (substitute* "Makefile"
295 (("CFLAGS[^\n]*" all)
296 (string-append all " -fPIC")))
298 (add-before 'build 'set-CC
302 (delete 'configure) ;no configure script
304 (lambda* (#:key outputs #:allow-other-keys)
305 (let* ((out (assoc-ref outputs "out"))
306 (include-dir (string-append out "/include"))
307 (headers (find-files "." "\\.h$")))
308 (for-each (lambda (h)
309 (install-file h include-dir))
311 (install-file "libwuya.a" (string-append out "/lib"))
313 (inputs `(("lua" ,lua)))
314 (home-page "https://github.com/WuBingzheng/libwuya/")
315 (synopsis "C library implementing various data structures")
316 (description "The @code{libwuya} library implements data structures such
317 as dictionaries, skip lists, and memory pools.")
318 ;; There is no clear information as to what license this is distributed
319 ;; under, but it is included (bundled) with libleak from the same author
320 ;; under the GNU GPL v2 or later license, so use this here until it is
321 ;; clarified (see: https://github.com/WuBingzheng/libwuya/issues/2).
322 (license license:gpl2+))))
324 (define-public packcc
327 ;; We need a few fixes on top of the latest release to prevent test
328 ;; failures in Universal Ctags.
329 (version "1.2.5-19-g58d1b9d")
330 (home-page "https://github.com/enechaev/packcc")
335 (commit (string-append "v" version))))
336 (file-name (git-file-name name version))
339 "0biyv835jlk43fvmmd3p8jafs7k2iw9qlaj37hvsl604ai6rd5aj"))))
340 (build-system gnu-build-system)
342 '(#:tests? #f ;no tests
343 #:make-flags '("-DUSE_SYSTEM_STRNLEN=1")
344 #:phases (modify-phases %standard-phases
345 ;; The project consists of a single source file and has
346 ;; no actual build system, so we need to do it manually.
349 (lambda* (#:key make-flags #:allow-other-keys)
350 (apply invoke "gcc" "-o" "packcc" "packcc.c"
353 (lambda* (#:key outputs #:allow-other-keys)
354 (let ((out (assoc-ref outputs "out")))
355 (install-file "packcc" (string-append out "/bin"))
356 (install-file "README.md"
357 (string-append out "/share/doc/packcc"))
359 (synopsis "Packrat parser generator for C")
361 "PackCC is a packrat parser generator for the C programming language.
362 Its main features are:
364 @item Generates a parser in C from a grammar described in a PEG.
365 @item Gives your parser great efficiency by packrat parsing.
366 @item Supports direct and indirect left-recursive grammar rules.
368 The grammar of your parser can be described in a @acronym{PEG, Parsing
369 Expression Grammar}. The PEG is a top-down parsing language, and is similar
370 to the regular-expression grammar. The PEG does not require tokenization to
371 be a separate step, and tokenization rules can be written in the same way as
372 any other grammar rules.")
373 (license license:expat)))
375 (define-public sparse
382 (string-append "mirror://kernel.org/software/devel/sparse/dist/"
383 "sparse-" version ".tar.xz"))
386 "16d8c4dhipjzjf8z4z7pix1pdpqydz0v4r7i345f5s09hjnxpxnl"))))
387 (build-system gnu-build-system)
388 (inputs `(("perl" ,perl)))
390 '(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out")))
391 #:phases (modify-phases %standard-phases
393 (add-after 'unpack 'patch-cgcc
396 (("'cc'") (string-append "'" (which "gcc") "'")))
398 (synopsis "Semantic C parser for Linux development")
400 "Sparse is a semantic parser for C and is required for Linux development.
401 It provides a compiler frontend capable of parsing most of ANSI C as well as
402 many GCC extensions, and a collection of sample compiler backends, including a
403 static analyzer also called @file{sparse}. Sparse provides a set of
404 annotations designed to convey semantic information about types, such as what
405 address space pointers point to, or what locks a function acquires or
407 (home-page "https://sparse.wiki.kernel.org/index.php/Main_Page")
408 (license license:expat)))
410 (define-public libestr
418 (url "https://github.com/rsyslog/libestr")
419 (commit (string-append "v" version))))
420 (file-name (git-file-name name version))
423 "1ca4rj90c0dn7kqpbcchkflxjw88a7rxcnwbr0gply4a28i01nd8"))))
424 (build-system gnu-build-system)
427 (modify-phases %standard-phases
428 ;; autogen.sh calls configure at the end of the script.
430 (lambda _ (invoke "autoreconf" "-vfi"))))))
432 `(("autoconf" ,autoconf)
433 ("automake" ,automake)
434 ("pkg-config" ,pkg-config)
435 ("libtool" ,libtool)))
436 (home-page "https://github.com/rsyslog/libestr")
437 (synopsis "Helper functions for handling strings")
439 "This C library contains some essential string manipulation functions and
440 more, like escaping special characters.")
441 (license license:lgpl2.1+)))
443 (define-public libfastjson
451 (url "https://github.com/rsyslog/libfastjson")
452 (commit (string-append "v" version))))
453 (file-name (git-file-name name version))
456 "0qhs0g9slj3p0v2z4s3cnsx44msrlb4k78ljg7714qiziqbrbwyl"))))
457 (build-system gnu-build-system)
459 `(("autoconf" ,autoconf)
460 ("automake" ,automake)
461 ("libtool" ,libtool)))
462 (home-page "https://github.com/rsyslog/libfastjson")
463 (synopsis "Fast JSON library for C")
465 "libfastjson is a fork from json-c aiming to provide: a small library
466 with essential JSON handling functions, sufficiently good JSON support (not
467 100% standards compliant), and very fast processing.")
468 (license license:expat)))
470 (define-public liblogging
478 (url "https://github.com/rsyslog/liblogging")
479 (commit (string-append "v" version))))
480 (file-name (git-file-name name version))
483 "1l32m0y65svf5vxsgw935jnqs6842rcqr56dmzwqvr00yfrjhjkp"))))
484 (build-system gnu-build-system)
487 (modify-phases %standard-phases
488 ;; autogen.sh calls configure at the end of the script.
490 (lambda _ (invoke "autoreconf" "-vfi"))))))
492 `(("autoconf" ,autoconf)
493 ("automake" ,automake)
494 ("pkg-config" ,pkg-config)
497 ("python-docutils" ,python-docutils)))
498 (home-page "https://github.com/rsyslog/liblogging")
499 (synopsis "Easy to use and lightweight signal-safe logging library")
501 "Liblogging is an easy to use library for logging. It offers an enhanced
502 replacement for the syslog() call, but retains its ease of use.")
503 (license license:bsd-2)))
505 (define-public unifdef
511 ;; https://dotat.at/prog/unifdef/unifdef-2.12.tar.xz
512 (uri (string-append "https://dotat.at/prog/" name "/"
513 name "-" version ".tar.xz"))
516 "00647bp3m9n01ck6ilw6r24fk4mivmimamvm4hxp5p6wxh10zkj3"))
517 (modules '((guix build utils)))
519 '(begin (delete-file-recursively "FreeBSD")
520 (delete-file-recursively "win32")
522 (build-system gnu-build-system)
524 `(#:phases (modify-phases %standard-phases
526 #:make-flags (list (string-append "CC=" ,(cc-for-target))
527 (string-append "prefix=" %output))
528 #:tests? #f)) ;no test suite
531 (home-page "https://dotat.at/prog/unifdef/")
532 (synopsis "Utility to selectively processes conditional C preprocessor")
533 (description "The @command{unifdef} utility selectively processes
534 conditional C preprocessor @code{#if} and @code{#ifdef} directives. It
535 removes from a file both the directives and the additional text that they
536 delimit, while otherwise leaving the file alone. It can be useful for
537 avoiding distractions when studying code that uses @code{#ifdef} heavily for
539 (license (list license:bsd-2 ;all files except...
540 license:bsd-3)))) ;...the unidef.1 manual page
542 (define-public aws-c-common
544 (name "aws-c-common")
549 (url (string-append "https://github.com/awslabs/" name))
550 (commit (string-append "v" version))))
551 (file-name (git-file-name name version))
554 "16bc6fn1gq3nqcrzgpi2kjphq7xkkr73aljakrg89ysm6hyzyim9"))))
555 (build-system cmake-build-system)
556 (synopsis "Amazon Web Services core C library")
558 "This library provides common C99 primitives, configuration, data
559 structures, and error handling for the @acronym{AWS,Amazon Web Services} SDK.")
560 (home-page "https://github.com/awslabs/aws-c-common")
561 (license license:asl2.0)))