gnu: deutex: Update to 5.2.1.
[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 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 Efraim Flashner <efraim@flashner.co.il>
13 ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages boost)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix utils)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system trivial)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages icu4c)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages shells))
44
45 (define-public boost
46 (package
47 (name "boost")
48 (version "1.70.0")
49 (source (origin
50 (method url-fetch)
51 (uri (let ((version-with-underscores
52 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)))
53 (list (string-append "mirror://sourceforge/boost/boost/" version
54 "/boost_" version-with-underscores ".tar.bz2")
55 (string-append "https://dl.bintray.com/boostorg/release/"
56 version "/source/boost_"
57 version-with-underscores ".tar.bz2"))))
58 (sha256
59 (base32
60 "0y47nc7w0arwgj4x1phadxbvl7wyfcgknbz5kv8lzpl98wsyh2j3"))))
61 (build-system gnu-build-system)
62 (inputs `(("icu4c" ,icu4c)
63 ("zlib" ,zlib)))
64 (native-inputs
65 `(("perl" ,perl)
66 ("python" ,python-2)
67 ("tcsh" ,tcsh)))
68 (arguments
69 `(#:tests? #f
70 #:make-flags
71 (list "threading=multi" "link=shared"
72
73 ;; XXX: Disable installation of Boosts modular CMake config scripts
74 ;; which conflicts in 1.70.0 with the ones provided by CMake.
75 ;; See <https://bugs.gnu.org/36721>.
76 "--no-cmake-config"
77
78 ;; Set the RUNPATH to $libdir so that the libs find each other.
79 (string-append "linkflags=-Wl,-rpath="
80 (assoc-ref %outputs "out") "/lib"))
81 #:phases
82 (modify-phases %standard-phases
83 (delete 'bootstrap)
84 (replace 'configure
85 (lambda* (#:key inputs outputs #:allow-other-keys)
86 (let ((icu (assoc-ref inputs "icu4c"))
87 (out (assoc-ref outputs "out")))
88 (substitute* '("libs/config/configure"
89 "libs/spirit/classic/phoenix/test/runtest.sh"
90 "tools/build/src/engine/execunix.c"
91 "tools/build/src/engine/Jambase"
92 "tools/build/src/engine/jambase.c")
93 (("/bin/sh") (which "sh")))
94
95 (setenv "SHELL" (which "sh"))
96 (setenv "CONFIG_SHELL" (which "sh"))
97
98 (invoke "./bootstrap.sh"
99 (string-append "--prefix=" out)
100 ;; Auto-detection looks for ICU only in traditional
101 ;; install locations.
102 (string-append "--with-icu=" icu)
103 "--with-toolset=gcc"))))
104 (replace 'build
105 (lambda* (#:key make-flags #:allow-other-keys)
106 (apply invoke "./b2"
107 (format #f "-j~a" (parallel-job-count))
108 make-flags)))
109 (replace 'install
110 (lambda* (#:key make-flags #:allow-other-keys)
111 (apply invoke "./b2" "install" make-flags)))
112 (add-after 'install 'provide-libboost_python
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let ((out (assoc-ref outputs "out")))
115 ;; Boost can build support for both Python 2 and Python 3 since
116 ;; version 1.67.0, and suffixes each library with the Python
117 ;; version. Many consumers only check for libboost_python
118 ;; however, so we provide it here as suggested in
119 ;; <https://github.com/boostorg/python/issues/203>.
120 (with-directory-excursion (string-append out "/lib")
121 (symlink "libboost_python27.so" "libboost_python.so"))
122 #t))))))
123
124 (home-page "https://www.boost.org")
125 (synopsis "Peer-reviewed portable C++ source libraries")
126 (description
127 "A collection of libraries intended to be widely useful, and usable
128 across a broad spectrum of applications.")
129 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
130 "Some components have other similar licences."))))
131
132 ;; TODO: Merge with 'Boost' in the next rebuild cycle.
133 (define-public boost-with-python3
134 (package
135 (inherit boost)
136 (name "boost-python3")
137 (native-inputs
138 `(("perl" ,perl)
139 ("python" ,python)
140 ("tcsh" ,tcsh)))
141 (arguments (substitute-keyword-arguments (package-arguments boost)
142 ((#:phases phases)
143 `(modify-phases ,phases
144 (replace 'configure
145 (lambda* (#:key inputs outputs #:allow-other-keys)
146 (let ((icu (assoc-ref inputs "icu4c"))
147 (python (assoc-ref inputs "python"))
148 (out (assoc-ref outputs "out")))
149 (substitute* '("libs/config/configure"
150 "libs/spirit/classic/phoenix/test/runtest.sh"
151 "tools/build/src/engine/execunix.c"
152 "tools/build/src/engine/Jambase"
153 "tools/build/src/engine/jambase.c")
154 (("/bin/sh") (which "sh")))
155
156 (setenv "SHELL" (which "sh"))
157 (setenv "CONFIG_SHELL" (which "sh"))
158
159 (substitute* "tools/build/src/tools/python.jam"
160 (("include/python\\$\\(version\\)")
161 "include/python$(version)m"))
162
163 (invoke "./bootstrap.sh"
164 (string-append "--prefix=" out)
165 ;; Auto-detection looks for dependencies only
166 ;; in traditional install locations.
167 (string-append "--with-icu=" icu)
168 (string-append "--with-python=" python "/bin/python3")
169 (string-append "--with-python-root=" python)
170 "--with-python-version=3.7"
171 "--with-toolset=gcc"))))
172 (replace 'provide-libboost_python
173 (lambda* (#:key outputs #:allow-other-keys)
174 (let ((out (assoc-ref outputs "out")))
175 (with-directory-excursion (string-append out "/lib")
176 (symlink "libboost_python37.so" "libboost_python.so")
177 ;; Some packages also look for libboost_python3.so
178 (symlink "libboost_python37.so" "libboost_python3.so"))
179 #t)))))))))
180
181 (define-public boost-static
182 (package
183 (inherit boost)
184 (name "boost-static")
185 (arguments
186 (substitute-keyword-arguments (package-arguments boost)
187 ((#:make-flags flags)
188 `(cons "link=static" (delete "link=shared" ,flags)))
189 ((#:phases phases)
190 `(modify-phases ,phases
191 (replace 'provide-libboost_python
192 (lambda* (#:key outputs #:allow-other-keys)
193 (let ((out (assoc-ref outputs "out")))
194 (with-directory-excursion (string-append out "/lib")
195 (symlink "libboost_python27.a" "libboost_python.a"))
196 #t)))))))))
197
198 (define-public boost-for-mysql
199 ;; Older version for MySQL 5.7.23.
200 (package
201 (inherit boost)
202 (version "1.59.0")
203 (source (origin
204 (method url-fetch)
205 (uri (string-append
206 "mirror://sourceforge/boost/boost/" version "/boost_"
207 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
208 ".tar.bz2"))
209 (sha256
210 (base32
211 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
212 (arguments (substitute-keyword-arguments (package-arguments boost)
213 ((#:phases phases)
214 `(modify-phases ,phases
215 ;; This was removed after boost-1.67.
216 (add-before 'configure 'more-bin-sh-patching
217 (lambda _
218 (substitute* "tools/build/doc/bjam.qbk"
219 (("/bin/sh") (which "sh")))))
220 (delete 'provide-libboost_python)))))
221 (properties '((hidden? . #t)))))
222
223 (define-public boost-sync
224 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
225 (version "1.55")
226 (revision "1"))
227 (package
228 (name "boost-sync")
229 (version (git-version version revision commit))
230 (source (origin
231 (method git-fetch)
232 (uri (git-reference
233 (url "https://github.com/boostorg/sync.git")
234 (commit commit)))
235 (file-name (git-file-name name version))
236 (sha256
237 (base32
238 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
239 (build-system trivial-build-system)
240 (arguments
241 `(#:modules ((guix build utils))
242 #:builder
243 (begin
244 (use-modules (guix build utils))
245 (let ((source (assoc-ref %build-inputs "source")))
246 (copy-recursively (string-append source "/include")
247 (string-append %output "/include"))))))
248 (home-page "https://github.com/boostorg/sync")
249 (synopsis "Boost.Sync library")
250 (description "The Boost.Sync library provides mutexes, semaphores, locks
251 and events and other thread related facilities. Boost.Sync originated from
252 Boost.Thread.")
253 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
254
255 (define-public boost-signals2
256 (package
257 (name "boost-signals2")
258 (version (package-version boost))
259 (source (origin
260 (method git-fetch)
261 (uri (git-reference
262 (url "https://github.com/boostorg/signals2.git")
263 (commit (string-append "boost-" version))))
264 (file-name (git-file-name name version))
265 (sha256
266 (base32
267 "1nayaqshhzr1n6jj43bpvvay36d5gn075h0b95psii5x8ingszdk"))))
268 (build-system trivial-build-system)
269 (arguments
270 `(#:modules ((guix build utils))
271 #:builder
272 (begin
273 (use-modules (guix build utils))
274 (let ((source (assoc-ref %build-inputs "source")))
275 (copy-recursively (string-append source "/include")
276 (string-append %output "/include"))))))
277 (home-page "https://github.com/boostorg/signals2")
278 (synopsis "Boost.Signals2 library")
279 (description "The Boost.Signals2 library is an implementation of a managed
280 signals and slots system.")
281 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"))))
282
283 (define-public mdds
284 (package
285 (name "mdds")
286 (version "1.4.3")
287 (source (origin
288 (method url-fetch)
289 (uri (string-append
290 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
291 (sha256
292 (base32
293 "10cw6irdm6d15nxnys2v5akp8yz52qijpcjvw0frwq7nz5d3vki5"))))
294 (build-system gnu-build-system)
295 (propagated-inputs
296 `(("boost" ,boost))) ; inclusion of header files
297 (home-page "https://gitlab.com/mdds/mdds")
298 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
299 (description "Mdds (multi-dimensional data structure) provides a
300 collection of multi-dimensional data structures and indexing algorithms
301 for C++. It includes flat segment trees, segment trees, rectangle sets,
302 point quad trees, multi-type vectors and multi-type matrices.")
303 (license license:expat)))