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