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 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>
14 ;;; This file is part of GNU Guix.
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.
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.
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/>.
29 (define-module (gnu packages c)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system trivial)
36 #:use-module (gnu packages bootstrap)
37 #:use-module (gnu packages bison)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages texinfo)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages multiprecision)
44 #:use-module (gnu packages pcre)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages python-xyz)
47 #:use-module (gnu packages autotools)
48 #:use-module (gnu packages gettext)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages xml))
54 (name "tcc") ;aka. "tinycc"
58 (uri (string-append "mirror://savannah/tinycc/tcc-"
62 "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
63 (build-system gnu-build-system)
64 (native-inputs `(("perl" ,perl)
65 ("texinfo" ,texinfo)))
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")
73 (string-append "--sysincludepaths="
74 (assoc-ref %build-inputs "libc")
76 (assoc-ref %build-inputs
78 "/include:{B}/include")
79 (string-append "--libpaths="
80 (assoc-ref %build-inputs "libc")
82 ,@(if (string-prefix? "armhf-linux"
83 (or (%current-target-system)
85 `("--triplet=arm-linux-gnueabihf")
87 #:test-target "test"))
89 (list (search-path-specification
92 (search-path-specification
93 (variable "LIBRARY_PATH")
94 (files '("lib" "lib64")))))
95 ;; Fails to build on MIPS: "Unsupported CPU"
96 (supported-systems (delete "mips64el-linux" %supported-systems))
97 (synopsis "Tiny and fast C compiler")
99 "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
100 written in C. It supports ANSI C with GNU and extensions and most of the C99
102 (home-page "http://www.tinycc.org/")
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.
105 (license license:lgpl2.1+)))
113 (uri (string-append "http://pcc.ludd.ltu.se/ftp/pub/pcc/pcc-"
117 "1p34w496095mi0473f815w6wbi57zxil106mg7pj6sg6gzpjcgww"))))
118 (build-system gnu-build-system)
121 (modify-phases %standard-phases
123 (lambda _ (invoke "make" "-C" "cc/cpp" "test") #t)))))
127 (synopsis "Portable C compiler")
129 "PCC is a portable C compiler. The project goal is to write a C99
130 compiler while still keeping it small, simple, fast and understandable.")
131 (home-page "http://pcc.ludd.ltu.se")
132 (supported-systems (delete "aarch64-linux" %supported-systems))
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))))
137 (define-public libbytesize
144 "https://github.com/storaged-project/libbytesize/releases/"
145 "download/" version "/libbytesize-" version ".tar.gz"))
148 "1aivwypmnqcaj2230pifvf3jcgl5chja8rspkxf0j3480asm8g5r"))))
149 (build-system gnu-build-system)
153 `(("gettext" ,gettext-minimal)
154 ("pkg-config" ,pkg-config)
159 (home-page "https://github.com/storaged-project/libbytesize")
160 (synopsis "Tiny C library for working with arbitrary big sizes in bytes")
162 "The goal of this project is to provide a tiny library that would
163 facilitate the common operations with sizes in bytes. Many projects need to
164 work with sizes in bytes (be it sizes of storage space, memory...) and all of
165 them need to deal with the same issues like:
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
172 @item How to interpret sizes entered by users according to their locale and
174 @item How to deal with the decimal/binary units (MB versus MiB) ambiguity?
177 @code{libbytesize} offers a generally usable solution that could be used by
178 every project that needs to deal with sizes in bytes. It is written in the C
179 language with thin bindings for other languages.")
180 (license license:lgpl2.1+)))
182 (define-public udunits
188 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/udunits/"
189 "udunits-" version ".tar.gz"))
192 "0v9mqw4drnkzkm57331ail6yvs9485jmi37s40lhvmf7r5lli3rn"))))
193 (build-system gnu-build-system)
196 (home-page "https://www.unidata.ucar.edu/software/udunits/")
197 (synopsis "C library for units of physical quantities and value-conversion utils")
199 "The UDUNITS-2 package provides support for units of physical quantities.
200 Its three main components are:
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.
208 ;; Like the BSD-3 license but with an extra anti patent clause.
209 (license (license:non-copyleft "file://COPYRIGHT"))))
211 (define-public libfixposix
215 (home-page "https://github.com/sionescu/libfixposix")
221 (commit (string-append "v" version))))
222 (file-name (git-file-name name version))
225 "1x4q6yspi5g2s98vq4qszw4z3zjgk9l5zs8471w4d4cs6l97w08j"))))
226 (build-system gnu-build-system)
228 `(("autoconf" ,autoconf)
229 ("automake" ,automake)
231 ("pkg-config" ,pkg-config)
233 (synopsis "Thin wrapper over POSIX syscalls")
235 "The purpose of libfixposix is to offer replacements for parts of POSIX
236 whose behaviour is inconsistent across *NIX flavours.")
237 (license license:boost1.0)))
246 (uri (string-append "mirror://sourceforge/libhx/libHX/"
247 "libHX-" version ".tar.xz"))
249 (base32 "12avn16f8aqb0cq6jplz0sv7rh6f07m85dwc8dasnnwsvijwbpbj"))))
250 (build-system gnu-build-system)
251 (home-page "http://libhx.sourceforge.net")
252 (synopsis "C library with common data structures and functions")
254 "This is a C library (with some C++ bindings available) that provides data
255 structures and functions commonly needed, such as maps, deques, linked lists,
256 string formatting and autoresizing, option and config file parsing, type
257 checking casts and more.")
258 (license license:lgpl2.1+)))
260 (define-public 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")
271 (commit (string-append "v" version))))
272 (file-name (git-file-name name version))
275 "0biyv835jlk43fvmmd3p8jafs7k2iw9qlaj37hvsl604ai6rd5aj"))))
276 (build-system gnu-build-system)
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.
285 (lambda* (#:key make-flags #:allow-other-keys)
286 (apply invoke "gcc" "-o" "packcc" "packcc.c"
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"))
295 (synopsis "Packrat parser generator for C")
297 "PackCC is a packrat parser generator for the C programming language.
298 Its main features are:
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.
304 The grammar of your parser can be described in a @acronym{PEG, Parsing
305 Expression Grammar}. The PEG is a top-down parsing language, and is similar
306 to the regular-expression grammar. The PEG does not require tokenization to
307 be a separate step, and tokenization rules can be written in the same way as
308 any other grammar rules.")
309 (license license:expat)))
311 (define-public sparse
318 (string-append "mirror://kernel.org/software/devel/sparse/dist/"
319 "sparse-" version ".tar.xz"))
322 "1z11chawwcmf5xxx5v52cj7wrr3warz6q5wlcjvxpif1jbga172i"))))
323 (build-system gnu-build-system)
324 (inputs `(("perl" ,perl)))
326 '(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out")))
327 #:phases (modify-phases %standard-phases
329 (add-after 'unpack 'patch-cgcc
332 (("'cc'") (string-append "'" (which "gcc") "'")))
334 (synopsis "Semantic C parser for Linux development")
336 "Sparse is a semantic parser for C and is required for Linux development.
337 It provides a compiler frontend capable of parsing most of ANSI C as well as
338 many GCC extensions, and a collection of sample compiler backends, including a
339 static analyzer also called @file{sparse}. Sparse provides a set of
340 annotations designed to convey semantic information about types, such as what
341 address space pointers point to, or what locks a function acquires or
343 (home-page "https://sparse.wiki.kernel.org/index.php/Main_Page")
344 (license license:expat)))
346 (define-public libestr
354 (url "https://github.com/rsyslog/libestr")
355 (commit (string-append "v" version))))
356 (file-name (git-file-name name version))
359 "1ca4rj90c0dn7kqpbcchkflxjw88a7rxcnwbr0gply4a28i01nd8"))))
360 (build-system gnu-build-system)
363 (modify-phases %standard-phases
364 ;; autogen.sh calls configure at the end of the script.
366 (lambda _ (invoke "autoreconf" "-vfi"))))))
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")
375 "This C library contains some essential string manipulation functions and
376 more, like escaping special characters.")
377 (license license:lgpl2.1+)))
379 (define-public libfastjson
387 (url "https://github.com/rsyslog/libfastjson")
388 (commit (string-append "v" version))))
389 (file-name (git-file-name name version))
392 "0qhs0g9slj3p0v2z4s3cnsx44msrlb4k78ljg7714qiziqbrbwyl"))))
393 (build-system gnu-build-system)
395 `(("autoconf" ,autoconf)
396 ("automake" ,automake)
397 ("libtool" ,libtool)))
398 (home-page "https://github.com/rsyslog/libfastjson")
399 (synopsis "Fast JSON library for C")
401 "libfastjson is a fork from json-c aiming to provide: a small library
402 with essential JSON handling functions, sufficiently good JSON support (not
403 100% standards compliant), and very fast processing.")
404 (license license:expat)))
406 (define-public liblogging
414 (url "https://github.com/rsyslog/liblogging")
415 (commit (string-append "v" version))))
416 (file-name (git-file-name name version))
419 "1l32m0y65svf5vxsgw935jnqs6842rcqr56dmzwqvr00yfrjhjkp"))))
420 (build-system gnu-build-system)
423 (modify-phases %standard-phases
424 ;; autogen.sh calls configure at the end of the script.
426 (lambda _ (invoke "autoreconf" "-vfi"))))))
428 `(("autoconf" ,autoconf)
429 ("automake" ,automake)
430 ("pkg-config" ,pkg-config)
433 ("python-docutils" ,python-docutils)))
434 (home-page "https://github.com/rsyslog/liblogging")
435 (synopsis "Easy to use and lightweight signal-safe logging library")
437 "Liblogging is an easy to use library for logging. It offers an enhanced
438 replacement for the syslog() call, but retains its ease of use.")
439 (license license:bsd-2)))
441 (define-public unifdef
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"))
452 "00647bp3m9n01ck6ilw6r24fk4mivmimamvm4hxp5p6wxh10zkj3"))
453 (modules '((guix build utils)))
455 '(begin (delete-file-recursively "FreeBSD")
456 (delete-file-recursively "win32")
458 (build-system gnu-build-system)
460 `(#:phases (modify-phases %standard-phases
462 #:make-flags (list "CC=gcc" (string-append "prefix=" %output))
463 #:tests? #f)) ;no test suite
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
469 conditional C preprocessor @code{#if} and @code{#ifdef} directives. It
470 removes from a file both the directives and the additional text that they
471 delimit, while otherwise leaving the file alone. It can be useful for
472 avoiding distractions when studying code that uses @code{#ifdef} heavily for
474 (license (list license:bsd-2 ;all files except...
475 license:bsd-3)))) ;...the unidef.1 manual page