gnu: Add external-program.
[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>
5d0bd1fb 4;;; Copyright © 2018 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>
a5e2c9a9
LC
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)
c229fb3d 29 #:use-module (guix git-download)
a5e2c9a9 30 #:use-module (guix build-system gnu)
9f088725 31 #:use-module (guix build-system trivial)
a5e2c9a9 32 #:use-module (gnu packages bootstrap)
f0316832 33 #:use-module (gnu packages bison)
07592c77 34 #:use-module (gnu packages check)
f0316832 35 #:use-module (gnu packages flex)
a5e2c9a9 36 #:use-module (gnu packages perl)
9f088725 37 #:use-module (gnu packages texinfo)
97b7201f 38 #:use-module (gnu packages guile)
c229fb3d
PN
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)
011ec1e5
RW
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages xml))
a5e2c9a9
LC
46
47(define-public tcc
48 (package
49 (name "tcc") ;aka. "tinycc"
5d0bd1fb 50 (version "0.9.27")
a5e2c9a9
LC
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "mirror://savannah/tinycc/tcc-"
54 version ".tar.bz2"))
55 (sha256
56 (base32
5d0bd1fb 57 "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
a5e2c9a9
LC
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
ce430bd6 72 "kernel-headers")
a5e2c9a9
LC
73 "/include:{B}/include")
74 (string-append "--libpaths="
75 (assoc-ref %build-inputs "libc")
9117d6df
EF
76 "/lib")
77 ,@(if (string-prefix? "armhf-linux"
78 (or (%current-target-system)
79 (%current-system)))
80 `("--triplet=arm-linux-gnueabihf")
81 '()))
a5e2c9a9 82 #:test-target "test"))
4c16ffd3
AE
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")))))
57a31efb 90 ;; Fails to build on MIPS: "Unsupported CPU"
0270b24b 91 (supported-systems (delete "mips64el-linux" %supported-systems))
a5e2c9a9
LC
92 (synopsis "Tiny and fast C compiler")
93 (description
94 "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
95written in C. It supports ANSI C with GNU and extensions and most of the C99
96standard.")
97 (home-page "http://www.tinycc.org/")
5d0bd1fb
TGR
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.
a5e2c9a9 100 (license license:lgpl2.1+)))
9f088725 101
f0316832
RW
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
9c30cba4 118 (lambda _ (invoke "make" "-C" "cc/cpp" "test") #t)))))
f0316832
RW
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
125compiler while still keeping it small, simple, fast and understandable.")
126 (home-page "http://pcc.ludd.ltu.se")
6a052473 127 (supported-systems (delete "aarch64-linux" %supported-systems))
f0316832
RW
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))))
c229fb3d
PN
131
132(define-public libbytesize
133 (package
134 (name "libbytesize")
2414997a 135 (version "2.1")
c229fb3d
PN
136 (source (origin
137 (method url-fetch)
138 (uri (string-append
94617bdd
TGR
139 "https://github.com/storaged-project/libbytesize/releases/"
140 "download/" version "/libbytesize-" version ".tar.gz"))
c229fb3d
PN
141 (sha256
142 (base32
2414997a 143 "1bpz9cpb8s47kqplkkiz6ryfahas2ma95g9rh2axnfjp6w1d9ixc"))))
c229fb3d 144 (build-system gnu-build-system)
bf6859e4 145 (arguments
2414997a 146 `(#:tests? #f))
c229fb3d
PN
147 (native-inputs
148 `(("gettext" ,gettext-minimal)
149 ("pkg-config" ,pkg-config)
150 ("python" ,python)))
151 (inputs
152 `(("mpfr" ,mpfr)
2414997a 153 ("pcre2" ,pcre2)))
c229fb3d
PN
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
158facilitate the common operations with sizes in bytes. Many projects need to
159work with sizes in bytes (be it sizes of storage space, memory...) and all of
160them 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
166MAXUINT64 value?
167@item How to interpret sizes entered by users according to their locale and
168typing 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
173every project that needs to deal with sizes in bytes. It is written in the C
174language with thin bindings for other languages.")
175 (license license:lgpl2.1+)))
011ec1e5
RW
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.
195Its 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"))))
07592c77
PN
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
231whose behaviour is inconsistent across *NIX flavours.")
232 (license license:boost1.0)))
f170603e
GLV
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
251structures and functions commonly needed, such as maps, deques, linked lists,
252string formatting and autoresizing, option and config file parsing, type
253checking casts and more.")
254 (license license:lgpl2.1+)))