From dba94480865300d6bca7aa4022d3e781f80c0b4e Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Sun, 8 Dec 2019 22:18:35 +0100 Subject: [PATCH] gnu: boost: Build with python3. * gnu/packages/boost.scm (boost)[native-inputs]: Use python3. [arguments]: Parameterize python version. (boost-with-python3): Remove variable. --- gnu/packages/boost.scm | 108 ++++++++++++----------------------------- 1 file changed, 31 insertions(+), 77 deletions(-) diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm index f436d5b688..130ff8b394 100644 --- a/gnu/packages/boost.scm +++ b/gnu/packages/boost.scm @@ -63,10 +63,15 @@ ("zlib" ,zlib))) (native-inputs `(("perl" ,perl) - ("python" ,python-2) + ("python" ,python) ("tcsh" ,tcsh))) (arguments - `(#:tests? #f + `(#:imported-modules ((guix build python-build-system) + ,@%gnu-build-system-modules) + #:modules ((guix build gnu-build-system) + ((guix build python-build-system) #:prefix python:) + (guix build utils)) + #:tests? #f #:make-flags (list "threading=multi" "link=shared" @@ -83,7 +88,9 @@ (delete 'bootstrap) (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) - (let ((icu (assoc-ref inputs "icu4c")) + (let* ((icu (assoc-ref inputs "icu4c")) + (python (assoc-ref inputs "python")) + (python-version (python:python-version python)) (out (assoc-ref outputs "out"))) (substitute* '("libs/config/configure" "libs/spirit/classic/phoenix/test/runtest.sh" @@ -95,11 +102,18 @@ (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 ICU only in traditional - ;; install locations. + ;; 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) + (string-append "--with-python-version=" python-version) "--with-toolset=gcc")))) (replace 'build (lambda* (#:key make-flags #:allow-other-keys) @@ -110,15 +124,19 @@ (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 - ;; . + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (python (assoc-ref inputs "python")) + (python-version (python:python-version python)) + (libboost.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.so "libboost_python.so") + ;; Some packages also look for libboost_python3.so + (symlink libboost.so "libboost_python3.so")) #t)))))) (home-page "https://www.boost.org") @@ -129,70 +147,6 @@ 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 - (package - (inherit boost) - (name "boost-python3") - (native-inputs - `(("perl" ,perl) - ("python" ,python) - ("tcsh" ,tcsh))) - (arguments (substitute-keyword-arguments (package-arguments boost) - ((#:imported-modules _ '()) - `((guix build python-build-system) - ,@%gnu-build-system-modules)) - ((#:modules _ '()) - '((guix build gnu-build-system) - ((guix build python-build-system) #:prefix python:) - (guix build utils))) - ((#: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")) - (python-version (python:python-version 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) - (string-append "--with-python-version=" python-version) - "--with-toolset=gcc")))) - (replace 'provide-libboost_python - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (python (assoc-ref inputs "python")) - (python-version (python:python-version python)) - (libboost.so - (string-append "libboost_python" - (string-join - (string-split python-version #\.) "") - ".so"))) - (with-directory-excursion (string-append out "/lib") - (symlink libboost.so "libboost_python.so") - ;; Some packages also look for libboost_python3.so - (symlink libboost.so "libboost_python3.so")) - #t))))))))) - (define-public boost-static (package (inherit boost) -- 2.24.0