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