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