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, 2021 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 ;;; Copyright © 2021 Franck Pérignon <franck.perignon@univ-grenoble-alpes.fr>
18 ;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
20 ;;; This file is part of GNU Guix.
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35 (define-module (gnu packages boost)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix utils)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system trivial)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages hurd)
46 #:use-module (gnu packages icu4c)
47 #:use-module (gnu packages llvm)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages shells)
51 #:use-module (gnu packages mpi)
52 #:use-module (srfi srfi-1))
54 (define (version-with-underscores version)
55 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
57 (define (boost-patch name version hash)
60 (uri (string-append "https://www.boost.org/patches/"
61 (version-with-underscores version) "/" name))
62 (file-name (string-append "boost-" name))
63 (sha256 (base32 hash))))
71 (uri (string-append "https://boostorg.jfrog.io/artifactory/main/release/"
72 version "/source/boost_"
73 (version-with-underscores version) ".tar.bz2"))
76 ;; 1.72.0 was released with a faulty coroutine submodule:
77 ;; <https://github.com/boostorg/coroutine/issues/46>.
78 "0001-revert-cease-dependence-on-range.patch" version
79 "1zcqxzh56m1s635wqwk15j3zcs2gmjvjy2f0hid7i78s4pgm0yfs")))
82 "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
83 (build-system gnu-build-system)
84 (inputs `(("icu4c" ,icu4c)
88 ,@(if (%current-target-system)
90 `(("python" ,python-wrapper)))
93 `(#:imported-modules ((guix build python-build-system)
94 ,@%gnu-build-system-modules)
95 #:modules (((guix build python-build-system) #:select (python-version))
96 ,@%gnu-build-system-modules)
99 (list "threading=multi" "link=shared"
101 ;; Set the RUNPATH to $libdir so that the libs find each other.
102 (string-append "linkflags=-Wl,-rpath="
103 (assoc-ref %outputs "out") "/lib")
104 ,@(if (%current-target-system)
105 `("--user-config=user-config.jam"
106 ;; Python is not supported when cross-compiling.
111 ((string-prefix? "arm" (%current-target-system))
115 ((string-prefix? "aarch64" (%current-target-system))
122 (modify-phases %standard-phases
125 (lambda* (#:key inputs outputs #:allow-other-keys)
126 (let ((icu (assoc-ref inputs "icu4c"))
127 (python (assoc-ref inputs "python"))
128 (out (assoc-ref outputs "out")))
129 (substitute* '("libs/config/configure"
130 "libs/spirit/classic/phoenix/test/runtest.sh"
131 "tools/build/src/engine/execunix.cpp"
132 "tools/build/src/engine/Jambase")
133 (("/bin/sh") (which "sh")))
135 (setenv "SHELL" (which "sh"))
136 (setenv "CONFIG_SHELL" (which "sh"))
138 ,@(if (%current-target-system)
139 `((call-with-output-file "user-config.jam"
142 "using gcc : cross : ~a-c++ ;"
143 ,(%current-target-system)))))
146 ;; Change an #ifdef __MACH__ that really targets macOS.
147 ;; TODO: Inline this on the next rebuild cycle.
149 '((substitute* "boost/test/utils/timer.hpp"
150 (("defined\\(__MACH__\\)")
151 "(defined __MACH__ && !defined __GNU__)"))
155 (invoke "./bootstrap.sh"
156 (string-append "--prefix=" out)
157 ;; Auto-detection looks for ICU only in traditional
158 ;; install locations.
159 (string-append "--with-icu=" icu)
161 ,@(if (%current-target-system)
163 `((string-append "--with-python-root=" python)
164 (string-append "--with-python=" python "/bin/python")
165 (string-append "--with-python-version="
166 (python-version python))))
167 "--with-toolset=gcc"))))
169 (lambda* (#:key make-flags #:allow-other-keys)
171 (format #f "-j~a" (parallel-job-count))
174 (lambda* (#:key make-flags #:allow-other-keys)
175 (apply invoke "./b2" "install" make-flags)))
176 ,@(if (%current-target-system)
178 '((add-after 'install 'provide-libboost_python
179 (lambda* (#:key inputs outputs #:allow-other-keys)
180 (let* ((out (assoc-ref outputs "out"))
181 (python-version (python-version
182 (assoc-ref inputs "python")))
183 (libboost_pythonNN.so
184 (string-append "libboost_python"
185 (string-join (string-split
189 (with-directory-excursion (string-append out "/lib")
190 (symlink libboost_pythonNN.so "libboost_python.so")
191 ;; Some packages only look for the major version.
192 (symlink libboost_pythonNN.so
193 (string-append "libboost_python"
194 (string-take python-version 1)
198 (home-page "https://www.boost.org")
199 (synopsis "Peer-reviewed portable C++ source libraries")
201 "A collection of libraries intended to be widely useful, and usable
202 across a broad spectrum of applications.")
203 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
204 "Some components have other similar licences."))))
206 ;; Sadly, this is needed for irods. It won't link with 1.69 or later.
207 (define-public boost-for-irods
210 (name "boost-for-irods")
215 "mirror://sourceforge/boost/boost/" version "/boost_"
216 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
220 "1dyqsr9yb01y0nnjdq9b8q5s2kvhxbayk34832k5cpzn7jy30qbz"))))
221 (build-system gnu-build-system)
222 (properties `((hidden? . #true)))
225 ("libcxx" ,libcxx+libcxxabi-6)
226 ("libcxxabi" ,libcxxabi-6)
235 (list "threading=multi" "link=shared"
236 "cxxflags=-stdlib=libc++"
239 ;; Set the RUNPATH to $libdir so that the libs find each other.
240 (string-append "linkflags=-stdlib=libc++ -Wl,-rpath="
241 (assoc-ref %outputs "out") "/lib"))
243 (modify-phases %standard-phases
245 (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
246 (lambda* (#:key native-inputs inputs #:allow-other-keys)
247 (let ((gcc (assoc-ref (or native-inputs inputs) "gcc")))
248 (setenv "CPLUS_INCLUDE_PATH"
250 (cons (string-append (assoc-ref inputs "libcxx")
252 ;; Hide GCC's C++ headers so that they do not interfere with
253 ;; the Clang headers.
254 (delete (string-append gcc "/include/c++")
255 (string-split (getenv "CPLUS_INCLUDE_PATH")
259 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
260 (getenv "CPLUS_INCLUDE_PATH")))))
262 (lambda* (#:key inputs outputs #:allow-other-keys)
263 (let ((icu (assoc-ref inputs "icu4c"))
264 (out (assoc-ref outputs "out"))
265 (sh (string-append (assoc-ref inputs "bash") "/bin/sh")))
266 (substitute* '("libs/config/configure"
267 "libs/spirit/classic/phoenix/test/runtest.sh"
268 "tools/build/src/engine/execunix.c"
269 "tools/build/src/engine/Jambase"
270 "tools/build/src/engine/jambase.c")
273 (setenv "SHELL" (which "sh"))
274 (setenv "CONFIG_SHELL" (which "sh"))
276 (invoke "./bootstrap.sh"
277 (string-append "--prefix=" out)
278 ;; Auto-detection looks for ICU only in traditional
279 ;; install locations.
280 (string-append "--with-icu=" icu)
281 "--with-toolset=clang"))))
283 (lambda* (#:key make-flags #:allow-other-keys)
285 (format #f "-j~a" (parallel-job-count))
288 (lambda* (#:key make-flags #:allow-other-keys)
289 (apply invoke "./b2" "install" make-flags))))))))
291 (define-public boost-with-python2
292 (package/inherit boost
293 (name "boost-python2")
295 `(("python" ,python-2)
296 ,@(alist-delete "python" (package-native-inputs boost))))))
298 (define-public boost-with-python3
299 (deprecated-package "boost-with-python3" boost))
301 (define-public boost-static
304 (name "boost-static")
306 (substitute-keyword-arguments (package-arguments boost)
307 ((#:make-flags flags)
308 `(cons "link=static" (delete "link=shared" ,flags)))
310 `(modify-phases ,phases
311 (replace 'provide-libboost_python
312 (lambda* (#:key inputs outputs #:allow-other-keys)
313 (let* ((out (assoc-ref outputs "out"))
314 (python-version (python-version
315 (assoc-ref inputs "python")))
317 (string-append "libboost_python"
318 (string-join (string-split
322 (with-directory-excursion (string-append out "/lib")
323 (symlink libboost_pythonNN.a "libboost_python.a"))
326 (define-public boost-for-mysql
327 ;; Older version for MySQL 5.7.23.
334 "mirror://sourceforge/boost/boost/" version "/boost_"
335 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
339 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
340 (arguments (substitute-keyword-arguments (package-arguments boost)
342 `(modify-phases ,phases
344 (lambda* (#:key inputs outputs #:allow-other-keys)
345 (let ((icu (assoc-ref inputs "icu4c"))
346 (out (assoc-ref outputs "out")))
348 (find-files "tools/build/src/engine/" "execunix\\.c.*")
349 '("libs/config/configure"
350 "libs/spirit/classic/phoenix/test/runtest.sh"
351 "tools/build/doc/bjam.qbk"
352 "tools/build/src/engine/Jambase"))
353 (("/bin/sh") (which "sh")))
355 (setenv "SHELL" (which "sh"))
356 (setenv "CONFIG_SHELL" (which "sh"))
358 ,@(if (%current-target-system)
359 `((call-with-output-file "user-config.jam"
362 "using gcc : cross : ~a-c++ ;"
363 ,(%current-target-system)))))
366 (invoke "./bootstrap.sh"
367 (string-append "--prefix=" out)
368 ;; Auto-detection looks for ICU only in traditional
369 ;; install locations.
370 (string-append "--with-icu=" icu)
371 "--with-toolset=gcc"))))
372 (delete 'provide-libboost_python)))
373 ((#:make-flags make-flags)
374 `(cons* "--without-python" ,make-flags))))
376 (alist-delete "python" (package-native-inputs boost)))
377 (properties '((hidden? . #t)))))
379 (define-public boost-sync
380 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
385 (version (git-version version revision commit))
389 (url "https://github.com/boostorg/sync")
391 (file-name (git-file-name name version))
394 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
395 (build-system trivial-build-system)
397 `(#:modules ((guix build utils))
400 (use-modules (guix build utils))
401 (let ((source (assoc-ref %build-inputs "source")))
402 (copy-recursively (string-append source "/include")
403 (string-append %output "/include"))))))
404 (home-page "https://github.com/boostorg/sync")
405 (synopsis "Boost.Sync library")
406 (description "The Boost.Sync library provides mutexes, semaphores, locks
407 and events and other thread related facilities. Boost.Sync originated from
409 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
411 (define-public boost-signals2
413 (name "boost-signals2")
414 (version (package-version boost))
418 (url "https://github.com/boostorg/signals2")
419 (commit (string-append "boost-" version))))
420 (file-name (git-file-name name version))
423 "13i5j43nggb46i6qpaf7gk53i7zp7pimphl7sydyfqz2m9yx5cdy"))))
424 (build-system trivial-build-system)
426 `(#:modules ((guix build utils))
429 (use-modules (guix build utils))
430 (let ((source (assoc-ref %build-inputs "source")))
431 (copy-recursively (string-append source "/include")
432 (string-append %output "/include"))))))
433 (home-page "https://github.com/boostorg/signals2")
434 (synopsis "Boost.Signals2 library")
435 (description "The Boost.Signals2 library is an implementation of a managed
436 signals and slots system.")
437 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"))))
440 (define-public boost-mpi
446 ,@(if (%current-target-system)
448 `(("python" ,python-wrapper)))
449 ("openmpi" , openmpi)))
451 (substitute-keyword-arguments (package-arguments boost)
453 `(modify-phases ,phases
454 (add-after 'configure 'update-jam
455 (lambda* (#:key inputs outputs #:allow-other-keys)
456 (let ((output-port (open-file "project-config.jam" "a")))
457 (display "using mpi ;" output-port)
458 (newline output-port)
459 (close output-port))))))))
460 (home-page "https://www.boost.org")
461 (synopsis "Message Passing Interface (MPI) library for C++")))
470 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
473 "03b8i43pw4m767mm0cnbi77x7qhpkzpi9b1f6dpp4cmyszmnsk8l"))))
474 (build-system gnu-build-system)
476 `(("boost" ,boost))) ; inclusion of header files
477 (home-page "https://gitlab.com/mdds/mdds")
478 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
479 (description "Mdds (multi-dimensional data structure) provides a
480 collection of multi-dimensional data structures and indexing algorithms
481 for C++. It includes flat segment trees, segment trees, rectangle sets,
482 point quad trees, multi-type vectors and multi-type matrices.")
483 (license license:expat)))