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 ;;; Copyright © 2021 Franck Pérignon <franck.perignon@univ-grenoble-alpes.fr>
19 ;;; This file is part of GNU Guix.
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.
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.
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/>.
34 (define-module (gnu packages boost)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix utils)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system trivial)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages hurd)
45 #:use-module (gnu packages icu4c)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages shells)
49 #:use-module (gnu packages mpi)
50 #:use-module (srfi srfi-1))
52 (define (version-with-underscores version)
53 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
55 (define (boost-patch name version hash)
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))))
69 (uri (string-append "https://dl.bintray.com/boostorg/release/"
70 version "/source/boost_"
71 (version-with-underscores version) ".tar.bz2"))
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")))
80 "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
81 (build-system gnu-build-system)
82 (inputs `(("icu4c" ,icu4c)
86 ,@(if (%current-target-system)
88 `(("python" ,python-wrapper)))
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)
97 (list "threading=multi" "link=shared"
99 ;; Set the RUNPATH to $libdir so that the libs find each other.
100 (string-append "linkflags=-Wl,-rpath="
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.
109 ((string-prefix? "arm" (%current-target-system))
113 ((string-prefix? "aarch64" (%current-target-system))
120 (modify-phases %standard-phases
123 (lambda* (#:key inputs outputs #:allow-other-keys)
124 (let ((icu (assoc-ref inputs "icu4c"))
125 (python (assoc-ref inputs "python"))
126 (out (assoc-ref outputs "out")))
127 (substitute* '("libs/config/configure"
128 "libs/spirit/classic/phoenix/test/runtest.sh"
129 "tools/build/src/engine/execunix.cpp"
130 "tools/build/src/engine/Jambase")
131 (("/bin/sh") (which "sh")))
133 (setenv "SHELL" (which "sh"))
134 (setenv "CONFIG_SHELL" (which "sh"))
136 ,@(if (%current-target-system)
137 `((call-with-output-file "user-config.jam"
140 "using gcc : cross : ~a-c++ ;"
141 ,(%current-target-system)))))
144 ;; Change an #ifdef __MACH__ that really targets macOS.
145 ;; TODO: Inline this on the next rebuild cycle.
147 '((substitute* "boost/test/utils/timer.hpp"
148 (("defined\\(__MACH__\\)")
149 "(defined __MACH__ && !defined __GNU__)"))
153 (invoke "./bootstrap.sh"
154 (string-append "--prefix=" out)
155 ;; Auto-detection looks for ICU only in traditional
156 ;; install locations.
157 (string-append "--with-icu=" icu)
159 ,@(if (%current-target-system)
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))))
165 "--with-toolset=gcc"))))
167 (lambda* (#:key make-flags #:allow-other-keys)
169 (format #f "-j~a" (parallel-job-count))
172 (lambda* (#:key make-flags #:allow-other-keys)
173 (apply invoke "./b2" "install" make-flags)))
174 ,@(if (%current-target-system)
176 '((add-after 'install 'provide-libboost_python
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
187 (with-directory-excursion (string-append out "/lib")
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)
196 (home-page "https://www.boost.org")
197 (synopsis "Peer-reviewed portable C++ source libraries")
199 "A collection of libraries intended to be widely useful, and usable
200 across a broad spectrum of applications.")
201 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
202 "Some components have other similar licences."))))
204 (define-public boost-with-python2
205 (package/inherit boost
206 (name "boost-python2")
208 `(("python" ,python-2)
209 ,@(alist-delete "python" (package-native-inputs boost))))))
211 (define-public boost-with-python3
212 (deprecated-package "boost-with-python3" boost))
214 (define-public boost-static
217 (name "boost-static")
219 (substitute-keyword-arguments (package-arguments boost)
220 ((#:make-flags flags)
221 `(cons "link=static" (delete "link=shared" ,flags)))
223 `(modify-phases ,phases
224 (replace 'provide-libboost_python
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")))
230 (string-append "libboost_python"
231 (string-join (string-split
235 (with-directory-excursion (string-append out "/lib")
236 (symlink libboost_pythonNN.a "libboost_python.a"))
239 (define-public boost-for-mysql
240 ;; Older version for MySQL 5.7.23.
247 "mirror://sourceforge/boost/boost/" version "/boost_"
248 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
252 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
253 (arguments (substitute-keyword-arguments (package-arguments boost)
255 `(modify-phases ,phases
257 (lambda* (#:key inputs outputs #:allow-other-keys)
258 (let ((icu (assoc-ref inputs "icu4c"))
259 (out (assoc-ref outputs "out")))
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")))
268 (setenv "SHELL" (which "sh"))
269 (setenv "CONFIG_SHELL" (which "sh"))
271 ,@(if (%current-target-system)
272 `((call-with-output-file "user-config.jam"
275 "using gcc : cross : ~a-c++ ;"
276 ,(%current-target-system)))))
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))))
289 (alist-delete "python" (package-native-inputs boost)))
290 (properties '((hidden? . #t)))))
292 (define-public boost-sync
293 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
298 (version (git-version version revision commit))
302 (url "https://github.com/boostorg/sync")
304 (file-name (git-file-name name version))
307 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
308 (build-system trivial-build-system)
310 `(#:modules ((guix build utils))
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
322 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
324 (define-public boost-signals2
326 (name "boost-signals2")
327 (version (package-version boost))
331 (url "https://github.com/boostorg/signals2")
332 (commit (string-append "boost-" version))))
333 (file-name (git-file-name name version))
336 "13i5j43nggb46i6qpaf7gk53i7zp7pimphl7sydyfqz2m9yx5cdy"))))
337 (build-system trivial-build-system)
339 `(#:modules ((guix build utils))
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"))))
353 (define-public boost-mpi
359 ,@(if (%current-target-system)
361 `(("python" ,python-wrapper)))
362 ("openmpi" , openmpi)))
364 (substitute-keyword-arguments (package-arguments boost)
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++")))
383 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
386 "03b8i43pw4m767mm0cnbi77x7qhpkzpi9b1f6dpp4cmyszmnsk8l"))))
387 (build-system gnu-build-system)
389 `(("boost" ,boost))) ; inclusion of header files
390 (home-page "https://gitlab.com/mdds/mdds")
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)))