gnu: nnn: Don't use NAME in source URI.
[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 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-system gnu)
36 #:use-module (guix build-system trivial)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages icu4c)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages shells))
43
44 (define-public boost
45 (package
46 (name "boost")
47 (version "1.68.0")
48 (source (origin
49 (method url-fetch)
50 (uri (string-append
51 "mirror://sourceforge/boost/boost/" version "/boost_"
52 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
53 ".tar.bz2"))
54 (sha256
55 (base32
56 "1dyqsr9yb01y0nnjdq9b8q5s2kvhxbayk34832k5cpzn7jy30qbz"))
57 (patches (search-patches "boost-fix-icu-build.patch"))))
58 (build-system gnu-build-system)
59 (inputs `(("icu4c" ,icu4c)
60 ("zlib" ,zlib)))
61 (native-inputs
62 `(("perl" ,perl)
63 ("python" ,python-2)
64 ("tcsh" ,tcsh)))
65 (arguments
66 `(#:tests? #f
67 #:make-flags
68 (list "threading=multi" "link=shared"
69
70 ;; Set the RUNPATH to $libdir so that the libs find each other.
71 (string-append "linkflags=-Wl,-rpath="
72 (assoc-ref %outputs "out") "/lib"))
73 #:phases
74 (modify-phases %standard-phases
75 (delete 'bootstrap)
76 (replace 'configure
77 (lambda* (#:key inputs outputs #:allow-other-keys)
78 (let ((icu (assoc-ref inputs "icu4c"))
79 (out (assoc-ref outputs "out")))
80 (substitute* '("libs/config/configure"
81 "libs/spirit/classic/phoenix/test/runtest.sh"
82 "tools/build/src/engine/execunix.c"
83 "tools/build/src/engine/Jambase"
84 "tools/build/src/engine/jambase.c")
85 (("/bin/sh") (which "sh")))
86
87 (setenv "SHELL" (which "sh"))
88 (setenv "CONFIG_SHELL" (which "sh"))
89
90 (invoke "./bootstrap.sh"
91 (string-append "--prefix=" out)
92 ;; Auto-detection looks for ICU only in traditional
93 ;; install locations.
94 (string-append "--with-icu=" icu)
95 "--with-toolset=gcc"))))
96 (replace 'build
97 (lambda* (#:key make-flags #:allow-other-keys)
98 (apply invoke "./b2"
99 (format #f "-j~a" (parallel-job-count))
100 make-flags)))
101 (replace 'install
102 (lambda* (#:key make-flags #:allow-other-keys)
103 (apply invoke "./b2" "install" make-flags)))
104 (add-after 'install 'provide-libboost_python
105 (lambda* (#:key outputs #:allow-other-keys)
106 (let ((out (assoc-ref outputs "out")))
107 ;; Boost can build support for both Python 2 and Python 3 since
108 ;; version 1.67.0, and suffixes each library with the Python
109 ;; version. Many consumers only check for libboost_python
110 ;; however, so we provide it here as suggested in
111 ;; <https://github.com/boostorg/python/issues/203>.
112 (with-directory-excursion (string-append out "/lib")
113 (symlink "libboost_python27.so" "libboost_python.so"))
114 #t))))))
115
116 (home-page "https://www.boost.org")
117 (synopsis "Peer-reviewed portable C++ source libraries")
118 (description
119 "A collection of libraries intended to be widely useful, and usable
120 across a broad spectrum of applications.")
121 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
122 "Some components have other similar licences."))))
123
124 ;; Some programs need Boost to be built with C++14 support.
125 (define-public boost-cxx14
126 (package (inherit boost)
127 (arguments
128 (substitute-keyword-arguments (package-arguments boost)
129 ((#:make-flags flags)
130 `(append ,flags
131 '("cxxflags=-std=c++14")))))
132 (properties '((hidden? . #t)))))
133
134 (define-public boost-for-mysql
135 ;; Older version for MySQL 5.7.23.
136 (package
137 (inherit boost)
138 (version "1.59.0")
139 (source (origin
140 (method url-fetch)
141 (uri (string-append
142 "mirror://sourceforge/boost/boost/" version "/boost_"
143 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
144 ".tar.bz2"))
145 (sha256
146 (base32
147 "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
148 (arguments (substitute-keyword-arguments (package-arguments boost)
149 ((#:phases phases)
150 `(modify-phases ,phases
151 ;; This was removed after boost-1.67.
152 (add-before 'configure 'more-bin-sh-patching
153 (lambda _
154 (substitute* "tools/build/doc/bjam.qbk"
155 (("/bin/sh") (which "sh")))))
156 (delete 'provide-libboost_python)))))
157 (properties '((hidden? . #t)))))
158
159 (define-public boost-sync
160 (let ((commit "c72891d9b90e2ceb466ec859f640cd012b2d8709")
161 (version "1.55")
162 (revision "1"))
163 (package
164 (name "boost-sync")
165 (version (git-version version revision commit))
166 (source (origin
167 (method git-fetch)
168 (uri (git-reference
169 (url "https://github.com/boostorg/sync.git")
170 (commit commit)))
171 (file-name (git-file-name name version))
172 (sha256
173 (base32
174 "197mp5z048vz5kv1m4v3jm447l2gqsyv0rbfz11dz0ns343ihbyx"))))
175 (build-system trivial-build-system)
176 (arguments
177 `(#:modules ((guix build utils))
178 #:builder
179 (begin
180 (use-modules (guix build utils))
181 (let ((source (assoc-ref %build-inputs "source")))
182 (copy-recursively (string-append source "/include")
183 (string-append %output "/include"))))))
184 (home-page "https://github.com/boostorg/sync")
185 (synopsis "Boost.Sync library")
186 (description "The Boost.Sync library provides mutexes, semaphores, locks
187 and events and other thread related facilities. Boost.Sync originated from
188 Boost.Thread.")
189 (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt")))))
190
191 (define-public mdds
192 (package
193 (name "mdds")
194 (version "1.4.3")
195 (source (origin
196 (method url-fetch)
197 (uri (string-append
198 "http://kohei.us/files/mdds/src/mdds-" version ".tar.bz2"))
199 (sha256
200 (base32
201 "10cw6irdm6d15nxnys2v5akp8yz52qijpcjvw0frwq7nz5d3vki5"))))
202 (build-system gnu-build-system)
203 (propagated-inputs
204 `(("boost" ,boost))) ; inclusion of header files
205 (home-page "https://gitlab.com/mdds/mdds")
206 (synopsis "Multi-dimensional C++ data structures and indexing algorithms")
207 (description "Mdds (multi-dimensional data structure) provides a
208 collection of multi-dimensional data structures and indexing algorithms
209 for C++. It includes flat segment trees, segment trees, rectangle sets,
210 point quad trees, multi-type vectors and multi-type matrices.")
211 (license license:expat)))