gnu: gvfs: Add 'lint-hidden-cve' property.
[jackhill/guix/guix.git] / gnu / packages / boost.scm
CommitLineData
2a72eeee
JD
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 John Darrington <jmd@gnu.org>
713c975a 3;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
1842a7cb 4;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
c91d3fb7 5;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
7b7b468e 6;;; Copyright © 2015, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
57144094 7;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
13de2b70 8;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
baef70bb 9;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
71154fe7 10;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
7624300c 11;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
f204d155 12;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
a4c04bee 13;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
2ac164a8 14;;; Copyright © 2019, 2020 Giacomo Leidi <goodoldpaul@autistici.org>
02fef961 15;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
a0828560 16;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
2a72eeee
JD
17;;;
18;;; This file is part of GNU Guix.
19;;;
20;;; GNU Guix is free software; you can redistribute it and/or modify it
21;;; under the terms of the GNU General Public License as published by
22;;; the Free Software Foundation; either version 3 of the License, or (at
23;;; your option) any later version.
24;;;
25;;; GNU Guix is distributed in the hope that it will be useful, but
26;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28;;; GNU General Public License for more details.
29;;;
30;;; You should have received a copy of the GNU General Public License
31;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33(define-module (gnu packages boost)
b5b73a82 34 #:use-module ((guix licenses) #:prefix license:)
da39ff58 35 #:use-module (guix utils)
2a72eeee
JD
36 #:use-module (guix packages)
37 #:use-module (guix download)
7624300c 38 #:use-module (guix git-download)
2a72eeee 39 #:use-module (guix build-system gnu)
7624300c 40 #:use-module (guix build-system trivial)
2a72eeee 41 #:use-module (gnu packages)
c28ba7aa 42 #:use-module (gnu packages compression)
7b7b468e 43 #:use-module (gnu packages hurd)
bd590b96
LF
44 #:use-module (gnu packages icu4c)
45 #:use-module (gnu packages perl)
2a72eeee 46 #:use-module (gnu packages python)
2ac164a8
GL
47 #:use-module (gnu packages shells)
48 #:use-module (srfi srfi-1))
2a72eeee 49
5cde458b
MB
50(define (version-with-underscores version)
51 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
52
53(define (boost-patch name version hash)
54 (origin
55 (method url-fetch)
56 (uri (string-append "https://www.boost.org/patches/"
57 (version-with-underscores version) "/" name))
58 (file-name (string-append "boost-" name))
59 (sha256 (base32 hash))))
60
2a72eeee
JD
61(define-public boost
62 (package
63 (name "boost")
02fef961 64 (version "1.72.0")
2a72eeee
JD
65 (source (origin
66 (method url-fetch)
5cde458b
MB
67 (uri (string-append "https://dl.bintray.com/boostorg/release/"
68 version "/source/boost_"
69 (version-with-underscores version) ".tar.bz2"))
70 (patches
71 (list (boost-patch
72 ;; 1.72.0 was released with a faulty coroutine submodule:
73 ;; <https://github.com/boostorg/coroutine/issues/46>.
74 "0001-revert-cease-dependence-on-range.patch" version
75 "1zcqxzh56m1s635wqwk15j3zcs2gmjvjy2f0hid7i78s4pgm0yfs")))
2a72eeee
JD
76 (sha256
77 (base32
02fef961 78 "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
2a72eeee 79 (build-system gnu-build-system)
bd590b96
LF
80 (inputs `(("icu4c" ,icu4c)
81 ("zlib" ,zlib)))
2a72eeee
JD
82 (native-inputs
83 `(("perl" ,perl)
a4c04bee
MO
84 ,@(if (%current-target-system)
85 '()
2ac164a8 86 `(("python" ,python-wrapper)))
2a72eeee
JD
87 ("tcsh" ,tcsh)))
88 (arguments
2ac164a8
GL
89 `(#:imported-modules ((guix build python-build-system)
90 ,@%gnu-build-system-modules)
91 #:modules (((guix build python-build-system) #:select (python-version))
92 ,@%gnu-build-system-modules)
93 #:tests? #f
f828ff5b
DT
94 #:make-flags
95 (list "threading=multi" "link=shared"
53a53be9 96
f828ff5b
DT
97 ;; Set the RUNPATH to $libdir so that the libs find each other.
98 (string-append "linkflags=-Wl,-rpath="
a4c04bee
MO
99 (assoc-ref %outputs "out") "/lib")
100 ,@(if (%current-target-system)
101 `("--user-config=user-config.jam"
102 ;; Python is not supported when cross-compiling.
103 "--without-python"
104 "binary-format=elf"
105 "target-os=linux"
106 ,@(cond
107 ((string-prefix? "arm" (%current-target-system))
108 '("abi=aapcs"
109 "address-model=32"
110 "architecture=arm"))
111 ((string-prefix? "aarch64" (%current-target-system))
112 '("abi=aapcs"
113 "address-model=64"
114 "architecture=arm"))
115 (else '())))
116 '()))
f828ff5b
DT
117 #:phases
118 (modify-phases %standard-phases
df216847 119 (delete 'bootstrap)
baef70bb 120 (replace 'configure
713c975a
MW
121 (lambda* (#:key inputs outputs #:allow-other-keys)
122 (let ((icu (assoc-ref inputs "icu4c"))
2ac164a8 123 (python (assoc-ref inputs "python"))
713c975a 124 (out (assoc-ref outputs "out")))
f828ff5b
DT
125 (substitute* '("libs/config/configure"
126 "libs/spirit/classic/phoenix/test/runtest.sh"
02fef961
MB
127 "tools/build/src/engine/execunix.cpp"
128 "tools/build/src/engine/Jambase")
f828ff5b 129 (("/bin/sh") (which "sh")))
aaf77acc 130
f828ff5b
DT
131 (setenv "SHELL" (which "sh"))
132 (setenv "CONFIG_SHELL" (which "sh"))
aaf77acc 133
a4c04bee
MO
134 ,@(if (%current-target-system)
135 `((call-with-output-file "user-config.jam"
136 (lambda (port)
137 (format port
138 "using gcc : cross : ~a-c++ ;"
139 ,(%current-target-system)))))
140 '())
141
7b7b468e
LC
142 ;; Change an #ifdef __MACH__ that really targets macOS.
143 ;; TODO: Inline this on the next rebuild cycle.
144 ,@(if (hurd-target?)
145 '((substitute* "boost/test/utils/timer.hpp"
146 (("defined\\(__MACH__\\)")
147 "(defined __MACH__ && !defined __GNU__)"))
148 #t)
149 '())
150
baef70bb
AI
151 (invoke "./bootstrap.sh"
152 (string-append "--prefix=" out)
713c975a
MW
153 ;; Auto-detection looks for ICU only in traditional
154 ;; install locations.
155 (string-append "--with-icu=" icu)
2ac164a8
GL
156 ;; Ditto for Python.
157 ,@(if (%current-target-system)
158 '()
159 `((string-append "--with-python-root=" python)
160 (string-append "--with-python=" python "/bin/python")
161 (string-append "--with-python-version="
162 (python-version python))))
196fb12c 163 "--with-toolset=gcc"))))
baef70bb 164 (replace 'build
196fb12c 165 (lambda* (#:key make-flags #:allow-other-keys)
baef70bb
AI
166 (apply invoke "./b2"
167 (format #f "-j~a" (parallel-job-count))
196fb12c 168 make-flags)))
baef70bb 169 (replace 'install
196fb12c 170 (lambda* (#:key make-flags #:allow-other-keys)
bd65ecf4 171 (apply invoke "./b2" "install" make-flags)))
a4c04bee
MO
172 ,@(if (%current-target-system)
173 '()
174 '((add-after 'install 'provide-libboost_python
2ac164a8
GL
175 (lambda* (#:key inputs outputs #:allow-other-keys)
176 (let* ((out (assoc-ref outputs "out"))
177 (python-version (python-version
178 (assoc-ref inputs "python")))
179 (libboost_pythonNN.so
180 (string-append "libboost_python"
181 (string-join (string-split
182 python-version #\.)
183 "")
184 ".so")))
a4c04bee 185 (with-directory-excursion (string-append out "/lib")
2ac164a8
GL
186 (symlink libboost_pythonNN.so "libboost_python.so")
187 ;; Some packages only look for the major version.
188 (symlink libboost_pythonNN.so
189 (string-append "libboost_python"
190 (string-take python-version 1)
191 ".so")))
a4c04bee 192 #t))))))))
2a72eeee 193
a2cfe190 194 (home-page "https://www.boost.org")
2a72eeee
JD
195 (synopsis "Peer-reviewed portable C++ source libraries")
196 (description
197 "A collection of libraries intended to be widely useful, and usable
198across a broad spectrum of applications.")
a2cfe190 199 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
2a72eeee 200 "Some components have other similar licences."))))
f763eaaa 201
2ac164a8 202(define-public boost-with-python2
12156a45
GL
203 (package
204 (inherit boost)
2ac164a8 205 (name "boost-python2")
12156a45 206 (native-inputs
2ac164a8
GL
207 `(("python" ,python-2)
208 ,@(alist-delete "python" (package-native-inputs boost))))))
12156a45 209
03d66a84
MB
210(define-public boost-with-python3
211 (deprecated-package "boost-with-python3" boost))
212
31872b3e
EF
213(define-public boost-static
214 (package
215 (inherit boost)
216 (name "boost-static")
217 (arguments
218 (substitute-keyword-arguments (package-arguments boost)
219 ((#:make-flags flags)
220 `(cons "link=static" (delete "link=shared" ,flags)))
221 ((#:phases phases)
222 `(modify-phases ,phases
223 (replace 'provide-libboost_python
0e907e27
MB
224 (lambda* (#:key inputs outputs #:allow-other-keys)
225 (let* ((out (assoc-ref outputs "out"))
226 (python-version (python-version
227 (assoc-ref inputs "python")))
228 (libboost_pythonNN.a
229 (string-append "libboost_python"
230 (string-join (string-split
231 python-version #\.)
232 "")
233 ".a")))
31872b3e 234 (with-directory-excursion (string-append out "/lib")
0e907e27 235 (symlink libboost_pythonNN.a "libboost_python.a"))
31872b3e
EF
236 #t)))))))))
237
444488fc
LC
238(define-public boost-for-mysql
239 ;; Older version for MySQL 5.7.23.
240 (package
241 (inherit boost)
242 (version "1.59.0")
243 (source (origin
244 (method url-fetch)
245 (uri (string-append
246 "mirror://sourceforge/boost/boost/" version "/boost_"
247 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
248 ".tar.bz2"))
249 (sha256
250 (base32
251 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
da39ff58
EF
252 (arguments (substitute-keyword-arguments (package-arguments boost)
253 ((#:phases phases)
254 `(modify-phases ,phases
a0828560
EF
255 (replace 'configure
256 (lambda* (#:key inputs outputs #:allow-other-keys)
257 (let ((icu (assoc-ref inputs "icu4c"))
258 (out (assoc-ref outputs "out")))
259 (substitute* (append
260 (find-files "tools/build/src/engine/" "execunix\\.c.*")
261 '("libs/config/configure"
262 "libs/spirit/classic/phoenix/test/runtest.sh"
263 "tools/build/doc/bjam.qbk"
264 "tools/build/src/engine/Jambase"))
265 (("/bin/sh") (which "sh")))
266
267 (setenv "SHELL" (which "sh"))
268 (setenv "CONFIG_SHELL" (which "sh"))
269
270 ,@(if (%current-target-system)
271 `((call-with-output-file "user-config.jam"
272 (lambda (port)
273 (format port
274 "using gcc : cross : ~a-c++ ;"
275 ,(%current-target-system)))))
276 '())
277
278 (invoke "./bootstrap.sh"
279 (string-append "--prefix=" out)
280 ;; Auto-detection looks for ICU only in traditional
281 ;; install locations.
282 (string-append "--with-icu=" icu)
283 "--with-toolset=gcc"))))
284 (delete 'provide-libboost_python)))
285 ((#:make-flags make-flags)
286 `(cons* "--without-python" ,make-flags))))
287 (native-inputs
288 (alist-delete "python" (package-native-inputs boost)))
444488fc
LC
289 (properties '((hidden? . #t)))))
290
7624300c
MC
291(define-public boost-sync
292 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
293 (version "1.55")
294 (revision "1"))
295 (package
296 (name "boost-sync")
297 (version (git-version version revision commit))
298 (source (origin
299 (method git-fetch)
300 (uri (git-reference
b0e7b699 301 (url "https://github.com/boostorg/sync")
7624300c
MC
302 (commit commit)))
303 (file-name (git-file-name name version))
304 (sha256
305 (base32
306 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
307 (build-system trivial-build-system)
308 (arguments
309 `(#:modules ((guix build utils))
310 #:builder
311 (begin
312 (use-modules (guix build utils))
313 (let ((source (assoc-ref %build-inputs "source")))
314 (copy-recursively (string-append source "/include")
315 (string-append %output "/include"))))))
316 (home-page "https://github.com/boostorg/sync")
317 (synopsis "Boost.Sync library")
318 (description "The Boost.Sync library provides mutexes, semaphores, locks
319and events and other thread related facilities. Boost.Sync originated from
320Boost.Thread.")
a2cfe190 321 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
7624300c 322
71154fe7
RW
323(define-public boost-signals2
324 (package
325 (name "boost-signals2")
326 (version (package-version boost))
327 (source (origin
328 (method git-fetch)
329 (uri (git-reference
b0e7b699 330 (url "https://github.com/boostorg/signals2")
71154fe7
RW
331 (commit (string-append "boost-" version))))
332 (file-name (git-file-name name version))
333 (sha256
334 (base32
ecab53c3 335 "13i5j43nggb46i6qpaf7gk53i7zp7pimphl7sydyfqz2m9yx5cdy"))))
71154fe7
RW
336 (build-system trivial-build-system)
337 (arguments
338 `(#:modules ((guix build utils))
339 #:builder
340 (begin
341 (use-modules (guix build utils))
342 (let ((source (assoc-ref %build-inputs "source")))
343 (copy-recursively (string-append source "/include")
344 (string-append %output "/include"))))))
345 (home-page "https://github.com/boostorg/signals2")
346 (synopsis "Boost.Signals2 library")
347 (description "The Boost.Signals2 library is an implementation of a managed
348signals and slots system.")
349 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"))))
350
f763eaaa
AE
351(define-public mdds
352 (package
353 (name "mdds")
ec2fdbf6 354 (version "1.5.0")
f763eaaa
AE
355 (source (origin
356 (method url-fetch)
357 (uri (string-append
57144094 358 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
f763eaaa
AE
359 (sha256
360 (base32
ec2fdbf6 361 "03b8i43pw4m767mm0cnbi77x7qhpkzpi9b1f6dpp4cmyszmnsk8l"))))
f763eaaa
AE
362 (build-system gnu-build-system)
363 (propagated-inputs
364 `(("boost" ,boost))) ; inclusion of header files
62d652a7 365 (home-page "https://gitlab.com/mdds/mdds")
f763eaaa
AE
366 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
367 (description "Mdds (multi-dimensional data structure) provides a
368collection of multi-dimensional data structures and indexing algorithms
369for C++. It includes flat segment trees, segment trees, rectangle sets,
370point quad trees, multi-type vectors and multi-type matrices.")
371 (license license:expat)))