gnu: Remove ".git" from "https://github/…/….git".
[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>
a0828560 16;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
2a72eeee
JD
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)
b5b73a82 34 #:use-module ((guix licenses) #:prefix license:)
da39ff58 35 #:use-module (guix utils)
2a72eeee
JD
36 #:use-module (guix packages)
37 #:use-module (guix download)
7624300c 38 #:use-module (guix git-download)
2a72eeee 39 #:use-module (guix build-system gnu)
7624300c 40 #:use-module (guix build-system trivial)
2a72eeee 41 #:use-module (gnu packages)
c28ba7aa 42 #:use-module (gnu packages compression)
bd590b96
LF
43 #:use-module (gnu packages icu4c)
44 #:use-module (gnu packages perl)
2a72eeee 45 #:use-module (gnu packages python)
2ac164a8
GL
46 #:use-module (gnu packages shells)
47 #:use-module (srfi srfi-1))
2a72eeee 48
5cde458b
MB
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
2a72eeee
JD
60(define-public boost
61 (package
62 (name "boost")
02fef961 63 (version "1.72.0")
2a72eeee
JD
64 (source (origin
65 (method url-fetch)
5cde458b
MB
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")))
2a72eeee
JD
75 (sha256
76 (base32
02fef961 77 "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
2a72eeee 78 (build-system gnu-build-system)
bd590b96
LF
79 (inputs `(("icu4c" ,icu4c)
80 ("zlib" ,zlib)))
2a72eeee
JD
81 (native-inputs
82 `(("perl" ,perl)
a4c04bee
MO
83 ,@(if (%current-target-system)
84 '()
2ac164a8 85 `(("python" ,python-wrapper)))
2a72eeee
JD
86 ("tcsh" ,tcsh)))
87 (arguments
2ac164a8
GL
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
f828ff5b
DT
93 #:make-flags
94 (list "threading=multi" "link=shared"
53a53be9 95
f828ff5b
DT
96 ;; Set the RUNPATH to $libdir so that the libs find each other.
97 (string-append "linkflags=-Wl,-rpath="
a4c04bee
MO
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 '()))
f828ff5b
DT
116 #:phases
117 (modify-phases %standard-phases
df216847 118 (delete 'bootstrap)
baef70bb 119 (replace 'configure
713c975a
MW
120 (lambda* (#:key inputs outputs #:allow-other-keys)
121 (let ((icu (assoc-ref inputs "icu4c"))
2ac164a8 122 (python (assoc-ref inputs "python"))
713c975a 123 (out (assoc-ref outputs "out")))
f828ff5b
DT
124 (substitute* '("libs/config/configure"
125 "libs/spirit/classic/phoenix/test/runtest.sh"
02fef961
MB
126 "tools/build/src/engine/execunix.cpp"
127 "tools/build/src/engine/Jambase")
f828ff5b 128 (("/bin/sh") (which "sh")))
aaf77acc 129
f828ff5b
DT
130 (setenv "SHELL" (which "sh"))
131 (setenv "CONFIG_SHELL" (which "sh"))
aaf77acc 132
a4c04bee
MO
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
baef70bb
AI
141 (invoke "./bootstrap.sh"
142 (string-append "--prefix=" out)
713c975a
MW
143 ;; Auto-detection looks for ICU only in traditional
144 ;; install locations.
145 (string-append "--with-icu=" icu)
2ac164a8
GL
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))))
196fb12c 153 "--with-toolset=gcc"))))
baef70bb 154 (replace 'build
196fb12c 155 (lambda* (#:key make-flags #:allow-other-keys)
baef70bb
AI
156 (apply invoke "./b2"
157 (format #f "-j~a" (parallel-job-count))
196fb12c 158 make-flags)))
baef70bb 159 (replace 'install
196fb12c 160 (lambda* (#:key make-flags #:allow-other-keys)
bd65ecf4 161 (apply invoke "./b2" "install" make-flags)))
a4c04bee
MO
162 ,@(if (%current-target-system)
163 '()
164 '((add-after 'install 'provide-libboost_python
2ac164a8
GL
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")))
a4c04bee 175 (with-directory-excursion (string-append out "/lib")
2ac164a8
GL
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")))
a4c04bee 182 #t))))))))
2a72eeee 183
a2cfe190 184 (home-page "https://www.boost.org")
2a72eeee
JD
185 (synopsis "Peer-reviewed portable C++ source libraries")
186 (description
187 "A collection of libraries intended to be widely useful, and usable
188across a broad spectrum of applications.")
a2cfe190 189 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
2a72eeee 190 "Some components have other similar licences."))))
f763eaaa 191
2ac164a8 192(define-public boost-with-python2
12156a45
GL
193 (package
194 (inherit boost)
2ac164a8 195 (name "boost-python2")
12156a45 196 (native-inputs
2ac164a8
GL
197 `(("python" ,python-2)
198 ,@(alist-delete "python" (package-native-inputs boost))))))
12156a45 199
03d66a84
MB
200(define-public boost-with-python3
201 (deprecated-package "boost-with-python3" boost))
202
31872b3e
EF
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
0e907e27
MB
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")))
31872b3e 224 (with-directory-excursion (string-append out "/lib")
0e907e27 225 (symlink libboost_pythonNN.a "libboost_python.a"))
31872b3e
EF
226 #t)))))))))
227
444488fc
LC
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"))))
da39ff58
EF
242 (arguments (substitute-keyword-arguments (package-arguments boost)
243 ((#:phases phases)
244 `(modify-phases ,phases
a0828560
EF
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)))
444488fc
LC
279 (properties '((hidden? . #t)))))
280
7624300c
MC
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
b0e7b699 291 (url "https://github.com/boostorg/sync")
7624300c
MC
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
309and events and other thread related facilities. Boost.Sync originated from
310Boost.Thread.")
a2cfe190 311 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
7624300c 312
71154fe7
RW
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
b0e7b699 320 (url "https://github.com/boostorg/signals2")
71154fe7
RW
321 (commit (string-append "boost-" version))))
322 (file-name (git-file-name name version))
323 (sha256
324 (base32
ecab53c3 325 "13i5j43nggb46i6qpaf7gk53i7zp7pimphl7sydyfqz2m9yx5cdy"))))
71154fe7
RW
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
338signals and slots system.")
339 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"))))
340
f763eaaa
AE
341(define-public mdds
342 (package
343 (name "mdds")
ec2fdbf6 344 (version "1.5.0")
f763eaaa
AE
345 (source (origin
346 (method url-fetch)
347 (uri (string-append
57144094 348 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
f763eaaa
AE
349 (sha256
350 (base32
ec2fdbf6 351 "03b8i43pw4m767mm0cnbi77x7qhpkzpi9b1f6dpp4cmyszmnsk8l"))))
f763eaaa
AE
352 (build-system gnu-build-system)
353 (propagated-inputs
354 `(("boost" ,boost))) ; inclusion of header files
62d652a7 355 (home-page "https://gitlab.com/mdds/mdds")
f763eaaa
AE
356 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
357 (description "Mdds (multi-dimensional data structure) provides a
358collection of multi-dimensional data structures and indexing algorithms
359for C++. It includes flat segment trees, segment trees, rectangle sets,
360point quad trees, multi-type vectors and multi-type matrices.")
361 (license license:expat)))