gnu: MariaDB: Disable failing test on i686-linux.
[jackhill/guix/guix.git] / gnu / packages / boost.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2015, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
7 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
8 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
10 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
11 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
12 ;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
13 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
14 ;;; Copyright © 2019, 2020 Giacomo Leidi <goodoldpaul@autistici.org>
15 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
16 ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
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)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix utils)
36 #:use-module (guix packages)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system trivial)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages hurd)
44 #:use-module (gnu packages icu4c)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages shells)
48 #:use-module (srfi srfi-1))
49
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
61 (define-public boost
62 (package
63 (name "boost")
64 (version "1.72.0")
65 (source (origin
66 (method url-fetch)
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")))
76 (sha256
77 (base32
78 "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
79 (build-system gnu-build-system)
80 (inputs `(("icu4c" ,icu4c)
81 ("zlib" ,zlib)))
82 (native-inputs
83 `(("perl" ,perl)
84 ,@(if (%current-target-system)
85 '()
86 `(("python" ,python-wrapper)))
87 ("tcsh" ,tcsh)))
88 (arguments
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
94 #:make-flags
95 (list "threading=multi" "link=shared"
96
97 ;; Set the RUNPATH to $libdir so that the libs find each other.
98 (string-append "linkflags=-Wl,-rpath="
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 '()))
117 #:phases
118 (modify-phases %standard-phases
119 (delete 'bootstrap)
120 (replace 'configure
121 (lambda* (#:key inputs outputs #:allow-other-keys)
122 (let ((icu (assoc-ref inputs "icu4c"))
123 (python (assoc-ref inputs "python"))
124 (out (assoc-ref outputs "out")))
125 (substitute* '("libs/config/configure"
126 "libs/spirit/classic/phoenix/test/runtest.sh"
127 "tools/build/src/engine/execunix.cpp"
128 "tools/build/src/engine/Jambase")
129 (("/bin/sh") (which "sh")))
130
131 (setenv "SHELL" (which "sh"))
132 (setenv "CONFIG_SHELL" (which "sh"))
133
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
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
151 (invoke "./bootstrap.sh"
152 (string-append "--prefix=" out)
153 ;; Auto-detection looks for ICU only in traditional
154 ;; install locations.
155 (string-append "--with-icu=" icu)
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))))
163 "--with-toolset=gcc"))))
164 (replace 'build
165 (lambda* (#:key make-flags #:allow-other-keys)
166 (apply invoke "./b2"
167 (format #f "-j~a" (parallel-job-count))
168 make-flags)))
169 (replace 'install
170 (lambda* (#:key make-flags #:allow-other-keys)
171 (apply invoke "./b2" "install" make-flags)))
172 ,@(if (%current-target-system)
173 '()
174 '((add-after 'install 'provide-libboost_python
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")))
185 (with-directory-excursion (string-append out "/lib")
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")))
192 #t))))))))
193
194 (home-page "https://www.boost.org")
195 (synopsis "Peer-reviewed portable C++ source libraries")
196 (description
197 "A collection of libraries intended to be widely useful, and usable
198 across a broad spectrum of applications.")
199 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
200 "Some components have other similar licences."))))
201
202 (define-public boost-with-python2
203 (package
204 (inherit boost)
205 (name "boost-python2")
206 (native-inputs
207 `(("python" ,python-2)
208 ,@(alist-delete "python" (package-native-inputs boost))))))
209
210 (define-public boost-with-python3
211 (deprecated-package "boost-with-python3" boost))
212
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
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")))
234 (with-directory-excursion (string-append out "/lib")
235 (symlink libboost_pythonNN.a "libboost_python.a"))
236 #t)))))))))
237
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"))))
252 (arguments (substitute-keyword-arguments (package-arguments boost)
253 ((#:phases phases)
254 `(modify-phases ,phases
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)))
289 (properties '((hidden? . #t)))))
290
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
301 (url "https://github.com/boostorg/sync")
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
319 and events and other thread related facilities. Boost.Sync originated from
320 Boost.Thread.")
321 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
322
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
330 (url "https://github.com/boostorg/signals2")
331 (commit (string-append "boost-" version))))
332 (file-name (git-file-name name version))
333 (sha256
334 (base32
335 "13i5j43nggb46i6qpaf7gk53i7zp7pimphl7sydyfqz2m9yx5cdy"))))
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
348 signals and slots system.")
349 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"))))
350
351 (define-public mdds
352 (package
353 (name "mdds")
354 (version "1.5.0")
355 (source (origin
356 (method url-fetch)
357 (uri (string-append
358 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
359 (sha256
360 (base32
361 "03b8i43pw4m767mm0cnbi77x7qhpkzpi9b1f6dpp4cmyszmnsk8l"))))
362 (build-system gnu-build-system)
363 (propagated-inputs
364 `(("boost" ,boost))) ; inclusion of header files
365 (home-page "https://gitlab.com/mdds/mdds")
366 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
367 (description "Mdds (multi-dimensional data structure) provides a
368 collection of multi-dimensional data structures and indexing algorithms
369 for C++. It includes flat segment trees, segment trees, rectangle sets,
370 point quad trees, multi-type vectors and multi-type matrices.")
371 (license license:expat)))