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