gnu: mono: Make build reproducible.
[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 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 Ricardo Wurmus <rekado@elephly.net>
11 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
12 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages boost)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix utils)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build utils)
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.68.0")
49 (source (origin
50 (method url-fetch)
51 (uri (string-append
52 "mirror://sourceforge/boost/boost/" version "/boost_"
53 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
54 ".tar.bz2"))
55 (sha256
56 (base32
57 "1dyqsr9yb01y0nnjdq9b8q5s2kvhxbayk34832k5cpzn7jy30qbz"))
58 (patches (search-patches "boost-fix-icu-build.patch"))))
59 (build-system gnu-build-system)
60 (inputs `(("icu4c" ,icu4c)
61 ("zlib" ,zlib)))
62 (native-inputs
63 `(("perl" ,perl)
64 ("python" ,python-2)
65 ("tcsh" ,tcsh)))
66 (arguments
67 `(#:tests? #f
68 #:make-flags
69 (list "threading=multi" "link=shared"
70
71 ;; Set the RUNPATH to $libdir so that the libs find each other.
72 (string-append "linkflags=-Wl,-rpath="
73 (assoc-ref %outputs "out") "/lib"))
74 #:phases
75 (modify-phases %standard-phases
76 (delete 'bootstrap)
77 (replace 'configure
78 (lambda* (#:key inputs outputs #:allow-other-keys)
79 (let ((icu (assoc-ref inputs "icu4c"))
80 (out (assoc-ref outputs "out")))
81 (substitute* '("libs/config/configure"
82 "libs/spirit/classic/phoenix/test/runtest.sh"
83 "tools/build/src/engine/execunix.c"
84 "tools/build/src/engine/Jambase"
85 "tools/build/src/engine/jambase.c")
86 (("/bin/sh") (which "sh")))
87
88 (setenv "SHELL" (which "sh"))
89 (setenv "CONFIG_SHELL" (which "sh"))
90
91 (invoke "./bootstrap.sh"
92 (string-append "--prefix=" out)
93 ;; Auto-detection looks for ICU only in traditional
94 ;; install locations.
95 (string-append "--with-icu=" icu)
96 "--with-toolset=gcc"))))
97 (replace 'build
98 (lambda* (#:key make-flags #:allow-other-keys)
99 (apply invoke "./b2"
100 (format #f "-j~a" (parallel-job-count))
101 make-flags)))
102 (replace 'install
103 (lambda* (#:key make-flags #:allow-other-keys)
104 (apply invoke "./b2" "install" make-flags)))
105 (add-after 'install 'provide-libboost_python
106 (lambda* (#:key outputs #:allow-other-keys)
107 (let ((out (assoc-ref outputs "out")))
108 ;; Boost can build support for both Python 2 and Python 3 since
109 ;; version 1.67.0, and suffixes each library with the Python
110 ;; version. Many consumers only check for libboost_python
111 ;; however, so we provide it here as suggested in
112 ;; <https://github.com/boostorg/python/issues/203>.
113 (with-directory-excursion (string-append out "/lib")
114 (symlink "libboost_python27.so" "libboost_python.so"))
115 #t))))))
116
117 (home-page "https://www.boost.org")
118 (synopsis "Peer-reviewed portable C++ source libraries")
119 (description
120 "A collection of libraries intended to be widely useful, and usable
121 across a broad spectrum of applications.")
122 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
123 "Some components have other similar licences."))))
124
125 (define-public boost-for-mysql
126 ;; Older version for MySQL 5.7.23.
127 (package
128 (inherit boost)
129 (version "1.59.0")
130 (source (origin
131 (method url-fetch)
132 (uri (string-append
133 "mirror://sourceforge/boost/boost/" version "/boost_"
134 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
135 ".tar.bz2"))
136 (sha256
137 (base32
138 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
139 (arguments (substitute-keyword-arguments (package-arguments boost)
140 ((#:phases phases)
141 `(modify-phases ,phases
142 ;; This was removed after boost-1.67.
143 (add-before 'configure 'more-bin-sh-patching
144 (lambda _
145 (substitute* "tools/build/doc/bjam.qbk"
146 (("/bin/sh") (which "sh")))))
147 (delete 'provide-libboost_python)))))
148 (properties '((hidden? . #t)))))
149
150 (define-public boost-sync
151 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
152 (version "1.55")
153 (revision "1"))
154 (package
155 (name "boost-sync")
156 (version (git-version version revision commit))
157 (source (origin
158 (method git-fetch)
159 (uri (git-reference
160 (url "https://github.com/boostorg/sync.git")
161 (commit commit)))
162 (file-name (git-file-name name version))
163 (sha256
164 (base32
165 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
166 (build-system trivial-build-system)
167 (arguments
168 `(#:modules ((guix build utils))
169 #:builder
170 (begin
171 (use-modules (guix build utils))
172 (let ((source (assoc-ref %build-inputs "source")))
173 (copy-recursively (string-append source "/include")
174 (string-append %output "/include"))))))
175 (home-page "https://github.com/boostorg/sync")
176 (synopsis "Boost.Sync library")
177 (description "The Boost.Sync library provides mutexes, semaphores, locks
178 and events and other thread related facilities. Boost.Sync originated from
179 Boost.Thread.")
180 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
181
182 (define-public mdds
183 (package
184 (name "mdds")
185 (version "1.4.3")
186 (source (origin
187 (method url-fetch)
188 (uri (string-append
189 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
190 (sha256
191 (base32
192 "10cw6irdm6d15nxnys2v5akp8yz52qijpcjvw0frwq7nz5d3vki5"))))
193 (build-system gnu-build-system)
194 (propagated-inputs
195 `(("boost" ,boost))) ; inclusion of header files
196 (home-page "https://gitlab.com/mdds/mdds")
197 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
198 (description "Mdds (multi-dimensional data structure) provides a
199 collection of multi-dimensional data structures and indexing algorithms
200 for C++. It includes flat segment trees, segment trees, rectangle sets,
201 point quad trees, multi-type vectors and multi-type matrices.")
202 (license license:expat)))