[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
27/28: gnu: Boost: Use Python 3 by default.
From: |
guix-commits |
Subject: |
27/28: gnu: Boost: Use Python 3 by default. |
Date: |
Wed, 8 Jan 2020 15:58:51 -0500 (EST) |
mbakke pushed a commit to branch core-updates
in repository guix.
commit 2ac164a8107dbb07ba1ed29986859d3e936f795a
Author: Giacomo Leidi <address@hidden>
AuthorDate: Sun Dec 8 22:18:35 2019 +0100
gnu: Boost: Use Python 3 by default.
* gnu/packages/boost.scm (boost)[inputs]: Change PYTHON-2 to PYTHON-WRAPPER.
[arguments]: Add #:modules and #:imported-modules. Adjust phases
'configure'
and 'provide-libboost_python.so' to be agnostic of Python version.
* gnu/packages/boost.scm (boost-with-python3): Rename to ...
* gnu/packages/boost.scm (boost-with-python2): ... this.
[arguments]: Remove.
[native-inputs]: Inherit from BOOST, but replace the "python" input with
PYTHON-2.
Co-authored-by: Marius Bakke <address@hidden>
---
gnu/packages/boost.scm | 100 +++++++++++++++++++++----------------------------
1 file changed, 42 insertions(+), 58 deletions(-)
diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index 1f896d3..c00db88 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -11,7 +11,7 @@
;;; Copyright © 2018 Maxim Cournoyer <address@hidden>
;;; Copyright © 2018 Efraim Flashner <address@hidden>
;;; Copyright © 2019 Mathieu Othacehe <address@hidden>
-;;; Copyright © 2019 Giacomo Leidi <address@hidden>
+;;; Copyright © 2019, 2020 Giacomo Leidi <address@hidden>
;;; Copyright © 2020 Marius Bakke <address@hidden>
;;;
;;; This file is part of GNU Guix.
@@ -42,7 +42,8 @@
#: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-public boost
(package
@@ -65,10 +66,14 @@
`(("perl" ,perl)
,@(if (%current-target-system)
'()
- `(("python" ,python-2)))
+ `(("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"
@@ -98,6 +103,7 @@
(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"
@@ -116,11 +122,23 @@
,(%current-target-system)))))
'())
+ (when (which "python3")
+ (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 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)
@@ -133,16 +151,23 @@
,@(if (%current-target-system)
'()
'((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>.
+ (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_python27.so"
"libboost_python.so"))
+ (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")
@@ -153,54 +178,13 @@ 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"))
-
- (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)))))))))
+ `(("python" ,python-2)
+ ,@(alist-delete "python" (package-native-inputs boost))))))
(define-public boost-static
(package
- 18/28: gnu: libarchive: Update to 3.4.1., (continued)
- 18/28: gnu: libarchive: Update to 3.4.1., guix-commits, 2020/01/08
- 21/28: gnu: RHash: Do not use unstable source tarball., guix-commits, 2020/01/08
- 20/28: gnu: meson: Update to 0.53.0., guix-commits, 2020/01/08
- 19/28: gnu: libjpeg-turbo: Update to 2.0.4., guix-commits, 2020/01/08
- 24/28: gnu: libpaper: Do not build the static library., guix-commits, 2020/01/08
- 25/28: gnu: teckit: Do not build the static library., guix-commits, 2020/01/08
- 26/28: gnu: Boost: Update to 1.72.0., guix-commits, 2020/01/08
- 17/28: gnu: mit-krb5: Update to 1.17.1., guix-commits, 2020/01/08
- 16/28: gnu: fribidi: Update to 1.0.8., guix-commits, 2020/01/08
- 23/28: gnu: doxygen: Update to 1.8.17., guix-commits, 2020/01/08
- 27/28: gnu: Boost: Use Python 3 by default.,
guix-commits <=
- 28/28: gnu: vigra: Build with Python 3., guix-commits, 2020/01/08
- 22/28: gnu: RHash: Update to 1.3.9., guix-commits, 2020/01/08