gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[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, 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 icu4c)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages shells)
47 #:use-module (srfi srfi-1))
48
49 (define (version-with-underscores version)
50 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
51
52 (define (boost-patch name version hash)
53 (origin
54 (method url-fetch)
55 (uri (string-append "https://www.boost.org/patches/"
56 (version-with-underscores version) "/" name))
57 (file-name (string-append "boost-" name))
58 (sha256 (base32 hash))))
59
60 (define-public boost
61 (package
62 (name "boost")
63 (version "1.72.0")
64 (source (origin
65 (method url-fetch)
66 (uri (string-append "https://dl.bintray.com/boostorg/release/"
67 version "/source/boost_"
68 (version-with-underscores version) ".tar.bz2"))
69 (patches
70 (list (boost-patch
71 ;; 1.72.0 was released with a faulty coroutine submodule:
72 ;; <https://github.com/boostorg/coroutine/issues/46>.
73 "0001-revert-cease-dependence-on-range.patch" version
74 "1zcqxzh56m1s635wqwk15j3zcs2gmjvjy2f0hid7i78s4pgm0yfs")))
75 (sha256
76 (base32
77 "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
78 (build-system gnu-build-system)
79 (inputs `(("icu4c" ,icu4c)
80 ("zlib" ,zlib)))
81 (native-inputs
82 `(("perl" ,perl)
83 ,@(if (%current-target-system)
84 '()
85 `(("python" ,python-wrapper)))
86 ("tcsh" ,tcsh)))
87 (arguments
88 `(#:imported-modules ((guix build python-build-system)
89 ,@%gnu-build-system-modules)
90 #:modules (((guix build python-build-system) #:select (python-version))
91 ,@%gnu-build-system-modules)
92 #:tests? #f
93 #:make-flags
94 (list "threading=multi" "link=shared"
95
96 ;; Set the RUNPATH to $libdir so that the libs find each other.
97 (string-append "linkflags=-Wl,-rpath="
98 (assoc-ref %outputs "out") "/lib")
99 ,@(if (%current-target-system)
100 `("--user-config=user-config.jam"
101 ;; Python is not supported when cross-compiling.
102 "--without-python"
103 "binary-format=elf"
104 "target-os=linux"
105 ,@(cond
106 ((string-prefix? "arm" (%current-target-system))
107 '("abi=aapcs"
108 "address-model=32"
109 "architecture=arm"))
110 ((string-prefix? "aarch64" (%current-target-system))
111 '("abi=aapcs"
112 "address-model=64"
113 "architecture=arm"))
114 (else '())))
115 '()))
116 #:phases
117 (modify-phases %standard-phases
118 (delete 'bootstrap)
119 (replace 'configure
120 (lambda* (#:key inputs outputs #:allow-other-keys)
121 (let ((icu (assoc-ref inputs "icu4c"))
122 (python (assoc-ref inputs "python"))
123 (out (assoc-ref outputs "out")))
124 (substitute* '("libs/config/configure"
125 "libs/spirit/classic/phoenix/test/runtest.sh"
126 "tools/build/src/engine/execunix.cpp"
127 "tools/build/src/engine/Jambase")
128 (("/bin/sh") (which "sh")))
129
130 (setenv "SHELL" (which "sh"))
131 (setenv "CONFIG_SHELL" (which "sh"))
132
133 ,@(if (%current-target-system)
134 `((call-with-output-file "user-config.jam"
135 (lambda (port)
136 (format port
137 "using gcc : cross : ~a-c++ ;"
138 ,(%current-target-system)))))
139 '())
140
141 (invoke "./bootstrap.sh"
142 (string-append "--prefix=" out)
143 ;; Auto-detection looks for ICU only in traditional
144 ;; install locations.
145 (string-append "--with-icu=" icu)
146 ;; Ditto for Python.
147 ,@(if (%current-target-system)
148 '()
149 `((string-append "--with-python-root=" python)
150 (string-append "--with-python=" python "/bin/python")
151 (string-append "--with-python-version="
152 (python-version python))))
153 "--with-toolset=gcc"))))
154 (replace 'build
155 (lambda* (#:key make-flags #:allow-other-keys)
156 (apply invoke "./b2"
157 (format #f "-j~a" (parallel-job-count))
158 make-flags)))
159 (replace 'install
160 (lambda* (#:key make-flags #:allow-other-keys)
161 (apply invoke "./b2" "install" make-flags)))
162 ,@(if (%current-target-system)
163 '()
164 '((add-after 'install 'provide-libboost_python
165 (lambda* (#:key inputs outputs #:allow-other-keys)
166 (let* ((out (assoc-ref outputs "out"))
167 (python-version (python-version
168 (assoc-ref inputs "python")))
169 (libboost_pythonNN.so
170 (string-append "libboost_python"
171 (string-join (string-split
172 python-version #\.)
173 "")
174 ".so")))
175 (with-directory-excursion (string-append out "/lib")
176 (symlink libboost_pythonNN.so "libboost_python.so")
177 ;; Some packages only look for the major version.
178 (symlink libboost_pythonNN.so
179 (string-append "libboost_python"
180 (string-take python-version 1)
181 ".so")))
182 #t))))))))
183
184 (home-page "https://www.boost.org")
185 (synopsis "Peer-reviewed portable C++ source libraries")
186 (description
187 "A collection of libraries intended to be widely useful, and usable
188 across a broad spectrum of applications.")
189 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
190 "Some components have other similar licences."))))
191
192 (define-public boost-with-python2
193 (package
194 (inherit boost)
195 (name "boost-python2")
196 (native-inputs
197 `(("python" ,python-2)
198 ,@(alist-delete "python" (package-native-inputs boost))))))
199
200 (define-public boost-with-python3
201 (deprecated-package "boost-with-python3" boost))
202
203 (define-public boost-static
204 (package
205 (inherit boost)
206 (name "boost-static")
207 (arguments
208 (substitute-keyword-arguments (package-arguments boost)
209 ((#:make-flags flags)
210 `(cons "link=static" (delete "link=shared" ,flags)))
211 ((#:phases phases)
212 `(modify-phases ,phases
213 (replace 'provide-libboost_python
214 (lambda* (#:key inputs outputs #:allow-other-keys)
215 (let* ((out (assoc-ref outputs "out"))
216 (python-version (python-version
217 (assoc-ref inputs "python")))
218 (libboost_pythonNN.a
219 (string-append "libboost_python"
220 (string-join (string-split
221 python-version #\.)
222 "")
223 ".a")))
224 (with-directory-excursion (string-append out "/lib")
225 (symlink libboost_pythonNN.a "libboost_python.a"))
226 #t)))))))))
227
228 (define-public boost-for-mysql
229 ;; Older version for MySQL 5.7.23.
230 (package
231 (inherit boost)
232 (version "1.59.0")
233 (source (origin
234 (method url-fetch)
235 (uri (string-append
236 "mirror://sourceforge/boost/boost/" version "/boost_"
237 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
238 ".tar.bz2"))
239 (sha256
240 (base32
241 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
242 (arguments (substitute-keyword-arguments (package-arguments boost)
243 ((#:phases phases)
244 `(modify-phases ,phases
245 (replace 'configure
246 (lambda* (#:key inputs outputs #:allow-other-keys)
247 (let ((icu (assoc-ref inputs "icu4c"))
248 (out (assoc-ref outputs "out")))
249 (substitute* (append
250 (find-files "tools/build/src/engine/" "execunix\\.c.*")
251 '("libs/config/configure"
252 "libs/spirit/classic/phoenix/test/runtest.sh"
253 "tools/build/doc/bjam.qbk"
254 "tools/build/src/engine/Jambase"))
255 (("/bin/sh") (which "sh")))
256
257 (setenv "SHELL" (which "sh"))
258 (setenv "CONFIG_SHELL" (which "sh"))
259
260 ,@(if (%current-target-system)
261 `((call-with-output-file "user-config.jam"
262 (lambda (port)
263 (format port
264 "using gcc : cross : ~a-c++ ;"
265 ,(%current-target-system)))))
266 '())
267
268 (invoke "./bootstrap.sh"
269 (string-append "--prefix=" out)
270 ;; Auto-detection looks for ICU only in traditional
271 ;; install locations.
272 (string-append "--with-icu=" icu)
273 "--with-toolset=gcc"))))
274 (delete 'provide-libboost_python)))
275 ((#:make-flags make-flags)
276 `(cons* "--without-python" ,make-flags))))
277 (native-inputs
278 (alist-delete "python" (package-native-inputs boost)))
279 (properties '((hidden? . #t)))))
280
281 (define-public boost-sync
282 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
283 (version "1.55")
284 (revision "1"))
285 (package
286 (name "boost-sync")
287 (version (git-version version revision commit))
288 (source (origin
289 (method git-fetch)
290 (uri (git-reference
291 (url "https://github.com/boostorg/sync")
292 (commit commit)))
293 (file-name (git-file-name name version))
294 (sha256
295 (base32
296 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
297 (build-system trivial-build-system)
298 (arguments
299 `(#:modules ((guix build utils))
300 #:builder
301 (begin
302 (use-modules (guix build utils))
303 (let ((source (assoc-ref %build-inputs "source")))
304 (copy-recursively (string-append source "/include")
305 (string-append %output "/include"))))))
306 (home-page "https://github.com/boostorg/sync")
307 (synopsis "Boost.Sync library")
308 (description "The Boost.Sync library provides mutexes, semaphores, locks
309 and events and other thread related facilities. Boost.Sync originated from
310 Boost.Thread.")
311 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
312
313 (define-public boost-signals2
314 (package
315 (name "boost-signals2")
316 (version (package-version boost))
317 (source (origin
318 (method git-fetch)
319 (uri (git-reference
320 (url "https://github.com/boostorg/signals2")
321 (commit (string-append "boost-" version))))
322 (file-name (git-file-name name version))
323 (sha256
324 (base32
325 "13i5j43nggb46i6qpaf7gk53i7zp7pimphl7sydyfqz2m9yx5cdy"))))
326 (build-system trivial-build-system)
327 (arguments
328 `(#:modules ((guix build utils))
329 #:builder
330 (begin
331 (use-modules (guix build utils))
332 (let ((source (assoc-ref %build-inputs "source")))
333 (copy-recursively (string-append source "/include")
334 (string-append %output "/include"))))))
335 (home-page "https://github.com/boostorg/signals2")
336 (synopsis "Boost.Signals2 library")
337 (description "The Boost.Signals2 library is an implementation of a managed
338 signals and slots system.")
339 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"))))
340
341 (define-public mdds
342 (package
343 (name "mdds")
344 (version "1.5.0")
345 (source (origin
346 (method url-fetch)
347 (uri (string-append
348 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
349 (sha256
350 (base32
351 "03b8i43pw4m767mm0cnbi77x7qhpkzpi9b1f6dpp4cmyszmnsk8l"))))
352 (build-system gnu-build-system)
353 (propagated-inputs
354 `(("boost" ,boost))) ; inclusion of header files
355 (home-page "https://gitlab.com/mdds/mdds")
356 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
357 (description "Mdds (multi-dimensional data structure) provides a
358 collection of multi-dimensional data structures and indexing algorithms
359 for C++. It includes flat segment trees, segment trees, rectangle sets,
360 point quad trees, multi-type vectors and multi-type matrices.")
361 (license license:expat)))