gnu: Add libpepadapter.
[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>
a5e2c9a9
LC
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages c)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
c229fb3d 31 #:use-module (guix git-download)
a5e2c9a9 32 #:use-module (guix build-system gnu)
9f088725 33 #:use-module (guix build-system trivial)
a5e2c9a9 34 #:use-module (gnu packages bootstrap)
f0316832 35 #:use-module (gnu packages bison)
07592c77 36 #:use-module (gnu packages check)
f0316832 37 #:use-module (gnu packages flex)
a5e2c9a9 38 #:use-module (gnu packages perl)
9f088725 39 #:use-module (gnu packages texinfo)
97b7201f 40 #:use-module (gnu packages guile)
c229fb3d
PN
41 #:use-module (gnu packages multiprecision)
42 #:use-module (gnu packages pcre)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages gettext)
011ec1e5
RW
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages xml))
a5e2c9a9
LC
48
49(define-public tcc
50 (package
51 (name "tcc") ;aka. "tinycc"
5d0bd1fb 52 (version "0.9.27")
a5e2c9a9
LC
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "mirror://savannah/tinycc/tcc-"
56 version ".tar.bz2"))
57 (sha256
58 (base32
5d0bd1fb 59 "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
a5e2c9a9
LC
60 (build-system gnu-build-system)
61 (native-inputs `(("perl" ,perl)
62 ("texinfo" ,texinfo)))
63 (arguments
64 `(#:configure-flags (list (string-append "--elfinterp="
65 (assoc-ref %build-inputs "libc")
66 ,(glibc-dynamic-linker))
67 (string-append "--crtprefix="
68 (assoc-ref %build-inputs "libc")
69 "/lib")
70 (string-append "--sysincludepaths="
71 (assoc-ref %build-inputs "libc")
72 "/include:"
73 (assoc-ref %build-inputs
ce430bd6 74 "kernel-headers")
a5e2c9a9
LC
75 "/include:{B}/include")
76 (string-append "--libpaths="
77 (assoc-ref %build-inputs "libc")
9117d6df
EF
78 "/lib")
79 ,@(if (string-prefix? "armhf-linux"
80 (or (%current-target-system)
81 (%current-system)))
82 `("--triplet=arm-linux-gnueabihf")
83 '()))
a5e2c9a9 84 #:test-target "test"))
4c16ffd3
AE
85 (native-search-paths
86 (list (search-path-specification
87 (variable "CPATH")
88 (files '("include")))
89 (search-path-specification
90 (variable "LIBRARY_PATH")
91 (files '("lib" "lib64")))))
57a31efb 92 ;; Fails to build on MIPS: "Unsupported CPU"
0270b24b 93 (supported-systems (delete "mips64el-linux" %supported-systems))
a5e2c9a9
LC
94 (synopsis "Tiny and fast C compiler")
95 (description
96 "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
97written in C. It supports ANSI C with GNU and extensions and most of the C99
98standard.")
99 (home-page "http://www.tinycc.org/")
5d0bd1fb
TGR
100 ;; An attempt to re-licence tcc under the Expat licence is underway but not
101 ;; (if ever) complete. See the RELICENSING file for more information.
a5e2c9a9 102 (license license:lgpl2.1+)))
9f088725 103
f0316832
RW
104(define-public pcc
105 (package
106 (name "pcc")
107 (version "20170109")
108 (source (origin
109 (method url-fetch)
110 (uri (string-append "http://pcc.ludd.ltu.se/ftp/pub/pcc/pcc-"
111 version ".tgz"))
112 (sha256
113 (base32
114 "1p34w496095mi0473f815w6wbi57zxil106mg7pj6sg6gzpjcgww"))))
115 (build-system gnu-build-system)
116 (arguments
117 `(#:phases
118 (modify-phases %standard-phases
119 (replace 'check
9c30cba4 120 (lambda _ (invoke "make" "-C" "cc/cpp" "test") #t)))))
f0316832
RW
121 (native-inputs
122 `(("bison" ,bison)
123 ("flex" ,flex)))
124 (synopsis "Portable C compiler")
125 (description
126 "PCC is a portable C compiler. The project goal is to write a C99
127compiler while still keeping it small, simple, fast and understandable.")
128 (home-page "http://pcc.ludd.ltu.se")
6a052473 129 (supported-systems (delete "aarch64-linux" %supported-systems))
f0316832
RW
130 ;; PCC incorporates code under various BSD licenses; for new code bsd-2 is
131 ;; preferred. See http://pcc.ludd.ltu.se/licenses/ for more details.
132 (license (list license:bsd-2 license:bsd-3))))
c229fb3d
PN
133
134(define-public libbytesize
135 (package
136 (name "libbytesize")
e48390cb 137 (version "2.2")
c229fb3d
PN
138 (source (origin
139 (method url-fetch)
140 (uri (string-append
94617bdd
TGR
141 "https://github.com/storaged-project/libbytesize/releases/"
142 "download/" version "/libbytesize-" version ".tar.gz"))
c229fb3d
PN
143 (sha256
144 (base32
e48390cb 145 "1aivwypmnqcaj2230pifvf3jcgl5chja8rspkxf0j3480asm8g5r"))))
c229fb3d 146 (build-system gnu-build-system)
bf6859e4 147 (arguments
2414997a 148 `(#:tests? #f))
c229fb3d
PN
149 (native-inputs
150 `(("gettext" ,gettext-minimal)
151 ("pkg-config" ,pkg-config)
152 ("python" ,python)))
153 (inputs
154 `(("mpfr" ,mpfr)
2414997a 155 ("pcre2" ,pcre2)))
c229fb3d
PN
156 (home-page "https://github.com/storaged-project/libbytesize")
157 (synopsis "Tiny C library for working with arbitrary big sizes in bytes")
158 (description
159 "The goal of this project is to provide a tiny library that would
160facilitate the common operations with sizes in bytes. Many projects need to
161work with sizes in bytes (be it sizes of storage space, memory...) and all of
162them need to deal with the same issues like:
163
164@itemize
165@item How to get a human-readable string for the given size?
166@item How to store the given size so that no significant information is lost?
167@item If we store the size in bytes, what if the given size gets over the
168MAXUINT64 value?
169@item How to interpret sizes entered by users according to their locale and
170typing conventions?
171@item How to deal with the decimal/binary units (MB versus MiB) ambiguity?
172@end itemize
173
174@code{libbytesize} offers a generally usable solution that could be used by
175every project that needs to deal with sizes in bytes. It is written in the C
176language with thin bindings for other languages.")
177 (license license:lgpl2.1+)))
011ec1e5
RW
178
179(define-public udunits
180 (package
181 (name "udunits")
182 (version "2.2.26")
183 (source (origin
184 (method url-fetch)
185 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/udunits/"
186 "udunits-" version ".tar.gz"))
187 (sha256
188 (base32
189 "0v9mqw4drnkzkm57331ail6yvs9485jmi37s40lhvmf7r5lli3rn"))))
190 (build-system gnu-build-system)
191 (inputs
192 `(("expat" ,expat)))
193 (home-page "https://www.unidata.ucar.edu/software/udunits/")
194 (synopsis "C library for units of physical quantities and value-conversion utils")
195 (description
196 "The UDUNITS-2 package provides support for units of physical quantities.
197Its three main components are:
198
199@enumerate
200@item @code{udunits2lib}, a C library for units of physical quantities;
201@item @code{udunits2prog}, a utility for obtaining the definition of a unit
202 and for converting numeric values between compatible units; and
203@item an extensive database of units.
204@end enumerate\n")
205 ;; Like the BSD-3 license but with an extra anti patent clause.
206 (license (license:non-copyleft "file://COPYRIGHT"))))
07592c77
PN
207
208(define-public libfixposix
209 (package
210 (name "libfixposix")
211 (version "0.4.3")
212 (home-page "https://github.com/sionescu/libfixposix")
213 (source
214 (origin
215 (method git-fetch)
216 (uri (git-reference
217 (url home-page)
218 (commit (string-append "v" version))))
219 (file-name (git-file-name name version))
220 (sha256
221 (base32
222 "1x4q6yspi5g2s98vq4qszw4z3zjgk9l5zs8471w4d4cs6l97w08j"))))
223 (build-system gnu-build-system)
224 (native-inputs
225 `(("autoconf" ,autoconf)
226 ("automake" ,automake)
227 ("libtool" ,libtool)
228 ("pkg-config" ,pkg-config)
229 ("check" ,check)))
230 (synopsis "Thin wrapper over POSIX syscalls")
231 (description
232 "The purpose of libfixposix is to offer replacements for parts of POSIX
233whose behaviour is inconsistent across *NIX flavours.")
234 (license license:boost1.0)))
f170603e
GLV
235
236(define-public libhx
237 (package
238 (name "libhx")
d9a7102c 239 (version "3.25")
f170603e
GLV
240 (source
241 (origin
242 (method url-fetch)
243 (uri (string-append "mirror://sourceforge/libhx/libHX/"
244 "libHX-" version ".tar.xz"))
245 (sha256
d9a7102c 246 (base32 "12avn16f8aqb0cq6jplz0sv7rh6f07m85dwc8dasnnwsvijwbpbj"))))
f170603e
GLV
247 (build-system gnu-build-system)
248 (home-page "http://libhx.sourceforge.net")
249 (synopsis "C library with common data structures and functions")
250 (description
251 "This is a C library (with some C++ bindings available) that provides data
252structures and functions commonly needed, such as maps, deques, linked lists,
253string formatting and autoresizing, option and config file parsing, type
254checking casts and more.")
255 (license license:lgpl2.1+)))
7adb5299 256
d1c6b097
MB
257(define-public packcc
258 (package
259 (name "packcc")
260 ;; We need a few fixes on top of the latest release to prevent test
261 ;; failures in Universal Ctags.
262 (version "1.2.5-19-g58d1b9d")
263 (home-page "https://github.com/enechaev/packcc")
264 (source (origin
265 (method git-fetch)
266 (uri (git-reference
267 (url home-page)
268 (commit (string-append "v" version))))
269 (file-name (git-file-name name version))
270 (sha256
271 (base32
272 "0biyv835jlk43fvmmd3p8jafs7k2iw9qlaj37hvsl604ai6rd5aj"))))
273 (build-system gnu-build-system)
274 (arguments
275 '(#:tests? #f ;no tests
276 #:make-flags '("-DUSE_SYSTEM_STRNLEN=1")
277 #:phases (modify-phases %standard-phases
278 ;; The project consists of a single source file and has
279 ;; no actual build system, so we need to do it manually.
280 (delete 'configure)
281 (replace 'build
282 (lambda* (#:key make-flags #:allow-other-keys)
283 (apply invoke "gcc" "-o" "packcc" "packcc.c"
284 make-flags)))
285 (replace 'install
286 (lambda* (#:key outputs #:allow-other-keys)
287 (let ((out (assoc-ref outputs "out")))
288 (install-file "packcc" (string-append out "/bin"))
289 (install-file "README.md"
290 (string-append out "/share/doc/packcc"))
291 #t))))))
292 (synopsis "Packrat parser generator for C")
293 (description
294 "PackCC is a packrat parser generator for the C programming language.
295Its main features are:
296@itemize
297@item Generates a parser in C from a grammar described in a PEG.
298@item Gives your parser great efficiency by packrat parsing.
299@item Supports direct and indirect left-recursive grammar rules.
300@end itemize
301The grammar of your parser can be described in a @acronym{PEG, Parsing
302Expression Grammar}. The PEG is a top-down parsing language, and is similar
303to the regular-expression grammar. The PEG does not require tokenization to
304be a separate step, and tokenization rules can be written in the same way as
305any other grammar rules.")
306 (license license:expat)))
307
7adb5299
JN
308(define-public sparse
309 (package
310 (name "sparse")
311 (version "0.6.1")
312 (source (origin
313 (method url-fetch)
314 (uri
315 (string-append "mirror://kernel.org/software/devel/sparse/dist/"
316 "sparse-" version ".tar.xz"))
317 (sha256
318 (base32
319 "0qavyryxmhd1rf11akgn1nq3r15k11bqa3qajaq36a56r225rc7x"))))
320 (build-system gnu-build-system)
321 (inputs `(("perl" ,perl)))
322 (arguments
323 '(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out")))
324 #:phases (modify-phases %standard-phases
325 (delete 'configure)
326 (add-after 'unpack 'patch-cgcc
327 (lambda _
328 (substitute* "cgcc"
329 (("'cc'") (string-append "'" (which "gcc") "'")))
330 #t)))))
331 (synopsis "Semantic C parser for Linux development")
332 (description
333 "Sparse is a semantic parser for C and is required for Linux development.
334It provides a compiler frontend capable of parsing most of ANSI C as well as
335many GCC extensions, and a collection of sample compiler backends, including a
336static analyzer also called @file{sparse}. Sparse provides a set of
337annotations designed to convey semantic information about types, such as what
338address space pointers point to, or what locks a function acquires or
339releases.")
340 (home-page "https://sparse.wiki.kernel.org/index.php/Main_Page")
341 (license license:expat)))