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