aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/boost.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/boost.scm')
-rw-r--r--gnu/packages/boost.scm189
1 files changed, 109 insertions, 80 deletions
diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index 8bf2002adb..c3fc144cec 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -10,7 +10,9 @@
;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019, 2020 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -40,66 +42,113 @@
#:use-module (gnu packages icu4c)
#:use-module (gnu packages perl)
#:use-module (gnu packages python)
- #:use-module (gnu packages shells))
+ #:use-module (gnu packages shells)
+ #:use-module (srfi srfi-1))
+
+(define (version-with-underscores version)
+ (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
+
+(define (boost-patch name version hash)
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://www.boost.org/patches/"
+ (version-with-underscores version) "/" name))
+ (file-name (string-append "boost-" name))
+ (sha256 (base32 hash))))
(define-public boost
(package
(name "boost")
- (version "1.70.0")
+ (version "1.72.0")
(source (origin
(method url-fetch)
- (uri (let ((version-with-underscores
- (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)))
- (list (string-append "mirror://sourceforge/boost/boost/" version
- "/boost_" version-with-underscores ".tar.bz2")
- (string-append "https://dl.bintray.com/boostorg/release/"
- version "/source/boost_"
- version-with-underscores ".tar.bz2"))))
+ (uri (string-append "https://dl.bintray.com/boostorg/release/"
+ version "/source/boost_"
+ (version-with-underscores version) ".tar.bz2"))
+ (patches
+ (list (boost-patch
+ ;; 1.72.0 was released with a faulty coroutine submodule:
+ ;; <https://github.com/boostorg/coroutine/issues/46>.
+ "0001-revert-cease-dependence-on-range.patch" version
+ "1zcqxzh56m1s635wqwk15j3zcs2gmjvjy2f0hid7i78s4pgm0yfs")))
(sha256
(base32
- "0y47nc7w0arwgj4x1phadxbvl7wyfcgknbz5kv8lzpl98wsyh2j3"))))
+ "08h7cv61fd0lzb4z50xanfqn0pdgvizjrpd1kcdgj725pisb5jar"))))
(build-system gnu-build-system)
(inputs `(("icu4c" ,icu4c)
("zlib" ,zlib)))
(native-inputs
`(("perl" ,perl)
- ("python" ,python-2)
+ ,@(if (%current-target-system)
+ '()
+ `(("python" ,python-wrapper)))
("tcsh" ,tcsh)))
(arguments
- `(#:tests? #f
+ `(#:imported-modules ((guix build python-build-system)
+ ,@%gnu-build-system-modules)
+ #:modules (((guix build python-build-system) #:select (python-version))
+ ,@%gnu-build-system-modules)
+ #:tests? #f
#:make-flags
(list "threading=multi" "link=shared"
- ;; XXX: Disable installation of Boosts modular CMake config scripts
- ;; which conflicts in 1.70.0 with the ones provided by CMake.
- ;; See <https://bugs.gnu.org/36721>.
- "--no-cmake-config"
-
;; Set the RUNPATH to $libdir so that the libs find each other.
(string-append "linkflags=-Wl,-rpath="
- (assoc-ref %outputs "out") "/lib"))
+ (assoc-ref %outputs "out") "/lib")
+ ,@(if (%current-target-system)
+ `("--user-config=user-config.jam"
+ ;; Python is not supported when cross-compiling.
+ "--without-python"
+ "binary-format=elf"
+ "target-os=linux"
+ ,@(cond
+ ((string-prefix? "arm" (%current-target-system))
+ '("abi=aapcs"
+ "address-model=32"
+ "architecture=arm"))
+ ((string-prefix? "aarch64" (%current-target-system))
+ '("abi=aapcs"
+ "address-model=64"
+ "architecture=arm"))
+ (else '())))
+ '()))
#:phases
(modify-phases %standard-phases
(delete 'bootstrap)
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((icu (assoc-ref inputs "icu4c"))
+ (python (assoc-ref inputs "python"))
(out (assoc-ref outputs "out")))
(substitute* '("libs/config/configure"
"libs/spirit/classic/phoenix/test/runtest.sh"
- "tools/build/src/engine/execunix.c"
- "tools/build/src/engine/Jambase"
- "tools/build/src/engine/jambase.c")
+ "tools/build/src/engine/execunix.cpp"
+ "tools/build/src/engine/Jambase")
(("/bin/sh") (which "sh")))
(setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh"))
+ ,@(if (%current-target-system)
+ `((call-with-output-file "user-config.jam"
+ (lambda (port)
+ (format port
+ "using gcc : cross : ~a-c++ ;"
+ ,(%current-target-system)))))
+ '())
+
(invoke "./bootstrap.sh"
(string-append "--prefix=" out)
;; Auto-detection looks for ICU only in traditional
;; install locations.
(string-append "--with-icu=" icu)
+ ;; Ditto for Python.
+ ,@(if (%current-target-system)
+ '()
+ `((string-append "--with-python-root=" python)
+ (string-append "--with-python=" python "/bin/python")
+ (string-append "--with-python-version="
+ (python-version python))))
"--with-toolset=gcc"))))
(replace 'build
(lambda* (#:key make-flags #:allow-other-keys)
@@ -109,17 +158,27 @@
(replace 'install
(lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "./b2" "install" make-flags)))
- (add-after 'install 'provide-libboost_python
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- ;; Boost can build support for both Python 2 and Python 3 since
- ;; version 1.67.0, and suffixes each library with the Python
- ;; version. Many consumers only check for libboost_python
- ;; however, so we provide it here as suggested in
- ;; <https://github.com/boostorg/python/issues/203>.
- (with-directory-excursion (string-append out "/lib")
- (symlink "libboost_python27.so" "libboost_python.so"))
- #t))))))
+ ,@(if (%current-target-system)
+ '()
+ '((add-after 'install 'provide-libboost_python
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (python-version (python-version
+ (assoc-ref inputs "python")))
+ (libboost_pythonNN.so
+ (string-append "libboost_python"
+ (string-join (string-split
+ python-version #\.)
+ "")
+ ".so")))
+ (with-directory-excursion (string-append out "/lib")
+ (symlink libboost_pythonNN.so "libboost_python.so")
+ ;; Some packages only look for the major version.
+ (symlink libboost_pythonNN.so
+ (string-append "libboost_python"
+ (string-take python-version 1)
+ ".so")))
+ #t))))))))
(home-page "https://www.boost.org")
(synopsis "Peer-reviewed portable C++ source libraries")
@@ -129,54 +188,16 @@ across a broad spectrum of applications.")
(license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
"Some components have other similar licences."))))
-;; TODO: Merge with 'Boost' in the next rebuild cycle.
-(define-public boost-with-python3
+(define-public boost-with-python2
(package
(inherit boost)
- (name "boost-python3")
+ (name "boost-python2")
(native-inputs
- `(("perl" ,perl)
- ("python" ,python)
- ("tcsh" ,tcsh)))
- (arguments (substitute-keyword-arguments (package-arguments boost)
- ((#:phases phases)
- `(modify-phases ,phases
- (replace 'configure
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((icu (assoc-ref inputs "icu4c"))
- (python (assoc-ref inputs "python"))
- (out (assoc-ref outputs "out")))
- (substitute* '("libs/config/configure"
- "libs/spirit/classic/phoenix/test/runtest.sh"
- "tools/build/src/engine/execunix.c"
- "tools/build/src/engine/Jambase"
- "tools/build/src/engine/jambase.c")
- (("/bin/sh") (which "sh")))
-
- (setenv "SHELL" (which "sh"))
- (setenv "CONFIG_SHELL" (which "sh"))
+ `(("python" ,python-2)
+ ,@(alist-delete "python" (package-native-inputs boost))))))
- (substitute* "tools/build/src/tools/python.jam"
- (("include/python\\$\\(version\\)")
- "include/python$(version)m"))
-
- (invoke "./bootstrap.sh"
- (string-append "--prefix=" out)
- ;; Auto-detection looks for dependencies only
- ;; in traditional install locations.
- (string-append "--with-icu=" icu)
- (string-append "--with-python=" python "/bin/python3")
- (string-append "--with-python-root=" python)
- "--with-python-version=3.7"
- "--with-toolset=gcc"))))
- (replace 'provide-libboost_python
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- (with-directory-excursion (string-append out "/lib")
- (symlink "libboost_python37.so" "libboost_python.so")
- ;; Some packages also look for libboost_python3.so
- (symlink "libboost_python37.so" "libboost_python3.so"))
- #t)))))))))
+(define-public boost-with-python3
+ (deprecated-package "boost-with-python3" boost))
(define-public boost-static
(package
@@ -189,10 +210,18 @@ across a broad spectrum of applications.")
((#:phases phases)
`(modify-phases ,phases
(replace 'provide-libboost_python
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (python-version (python-version
+ (assoc-ref inputs "python")))
+ (libboost_pythonNN.a
+ (string-append "libboost_python"
+ (string-join (string-split
+ python-version #\.)
+ "")
+ ".a")))
(with-directory-excursion (string-append out "/lib")
- (symlink "libboost_python27.a" "libboost_python.a"))
+ (symlink libboost_pythonNN.a "libboost_python.a"))
#t)))))))))
(define-public boost-1.69