Merge branch 'master' into core-updates
[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, 2019, 2020 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 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
7 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
8 ;;; Copyright © 2019 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
9 ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
10 ;;; Copyright © 2020 Roel Janssen <roel@gnu.org>
11 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages cpp)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system python)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages code)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages llvm)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages tls)
45 #:use-module (gnu packages web))
46
47 (define-public libzen
48 (package
49 (name "libzen")
50 (version "0.4.38")
51 (source (origin
52 (method url-fetch)
53 ;; Warning: This source has proved unreliable 1 time at least.
54 ;; Consider an alternate source or report upstream if this
55 ;; happens again.
56 (uri (string-append "https://mediaarea.net/download/source/"
57 "libzen/" version "/"
58 "libzen_" version ".tar.bz2"))
59 (sha256
60 (base32
61 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
62 (native-inputs
63 `(("autoconf" ,autoconf)
64 ("automake" ,automake)
65 ("libtool" ,libtool)))
66 (build-system gnu-build-system)
67 (arguments
68 '(#:phases
69 ;; The build scripts are not at the root of the archive.
70 (modify-phases %standard-phases
71 (add-after 'unpack 'pre-configure
72 (lambda _
73 (chdir "Project/GNU/Library")
74 #t)))))
75 (home-page "https://github.com/MediaArea/ZenLib")
76 (synopsis "C++ utility library")
77 (description "ZenLib is a C++ utility library. It includes classes for handling
78 strings, configuration, bit streams, threading, translation, and cross-platform
79 operating system functions.")
80 (license license:zlib)))
81
82 (define-public rct
83 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
84 (revision "2"))
85 (package
86 (name "rct")
87 (version (git-version "0.0.0" revision commit))
88 (source (origin
89 (method git-fetch)
90 (uri (git-reference
91 (url "https://github.com/Andersbakken/rct")
92 (commit commit)))
93 (sha256
94 (base32
95 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
96 (patches (search-patches "rct-add-missing-headers.patch"))
97 (file-name (git-file-name name version))))
98 (build-system cmake-build-system)
99 (arguments
100 '(#:configure-flags
101 '("-DWITH_TESTS=ON" ; To run the test suite
102 "-DRCT_RTTI_ENABLED=ON")))
103 (native-inputs
104 `(("cppunit" ,cppunit)
105 ("pkg-config" ,pkg-config)))
106 (inputs
107 `(("openssl" ,openssl)
108 ("zlib" ,zlib)))
109 (home-page "https://github.com/Andersbakken/rct")
110 (synopsis "C++ library providing Qt-like APIs on top of the STL")
111 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
112 APIs on top of Standard Template Library (@dfn{STL}) classes.")
113 (license (list license:expat ; cJSON
114 license:bsd-4))))) ; everything else (LICENSE.txt)
115
116 (define-public dashel
117 (package
118 (name "dashel")
119 (version "1.3.3")
120 (source
121 (origin
122 (method git-fetch)
123 (uri (git-reference
124 (url "https://github.com/aseba-community/dashel.git")
125 (commit version)))
126 (sha256
127 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
128 (file-name (git-file-name name version))))
129 (build-system cmake-build-system)
130 (arguments '(#:tests? #f)) ; no tests
131 (native-inputs `(("pkg-config" ,pkg-config)))
132 (home-page "https://github.com/aseba-community/dashel")
133 (synopsis "Data stream helper encapsulation library")
134 (description
135 "Dashel is a data stream helper encapsulation C++ library. It provides a
136 unified access to TCP/UDP sockets, serial ports, console, and files streams.
137 It also allows a server application to wait for any activity on any
138 combination of these streams.")
139 (license license:bsd-3)))
140
141 (define-public xsimd
142 (package
143 (name "xsimd")
144 (version "7.2.3")
145 (source
146 (origin
147 (method git-fetch)
148 (uri (git-reference
149 (url "https://github.com/QuantStack/xsimd.git")
150 (commit version)))
151 (sha256
152 (base32 "1ny2qin1j4h35mljivh8z52kwdyjxf4yxlzb8j52ji91v2ccc88j"))
153 (file-name (git-file-name name version))))
154 (build-system cmake-build-system)
155 (arguments
156 `(#:configure-flags (list "-DBUILD_TESTS=ON")
157 #:test-target "xtest"))
158 (native-inputs
159 `(("googletest" ,googletest)))
160 (home-page "https://github.com/QuantStack/xsimd")
161 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
162 (description "xsimd provides a unified means for using SIMD features for
163 library authors. Namely, it enables manipulation of batches of numbers with
164 the same arithmetic operators as for single values. It also provides
165 accelerated implementation of common mathematical functions operating on
166 batches.")
167 (license license:bsd-3)))
168
169 (define-public fifo-map
170 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
171 (revision "0")
172 (version (git-version "1.1.1" revision commit)))
173 (package
174 (name "fifo-map")
175 (version version)
176 (home-page "https://github.com/nlohmann/fifo_map")
177 (source (origin
178 (method git-fetch)
179 (uri (git-reference
180 (url home-page)
181 (commit commit)))
182 (sha256
183 (base32
184 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
185 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
186 "fifo-map-fix-flags-for-gcc.patch"))
187 (file-name (git-file-name name version))
188 (modules '((guix build utils)))
189 (snippet '(delete-file-recursively "./test/thirdparty"))))
190 (native-inputs
191 `(("catch2" ,catch-framework2-1)))
192 (build-system cmake-build-system)
193 (arguments
194 `(#:phases
195 (modify-phases %standard-phases
196 (replace 'check
197 (lambda _
198 (invoke "./unit")))
199 (replace 'install
200 (lambda* (#:key outputs #:allow-other-keys)
201 (let* ((out (assoc-ref outputs "out"))
202 (inc (string-append out "/include/fifo_map")))
203 (with-directory-excursion
204 (string-append "../" ,name "-" ,version "-checkout")
205 (install-file "src/fifo_map.hpp" inc)
206 #t)))))))
207 (synopsis "FIFO-ordered associative container for C++")
208 (description "Fifo_map is a C++ header only library for associative
209 container which uses the order in which keys were inserted to the container
210 as ordering relation.")
211 (license license:expat))))
212
213 (define-public json-modern-cxx
214 (package
215 (name "json-modern-cxx")
216 (version "3.7.3")
217 (home-page "https://github.com/nlohmann/json")
218 (source
219 (origin
220 (method git-fetch)
221 (uri (git-reference (url home-page)
222 (commit (string-append "v" version))))
223 (sha256
224 (base32
225 "04rry1xzis71z5gj1ylcj8b4li5q18zxhcwaviwvi3hx0frzxl9w"))
226 (file-name (git-file-name name version))
227 (modules '((guix build utils)))
228 (snippet
229 '(begin
230 ;; Delete bundled software. Preserve doctest_compatibility.h, which
231 ;; is a wrapper library added by this package.
232 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
233 (for-each delete-file-recursively
234 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
235 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
236
237 ;; Adjust for the unbundled fifo_map and doctest.
238 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
239 (("#include \"doctest\\.h\"")
240 "#include <doctest/doctest.h>"))
241 (with-directory-excursion "test/src"
242 (let ((files (find-files "." "\\.cpp$")))
243 (substitute* files
244 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
245 (string-append
246 "#include <fifo_map/" fifo-map-hpp ">")))))
247 #t))))
248 (native-inputs
249 `(("amalgamate" ,amalgamate)
250 ("doctest" ,doctest)))
251 (inputs
252 `(("fifo-map" ,fifo-map)))
253 (build-system cmake-build-system)
254 (synopsis "JSON parser and printer library for C++")
255 (description "JSON for Modern C++ is a C++ JSON library that provides
256 intuitive syntax and trivial integration.")
257 (license license:expat)))
258
259 (define-public nlohmann-json-cpp
260 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
261
262 (define-public xtl
263 (package
264 (name "xtl")
265 (version "0.6.13")
266 (source (origin
267 (method git-fetch)
268 (uri
269 (git-reference
270 (url "https://github.com/QuantStack/xtl.git")
271 (commit version)))
272 (sha256
273 (base32
274 "0py70lm2i3sxzpgca2cic8zfn6dn18q837h76a5fchl2c0kpxm91"))
275 (file-name (git-file-name name version))))
276 (native-inputs
277 `(("googletest" ,googletest)
278 ("json-modern-cxx" ,json-modern-cxx)))
279 (arguments
280 `(#:configure-flags
281 '("-DBUILD_TESTS=ON")
282 #:phases
283 (modify-phases %standard-phases
284 (replace 'check
285 (lambda* _
286 (with-directory-excursion "test"
287 (invoke "./test_xtl")
288 #t))))))
289 (home-page "https://github.com/QuantStack/xtl")
290 (build-system cmake-build-system)
291 (synopsis "C++ template library providing some basic tools")
292 (description "xtl is a C++ header-only template library providing basic
293 tools (containers, algorithms) used by other QuantStack packages.")
294 (license license:bsd-3)))
295
296 (define-public ccls
297 (package
298 (name "ccls")
299 (version "0.20190823.5")
300 (source
301 (origin
302 (method git-fetch)
303 (uri (git-reference
304 (url "https://github.com/MaskRay/ccls")
305 (commit version)))
306 (sha256
307 (base32 "0b2pkpzn576b92zcxpwchpkyw2fww6s69818rx4g9z34kzm35zy5"))
308 (file-name (git-file-name name version))))
309 (build-system cmake-build-system)
310 (arguments
311 '(#:tests? #f)) ; no check target.
312 (inputs
313 `(("rapidjson" ,rapidjson)))
314 (native-inputs
315 `(("clang" ,clang)
316 ("llvm" ,llvm)))
317 (home-page "https://github.com/MaskRay/ccls")
318 (synopsis "C/C++/Objective-C language server")
319 (description
320 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
321 for C, C++ and Objective-C languages. It uses @code{clang} to perform static
322 code analysis and supports cross references, hierarchies, completion and
323 syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
324 maintained anymore.")
325 (license license:asl2.0)))
326
327 (define-public gperftools
328 (package
329 (name "gperftools")
330 (version "2.7")
331 (source
332 (origin
333 (method git-fetch)
334 (uri (git-reference
335 (url "https://github.com/gperftools/gperftools")
336 (commit (string-append "gperftools-" version))))
337 (sha256
338 (base32 "0amvwrzn5qc0b0jpxpy5g6zkmj97zjh4hhjrd130hsg2lwwcwhy1"))
339 (file-name (git-file-name name version))))
340 (build-system gnu-build-system)
341 (native-inputs
342 `(("autoconf" ,autoconf)
343 ("automake" ,automake)
344 ("libtool" ,libtool)
345 ;; For tests:
346 ("perl" ,perl)))
347 (home-page "https://github.com/gperftools/gperftools")
348 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
349 (description
350 "@code{gperftools} is a collection of a high-performance multi-threaded
351 malloc() implementation plus some thread-friendly performance analysis
352 tools:
353
354 @itemize
355 @item tcmalloc,
356 @item heap profiler,
357 @item heap checker,
358 @item CPU checker.
359 @end itemize\n")
360 (license license:bsd-3)))
361
362 (define-public cpplint
363 (package
364 (name "cpplint")
365 (version "1.4.4")
366 (source
367 (origin
368 (method git-fetch)
369 ;; Fetch from github instead of pypi, since the test cases are not in
370 ;; the pypi archive.
371 (uri (git-reference
372 (url "https://github.com/cpplint/cpplint")
373 (commit version)))
374 (sha256
375 (base32 "1ns9wbizr10w7rpyp106d7ip68s5nyskr54vw9bij11sci9z0v3j"))
376 (file-name (git-file-name name version))))
377 (build-system python-build-system)
378 (home-page "https://github.com/cpplint/cpplint")
379 (synopsis "Static code checker for C++")
380 (description "@code{cpplint} is a command-line tool to check C/C++ files
381 for style issues following Google’s C++ style guide. While Google maintains
382 it's own version of the tool, this is a fork that aims to be more responsive
383 and make @code{cpplint} usable in wider contexts.")
384 (license license:bsd-3)))
385
386 (define-public sobjectizer
387 (package
388 (name "sobjectizer")
389 (version "5.6.1")
390 (source
391 (origin
392 (method git-fetch)
393 (uri (git-reference
394 (url "https://github.com/Stiffstream/sobjectizer.git")
395 (commit (string-append "v." version))))
396 (sha256
397 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
398 (file-name (git-file-name name version))))
399 (build-system cmake-build-system)
400 (arguments
401 `(#:tests? #f
402 #:phases
403 (modify-phases %standard-phases
404 (add-after 'unpack 'change-directory
405 (lambda _
406 (chdir "dev")
407 #t)))))
408 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
409 (synopsis "Cross-platform actor framework for C++")
410 (description
411 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
412 SObjectizer supports not only the Actor Model but also the Publish-Subscribe
413 Model and CSP-like channels. The goal of SObjectizer is to simplify
414 development of concurrent and multithreaded applications in C++.")
415 (license license:bsd-3)))
416
417 (define-public tweeny
418 (package
419 (name "tweeny")
420 (version "3")
421 (source
422 (origin
423 (method git-fetch)
424 (uri (git-reference
425 (url "https://github.com/mobius3/tweeny.git")
426 (commit (string-append "v" version))))
427 (file-name (git-file-name name version))
428 (sha256
429 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
430 (arguments
431 '(#:tests? #f)) ;no check target
432 (build-system cmake-build-system)
433 (home-page "https://mobius3.github.io/tweeny/")
434 (synopsis "Modern C++ tweening library")
435 (description "@code{Tweeny} is an inbetweening library designed for the
436 creation of complex animations for games and other beautiful interactive
437 software. It leverages features of modern @code{C++} to empower developers with
438 an intuitive API for declaring tweenings of any type of value, as long as they
439 support arithmetic operations. The goal of @code{Tweeny} is to provide means to
440 create fluid interpolations when animating position, scale, rotation, frames or
441 other values of screen objects, by setting their values as the tween starting
442 point and then, after each tween step, plugging back the result.")
443 (license license:expat)))
444
445 (define-public abseil-cpp
446 (package
447 (name "abseil-cpp")
448 (version "20200225.1")
449 (source (origin
450 (method git-fetch)
451 (uri (git-reference
452 (url "https://github.com/abseil/abseil-cpp.git")
453 (commit version)))
454 (file-name (git-file-name name version))
455 (sha256
456 (base32
457 "035bffayslawc19q2gmlkr6n6r7k7mvriaq7352rv6gyzaplr98w"))))
458 (build-system cmake-build-system)
459 (arguments
460 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
461 "-DABSL_RUN_TESTS=ON"
462 ;; Needed, else we get errors like:
463 ;;
464 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
465 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
466 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
467 ;; error adding symbols: DSO missing from command line
468 ;; collect2: error: ld returned 1 exit status
469 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
470 #:phases
471 (modify-phases %standard-phases
472 (add-before 'configure 'remove-gtest-check
473 ;; The CMakeLists fails to find our googletest for some reason, but
474 ;; it works nonetheless.
475 (lambda _
476 (substitute* "CMakeLists.txt"
477 (("check_target\\(gtest\\)") "")
478 (("check_target\\(gtest_main\\)") "")
479 (("check_target\\(gmock\\)") "")))))))
480 (native-inputs
481 `(("googletest" ,googletest)))
482 (home-page "https://abseil.io")
483 (synopsis "Augmented C++ standard library")
484 (description "Abseil is a collection of C++ library code designed to
485 augment the C++ standard library. The Abseil library code is collected from
486 Google's C++ code base.")
487 (license license:asl2.0)))