gnu: Boost: Use G-expressions.

* gnu/packages/boost.scm (boost, boost-static, boost-for-mysql)[arguments]:
Rewrite as gexp.  Remove label usage.
This commit is contained in:
Marius Bakke 2022-06-30 19:18:23 +02:00
parent 1a04f8c677
commit 5e2ecfab7c
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -12,7 +12,7 @@
;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019, 2020 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2019, 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de> ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021, 2022 Greg Hogan <code@greghogan.com> ;;; Copyright © 2021, 2022 Greg Hogan <code@greghogan.com>
@ -37,6 +37,7 @@
(define-module (gnu packages boost) (define-module (gnu packages boost)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
@ -85,110 +86,110 @@ (define-public boost
(build-system gnu-build-system) (build-system gnu-build-system)
(inputs (list icu4c zlib)) (inputs (list icu4c zlib))
(native-inputs (native-inputs
`(("perl" ,perl) (append (list perl tcsh)
,@(if (%current-target-system) (if (%current-target-system)
'() '()
`(("python" ,python-minimal-wrapper))) (list python-minimal-wrapper))))
("tcsh" ,tcsh)))
(arguments (arguments
`(#:imported-modules ((guix build python-build-system) (list
#:imported-modules `((guix build python-build-system)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:modules (((guix build python-build-system) #:select (python-version)) #:modules `(((guix build python-build-system) #:select (python-version))
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:tests? #f #:tests? #f
#:make-flags #:make-flags
(list "threading=multi" "link=shared" #~(list "threading=multi" "link=shared"
;; Set the RUNPATH to $libdir so that the libs find each other. ;; Set the RUNPATH to $libdir so that the libs find each other.
(string-append "linkflags=-Wl,-rpath=" (string-append "linkflags=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib") #$output "/lib")
,@(if (%current-target-system) #$@(if (%current-target-system)
`("--user-config=user-config.jam" #~("--user-config=user-config.jam"
;; Python is not supported when cross-compiling. ;; Python is not supported when cross-compiling.
"--without-python" "--without-python"
"binary-format=elf" "binary-format=elf"
"target-os=linux" "target-os=linux"
,@(cond #$@(cond
((string-prefix? "arm" (%current-target-system)) ((string-prefix? "arm" (%current-target-system))
'("abi=aapcs" #~("abi=aapcs"
"address-model=32" "address-model=32"
"architecture=arm")) "architecture=arm"))
((string-prefix? "aarch64" (%current-target-system)) ((string-prefix? "aarch64" (%current-target-system))
'("abi=aapcs" #~("abi=aapcs"
"address-model=64" "address-model=64"
"architecture=arm")) "architecture=arm"))
(else '()))) (else #~())))
'())) #~()))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(delete 'bootstrap) (delete 'bootstrap)
(replace 'configure (replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda _
(let ((icu (assoc-ref inputs "icu4c")) (let ((icu #$(this-package-input "icu4c"))
(python (assoc-ref inputs "python")) (python #+(this-package-native-input "python-minimal-wrapper")))
(out (assoc-ref outputs "out"))) (substitute* '("libs/config/configure"
(substitute* '("libs/config/configure" "libs/spirit/classic/phoenix/test/runtest.sh"
"libs/spirit/classic/phoenix/test/runtest.sh" "tools/build/src/engine/execunix.cpp")
"tools/build/src/engine/execunix.cpp") (("/bin/sh") (which "sh")))
(("/bin/sh") (which "sh")))
(setenv "SHELL" (which "sh")) (setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh")) (setenv "CONFIG_SHELL" (which "sh"))
,@(if (%current-target-system) #$@(if (%current-target-system)
`((call-with-output-file "user-config.jam" #~((call-with-output-file "user-config.jam"
(lambda (port) (lambda (port)
(format port (format port
"using gcc : cross : ~a-c++ ;" "using gcc : cross : ~a-c++ ;"
,(%current-target-system))))) #$(%current-target-system)))))
'()) #~())
;; Change an #ifdef __MACH__ that really targets macOS. ;; Change an #ifdef __MACH__ that really targets macOS.
(substitute* "boost/test/utils/timer.hpp" (substitute* "boost/test/utils/timer.hpp"
(("defined\\(__MACH__\\)") (("defined\\(__MACH__\\)")
"(defined __MACH__ && !defined __GNU__)")) "(defined __MACH__ && !defined __GNU__)"))
(invoke "./bootstrap.sh" (invoke "./bootstrap.sh"
(string-append "--prefix=" out) (string-append "--prefix=" #$output)
;; Auto-detection looks for ICU only in traditional ;; Auto-detection looks for ICU only in traditional
;; install locations. ;; install locations.
(string-append "--with-icu=" icu) (string-append "--with-icu=" #$output)
;; Ditto for Python. ;; Ditto for Python.
,@(if (%current-target-system) #$@(if (%current-target-system)
'() #~()
`((string-append "--with-python-root=" python) #~((string-append "--with-python-root=" python)
(string-append "--with-python=" python "/bin/python") (string-append "--with-python=" python
(string-append "--with-python-version=" "/bin/python")
(python-version python)))) (string-append "--with-python-version="
"--with-toolset=gcc")))) (python-version python))))
(replace 'build "--with-toolset=gcc"))))
(lambda* (#:key make-flags #:allow-other-keys) (replace 'build
(apply invoke "./b2" (lambda* (#:key make-flags #:allow-other-keys)
(format #f "-j~a" (parallel-job-count)) (apply invoke "./b2"
make-flags))) (format #f "-j~a" (parallel-job-count))
(replace 'install make-flags)))
(lambda* (#:key make-flags #:allow-other-keys) (replace 'install
(apply invoke "./b2" "install" make-flags))) (lambda* (#:key make-flags #:allow-other-keys)
,@(if (%current-target-system) (apply invoke "./b2" "install" make-flags)))
'() #$@(if (%current-target-system)
'((add-after 'install 'provide-libboost_python #~()
(lambda* (#:key inputs outputs #:allow-other-keys) #~((add-after 'install 'provide-libboost_python
(let* ((out (assoc-ref outputs "out")) (lambda* (#:key inputs outputs #:allow-other-keys)
(python-version (python-version (let* ((python-version (python-version
(assoc-ref inputs "python"))) #+(this-package-native-input
(libboost_pythonNN.so "python-minimal-wrapper")))
(string-append "libboost_python" (libboost_pythonNN.so
(string-join (string-split (string-append "libboost_python"
python-version #\.) (string-join (string-split
"") python-version #\.)
".so"))) "")
(with-directory-excursion (string-append out "/lib") ".so")))
(symlink libboost_pythonNN.so "libboost_python.so") (with-directory-excursion (string-append #$output "/lib")
;; Some packages only look for the major version. (symlink libboost_pythonNN.so "libboost_python.so")
(symlink libboost_pythonNN.so ;; Some packages only look for the major version.
(string-append "libboost_python" (symlink libboost_pythonNN.so
(string-take python-version 1) (string-append "libboost_python"
".so"))))))))))) (string-take python-version 1)
".so")))))))))))
(home-page "https://www.boost.org") (home-page "https://www.boost.org")
(synopsis "Peer-reviewed portable C++ source libraries") (synopsis "Peer-reviewed portable C++ source libraries")
@ -290,23 +291,22 @@ (define-public boost-static
(arguments (arguments
(substitute-keyword-arguments (package-arguments boost) (substitute-keyword-arguments (package-arguments boost)
((#:make-flags flags) ((#:make-flags flags)
`(cons "link=static" (delete "link=shared" ,flags))) #~(cons "link=static" (delete "link=shared" #$flags)))
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(replace 'provide-libboost_python (replace 'provide-libboost_python
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((python-version (python-version
(python-version (python-version #+(this-package-native-input
(assoc-ref inputs "python"))) "python-minimal-wrapper")))
(libboost_pythonNN.a (libboost_pythonNN.a
(string-append "libboost_python" (string-append "libboost_python"
(string-join (string-split (string-join (string-split
python-version #\.) python-version #\.)
"") "")
".a"))) ".a")))
(with-directory-excursion (string-append out "/lib") (with-directory-excursion (string-append #$output "/lib")
(symlink libboost_pythonNN.a "libboost_python.a")) (symlink libboost_pythonNN.a "libboost_python.a")))))))))))
#t)))))))))
(define-public boost-for-mysql (define-public boost-for-mysql
;; Older version for MySQL 5.7.23. ;; Older version for MySQL 5.7.23.
@ -322,43 +322,44 @@ (define-public boost-for-mysql
(sha256 (sha256
(base32 (base32
"1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj")))) "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
(arguments (substitute-keyword-arguments (package-arguments boost) (arguments
((#:phases phases) (substitute-keyword-arguments (package-arguments boost)
`(modify-phases ,phases ((#:phases phases)
(replace 'configure #~(modify-phases #$phases
(lambda* (#:key inputs outputs #:allow-other-keys) (replace 'configure
(let ((icu (assoc-ref inputs "icu4c")) (lambda* (#:key inputs outputs #:allow-other-keys)
(out (assoc-ref outputs "out"))) (let ((icu #$(this-package-input "icu4c")))
(substitute* (append (substitute* (append
(find-files "tools/build/src/engine/" "execunix\\.c.*") (find-files "tools/build/src/engine/" "execunix\\.c.*")
'("libs/config/configure" '("libs/config/configure"
"libs/spirit/classic/phoenix/test/runtest.sh" "libs/spirit/classic/phoenix/test/runtest.sh"
"tools/build/doc/bjam.qbk" "tools/build/doc/bjam.qbk"
"tools/build/src/engine/Jambase")) "tools/build/src/engine/Jambase"))
(("/bin/sh") (which "sh"))) (("/bin/sh") (which "sh")))
(setenv "SHELL" (which "sh")) (setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh")) (setenv "CONFIG_SHELL" (which "sh"))
,@(if (%current-target-system) #$@(if (%current-target-system)
`((call-with-output-file "user-config.jam" #~((call-with-output-file "user-config.jam"
(lambda (port) (lambda (port)
(format port (format port
"using gcc : cross : ~a-c++ ;" "using gcc : cross : ~a-c++ ;"
,(%current-target-system))))) #$(%current-target-system)))))
'()) #~())
(invoke "./bootstrap.sh" (invoke "./bootstrap.sh"
(string-append "--prefix=" out) (string-append "--prefix=" #$output)
;; Auto-detection looks for ICU only in traditional ;; Auto-detection looks for ICU only in traditional
;; install locations. ;; install locations.
(string-append "--with-icu=" icu) (string-append "--with-icu=" icu)
"--with-toolset=gcc")))) "--with-toolset=gcc"))))
(delete 'provide-libboost_python))) (delete 'provide-libboost_python)))
((#:make-flags make-flags) ((#:make-flags make-flags)
`(cons* "--without-python" ,make-flags)))) #~(cons* "--without-python" #$make-flags))))
(native-inputs (native-inputs
(alist-delete "python" (package-native-inputs boost))) (modify-inputs (package-native-inputs boost)
(delete "python-minimal-wrapper")))
(properties '((hidden? . #t))))) (properties '((hidden? . #t)))))
(define-public boost-sync (define-public boost-sync