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,48 +86,47 @@ (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")
@ -135,13 +135,13 @@ (define-public boost
(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"
@ -149,15 +149,16 @@ (define-public boost
"(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
"/bin/python")
(string-append "--with-python-version=" (string-append "--with-python-version="
(python-version python)))) (python-version python))))
"--with-toolset=gcc")))) "--with-toolset=gcc"))))
@ -169,20 +170,20 @@ (define-public boost
(replace 'install (replace 'install
(lambda* (#:key make-flags #:allow-other-keys) (lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "./b2" "install" make-flags))) (apply invoke "./b2" "install" make-flags)))
,@(if (%current-target-system) #$@(if (%current-target-system)
'() #~()
'((add-after 'install 'provide-libboost_python #~((add-after 'install '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.so (libboost_pythonNN.so
(string-append "libboost_python" (string-append "libboost_python"
(string-join (string-split (string-join (string-split
python-version #\.) python-version #\.)
"") "")
".so"))) ".so")))
(with-directory-excursion (string-append out "/lib") (with-directory-excursion (string-append #$output "/lib")
(symlink libboost_pythonNN.so "libboost_python.so") (symlink libboost_pythonNN.so "libboost_python.so")
;; Some packages only look for the major version. ;; Some packages only look for the major version.
(symlink libboost_pythonNN.so (symlink libboost_pythonNN.so
@ -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,13 +322,13 @@ (define-public boost-for-mysql
(sha256 (sha256
(base32 (base32
"1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj")))) "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"))))
(arguments (substitute-keyword-arguments (package-arguments boost) (arguments
(substitute-keyword-arguments (package-arguments boost)
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(replace 'configure (replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let ((icu (assoc-ref inputs "icu4c")) (let ((icu #$(this-package-input "icu4c")))
(out (assoc-ref outputs "out")))
(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"
@ -340,25 +340,26 @@ (define-public boost-for-mysql
(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