gnu: Add python-user-agents.
[jackhill/guix/guix.git] / gnu / packages / cpp.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Ethan R. Jones <doubleplusgood23@gmail.com>
3 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
5 ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages cpp)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages code)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages llvm)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages tls))
37
38 (define-public libzen
39 (package
40 (name "libzen")
41 (version "0.4.37")
42 (source (origin
43 (method url-fetch)
44 (uri (string-append "https://mediaarea.net/download/source/"
45 name "/" version "/"
46 name "_" version ".tar.bz2"))
47 (sha256
48 (base32
49 "1hcsrmn85b0xp0mp33aazk7g071q1v3f163nnhv8b0mv9c4bgsfn"))))
50 (native-inputs
51 `(("autoconf" ,autoconf)
52 ("automake" ,automake)
53 ("libtool" ,libtool)))
54 (build-system gnu-build-system)
55 (arguments
56 '(#:phases
57 ;; build scripts not in root of archive
58 (modify-phases %standard-phases
59 (add-after 'unpack 'pre-configure
60 (lambda _
61 (chdir "Project/GNU/Library")))
62 (add-after 'pre-configure 'autogen
63 (lambda _
64 (zero? (system* "sh" "autogen.sh")))))))
65 (home-page "https://github.com/MediaArea/ZenLib")
66 (synopsis "C++ utility library")
67 (description "ZenLib is a C++ utility library. It includes classes for handling
68 strings, configuration, bit streams, threading, translation, and cross-platform
69 operating system functions.")
70 (license license:zlib)))
71
72 (define-public rct
73 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
74 (revision "2")
75 (version (git-version "0.0.0" revision commit)))
76 (package
77 (name "rct")
78 (version version)
79 (home-page "https://github.com/Andersbakken/rct")
80 (source (origin
81 (method git-fetch)
82 (uri (git-reference
83 (url home-page)
84 (commit commit)))
85 (sha256
86 (base32
87 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
88 (patches (search-patches "rct-add-missing-headers.patch"))
89 (file-name (git-file-name name version))))
90 (build-system cmake-build-system)
91 (arguments
92 '(#:configure-flags
93 '("-DWITH_TESTS=ON" ; To run the test suite
94 "-DRCT_RTTI_ENABLED=ON")))
95 (native-inputs
96 `(("cppunit" ,cppunit)
97 ("pkg-config" ,pkg-config)))
98 (inputs
99 `(("openssl" ,openssl)
100 ("zlib" ,zlib)))
101 (synopsis "C++ library providing Qt-like APIs on top of the STL")
102 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
103 APIs on top of Standard Template Library (@dfn{STL}) classes.")
104 (license (list license:expat ; cJSON
105 license:bsd-4))))) ; everything else (LICENSE.txt)
106
107 (define-public dashel
108 (package
109 (name "dashel")
110 (version "1.3.3")
111 (home-page "https://github.com/aseba-community/dashel")
112 (source (origin
113 (method url-fetch)
114 (uri (string-append home-page "/archive/" version ".tar.gz"))
115 (sha256
116 (base32
117 "1ckzac1rsw3cxmpdpwcqv46jyp7risk5ybq6jjiizbqn7labf6dw"))
118 (file-name (string-append name "-" version ".tar.gz"))))
119 (build-system cmake-build-system)
120 (arguments '(#:tests? #f)) ;no tests
121 (native-inputs `(("pkg-config" ,pkg-config)))
122 (synopsis "Data stream helper encapsulation library")
123 (description
124 "Dashel is a data stream helper encapsulation C++ library. It provides a
125 unified access to TCP/UDP sockets, serial ports, console, and files streams.
126 It also allows a server application to wait for any activity on any
127 combination of these streams.")
128 (license license:bsd-3)))
129
130 (define-public xsimd
131 (package
132 (name "xsimd")
133 (version "4.1.2")
134 (source (origin
135 (method url-fetch)
136 (uri (string-append
137 "https://github.com/QuantStack/xsimd/archive/"
138 version ".tar.gz"))
139 (sha256
140 (base32
141 "0x05l4xpqr9b66sm6lkf48n6x7999ks921x6k2hzkkg6mh3gqd46"))
142 (file-name (string-append name "-" version ".tar.gz"))))
143 (home-page "https://github.com/QuantStack/xsimd")
144 (build-system cmake-build-system)
145 (arguments
146 `(#:test-target "xtest"))
147 (native-inputs
148 `(("googletest" ,googletest)))
149 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
150 (description "xsimd provides a unified means for using SIMD features for
151 library authors. Namely, it enables manipulation of batches of numbers with
152 the same arithmetic operators as for single values. It also provides
153 accelerated implementation of common mathematical functions operating on
154 batches.")
155 (license license:bsd-3)))
156
157 (define-public fifo-map
158 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
159 (revision "0")
160 (version (git-version "1.1.1" revision commit)))
161 (package
162 (name "fifo-map")
163 (version version)
164 (home-page "https://github.com/nlohmann/fifo_map")
165 (source (origin
166 (method git-fetch)
167 (uri (git-reference
168 (url home-page)
169 (commit commit)))
170 (sha256
171 (base32
172 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
173 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
174 "fifo-map-fix-flags-for-gcc.patch"))
175 (file-name (git-file-name name version))
176 (modules '((guix build utils)))
177 (snippet '(delete-file-recursively "./test/thirdparty"))))
178 (native-inputs
179 `(("catch2" ,catch-framework2)))
180 (build-system cmake-build-system)
181 (arguments
182 `(#:phases
183 (modify-phases %standard-phases
184 (replace 'check
185 (lambda _
186 (invoke "./unit")))
187 (replace 'install
188 (lambda* (#:key outputs #:allow-other-keys)
189 (let* ((out (assoc-ref outputs "out"))
190 (inc (string-append out "/include/fifo_map")))
191 (with-directory-excursion
192 (string-append "../" ,name "-" ,version "-checkout")
193 (install-file "src/fifo_map.hpp" inc)
194 #t)))))))
195 (synopsis "FIFO-ordered associative container for C++")
196 (description "Fifo_map is a C++ header only library for associative
197 container which uses the order in which keys were inserted to the container
198 as ordering relation.")
199 (license license:expat))))
200
201 (define-public json-modern-cxx
202 (package
203 (name "json-modern-cxx")
204 (version "3.1.2")
205 (source
206 (origin
207 (method url-fetch)
208 (uri (string-append
209 "https://github.com/nlohmann/json/archive/v" version ".tar.gz"))
210 (sha256
211 (base32
212 "0m5fhdpx2qll933db2nsi30nns3cifavzvijzz6mxhdkpmngmzz8"))
213 (file-name (string-append name "-" version ".tar.gz"))
214 (modules '((guix build utils)))
215 (snippet
216 '(begin
217 (delete-file-recursively "./third_party")
218 (delete-file-recursively "./test/thirdparty")
219 (delete-file-recursively "./benchmarks/thirdparty")
220 ;; Splits catch and fifo_map
221 (with-directory-excursion "test/src"
222 (let ((files (find-files "." ".*\\.cpp")))
223 (substitute* files
224 (("#include ?\"(catch.hpp)\"" all catch-hpp)
225 (string-append "#include <catch/" catch-hpp ">")))
226 (substitute* files
227 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
228 (string-append
229 "#include <fifo_map/" fifo-map-hpp ">")))))))))
230 (native-inputs
231 `(("amalgamate" ,amalgamate)))
232 (inputs
233 `(("catch2" ,catch-framework2)
234 ("fifo-map" ,fifo-map)))
235 (home-page "https://github.com/nlohmann/json")
236 (build-system cmake-build-system)
237 (synopsis "JSON parser and printer library for C++")
238 (description "JSON for Modern C++ is a C++ JSON library that provides
239 intuitive syntax and trivial integration.")
240 (license license:expat)))
241
242 (define-public xtl
243 (package
244 (name "xtl")
245 (version "0.4.14")
246 (source (origin
247 (method git-fetch)
248 (uri
249 (git-reference
250 (url "https://github.com/QuantStack/xtl.git")
251 (commit version)))
252 (sha256
253 (base32
254 "0wwnd9adc1wav2299id17k5fbp0ib5gxkbihlk6jlh3v4i5nz11x"))
255 (file-name (git-file-name name version))))
256 (native-inputs
257 `(("googletest" ,googletest)
258 ("json-modern-cxx" ,json-modern-cxx)))
259 (arguments
260 `(#:configure-flags
261 '("-DBUILD_TESTS=ON")
262 #:phases
263 (modify-phases %standard-phases
264 (replace 'check
265 (lambda* _
266 (with-directory-excursion "test"
267 (invoke "./test_xtl")
268 #t))))))
269 (home-page "https://github.com/QuantStack/xtl")
270 (build-system cmake-build-system)
271 (synopsis "C++ template library providing some basic tools")
272 (description "xtl is a C++ header-only template library providing basic
273 tools (containers, algorithms) used by other QuantStack packages.")
274 (license license:bsd-3)))