gnu: binutils: Use gexps.

This is the result of applying ‘guix style -S arguments’ and making
small adjustments.

* gnu/packages/base.scm (binutils)[arguments]: Use gexps.
(binutils-2.33, binutils-gold): Likewise.
* gnu/packages/commencement.scm (binutils-mesboot0, binutils-mesboot1)
(binutils-boot0, binutils-final): Likewise.
* gnu/packages/cross-base.scm (cross-binutils*): Adjust accordingly.
* gnu/packages/embedded.scm (make-propeller-binutils): Use gexps.
* gnu/packages/make-bootstrap.scm (%binutils-static): Use gexps.

Change-Id: I59cbe29760784b09e6d4e80beca9153cb9b495a7
This commit is contained in:
Ludovic Courtès 2024-01-11 13:50:30 +01:00
parent f9f2198d82
commit 77ee97628a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
5 changed files with 151 additions and 144 deletions

View File

@ -645,37 +645,37 @@ change. GNU make offers many powerful extensions over the standard utility.")
(patches (search-patches "binutils-loongson-workaround.patch")))) (patches (search-patches "binutils-loongson-workaround.patch"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:out-of-source? #t ;recommended in the README (list #:out-of-source? #t ;recommended in the README
#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency #:configure-flags #~'(;; Add `-static-libgcc' to not retain a dependency
;; on GCC when bootstrapping. ;; on GCC when bootstrapping.
"LDFLAGS=-static-libgcc" "LDFLAGS=-static-libgcc"
;; Turn on --enable-new-dtags by default to make the ;; Turn on --enable-new-dtags by default to make the
;; linker set RUNPATH instead of RPATH on binaries. ;; linker set RUNPATH instead of RPATH on binaries.
;; This is important because RUNPATH can be overriden ;; This is important because RUNPATH can be overriden
;; using LD_LIBRARY_PATH at runtime. ;; using LD_LIBRARY_PATH at runtime.
"--enable-new-dtags" "--enable-new-dtags"
;; Don't search under /usr/lib & co. ;; Don't search under /usr/lib & co.
"--with-lib-path=/no-ld-lib-path" "--with-lib-path=/no-ld-lib-path"
;; Install BFD. It ends up in a hidden directory, ;; Install BFD. It ends up in a hidden directory,
;; but it's here. ;; but it's here.
"--enable-install-libbfd" "--enable-install-libbfd"
;; Make sure 'ar' and 'ranlib' produce archives in a ;; Make sure 'ar' and 'ranlib' produce archives in a
;; deterministic fashion. ;; deterministic fashion.
"--enable-deterministic-archives" "--enable-deterministic-archives"
"--enable-64-bit-bfd" "--enable-64-bit-bfd"
"--enable-compressed-debug-sections=all" "--enable-compressed-debug-sections=all"
"--enable-lto" "--enable-lto"
"--enable-separate-code" "--enable-separate-code"
"--enable-threads") "--enable-threads")
;; For some reason, the build machinery insists on rebuilding .info ;; For some reason, the build machinery insists on rebuilding .info
;; files, even though they're already provided by the tarball. ;; files, even though they're already provided by the tarball.
#:make-flags '("MAKEINFO=true"))) #:make-flags #~'("MAKEINFO=true")))
(native-inputs (list bison)) ;needed to build 'gprofng' (native-inputs (list bison)) ;needed to build 'gprofng'
(synopsis "Binary utilities: bfd gas gprof ld") (synopsis "Binary utilities: bfd gas gprof ld")
(description (description
@ -705,7 +705,7 @@ included.")
(patches '()))) (patches '())))
(arguments (arguments
(substitute-keyword-arguments (package-arguments binutils) (substitute-keyword-arguments (package-arguments binutils)
((#:make-flags _ ''()) ''()))) ((#:make-flags _ #~'()) #~'())))
(native-inputs '()) (native-inputs '())
(properties '()))) (properties '())))
@ -715,22 +715,22 @@ included.")
(arguments (arguments
(substitute-keyword-arguments (package-arguments binutils) (substitute-keyword-arguments (package-arguments binutils)
((#:configure-flags flags) ((#:configure-flags flags)
`(cons* "--enable-gold=default" #~(cons* "--enable-gold=default"
(delete "LDFLAGS=-static-libgcc" ,flags))) (delete "LDFLAGS=-static-libgcc" #$flags)))
((#:phases phases '%standard-phases) ((#:phases phases '%standard-phases)
`(modify-phases ,phases #~(modify-phases #$phases
(add-after 'patch-source-shebangs 'patch-more-shebangs (add-after 'patch-source-shebangs 'patch-more-shebangs
(lambda _ (lambda _
(substitute* "gold/Makefile.in" (substitute* "gold/Makefile.in"
(("/bin/sh") (which "sh"))))) (("/bin/sh") (which "sh")))))
;; Multiple failing tests on some architectures in the gold testsuite. ;; Multiple failing tests on some architectures in the gold testsuite.
,@(if (or (target-arm?) #$(if (or (target-arm?)
(target-ppc32?)) (target-ppc32?))
'((add-after 'unpack 'skip-gold-testsuite #~(add-after 'unpack 'skip-gold-testsuite
(lambda _ (lambda _
(substitute* "gold/Makefile.in" (substitute* "gold/Makefile.in"
((" testsuite") " "))))) ((" testsuite") " "))))
'()))))) #t)))))
(native-inputs (modify-inputs (package-native-inputs binutils) (native-inputs (modify-inputs (package-native-inputs binutils)
(append bc))))) (append bc)))))

View File

@ -937,27 +937,28 @@ MesCC-Tools), and finally M2-Planet.")
(native-inputs (%boot-tcc-inputs)) (native-inputs (%boot-tcc-inputs))
(supported-systems '("i686-linux" "x86_64-linux")) (supported-systems '("i686-linux" "x86_64-linux"))
(arguments (arguments
`(#:implicit-inputs? #f (list #:implicit-inputs? #f
#:guile ,%bootstrap-guile #:guile %bootstrap-guile
#:tests? #f ; runtest: command not found #:tests? #f ; runtest: command not found
#:parallel-build? #f #:parallel-build? #f
#:strip-binaries? #f ; no strip yet #:strip-binaries? #f ; no strip yet
#:configure-flags #:configure-flags
(let ((cppflags (string-append " -D __GLIBC_MINOR__=6" #~(let ((cppflags (string-append
" -D MES_BOOTSTRAP=1")) " -D __GLIBC_MINOR__=6"
(bash (assoc-ref %build-inputs "bash"))) " -D MES_BOOTSTRAP=1"))
`(,(string-append "CONFIG_SHELL=" bash "/bin/sh") (bash (assoc-ref %build-inputs "bash")))
,(string-append "CPPFLAGS=" cppflags) `(,(string-append "CONFIG_SHELL=" bash "/bin/sh")
"AR=tcc -ar" ,(string-append "CPPFLAGS=" cppflags)
"CXX=false" "AR=tcc -ar"
"RANLIB=true" "CXX=false"
,(string-append "CC=tcc" cppflags) "RANLIB=true"
"--disable-nls" ,(string-append "CC=tcc" cppflags)
"--disable-shared" "--disable-nls"
"--disable-werror" "--disable-shared"
"--build=i686-unknown-linux-gnu" "--disable-werror"
"--host=i686-unknown-linux-gnu" "--build=i686-unknown-linux-gnu"
"--with-sysroot=/")))))) "--host=i686-unknown-linux-gnu"
"--with-sysroot=/"))))))
(define gcc-core-mesboot0 (define gcc-core-mesboot0
;; Gcc-2.95.3 is the most recent GCC that is supported by what the Mes C ;; Gcc-2.95.3 is the most recent GCC that is supported by what the Mes C
@ -1266,14 +1267,13 @@ ac_cv_c_float_format='IEEE (little-endian)'
(arguments (arguments
(substitute-keyword-arguments (package-arguments binutils-mesboot0) (substitute-keyword-arguments (package-arguments binutils-mesboot0)
((#:configure-flags configure-flags) ((#:configure-flags configure-flags)
'(let ((out (assoc-ref %outputs "out"))) #~(let ((out (assoc-ref %outputs "out")))
`("--disable-nls" `("--disable-nls" "--disable-shared"
"--disable-shared" "--disable-werror"
"--disable-werror" "--build=i686-unknown-linux-gnu"
"--build=i686-unknown-linux-gnu" "--host=i686-unknown-linux-gnu"
"--host=i686-unknown-linux-gnu" "--with-sysroot=/"
"--with-sysroot=/" ,(string-append "--prefix=" out))))))))
,(string-append "--prefix=" out))))))))
(define gnu-make-mesboot (define gnu-make-mesboot
(package (package
@ -2249,33 +2249,39 @@ exec " gcc "/bin/" program
(source (bootstrap-origin (package-source binutils))) (source (bootstrap-origin (package-source binutils)))
(name "binutils-cross-boot0") (name "binutils-cross-boot0")
(arguments (arguments
`(#:guile ,%bootstrap-guile (append (list #:guile %bootstrap-guile
#:implicit-inputs? #f #:implicit-inputs? #f
#:modules ((guix build gnu-build-system) #:modules '((guix build gnu-build-system)
(guix build utils) (guix build utils)
(ice-9 ftw)) ; for 'scandir' (ice-9 ftw)) ; for 'scandir'
#:phases (modify-phases %standard-phases #:phases
(add-after 'install 'add-symlinks #~(modify-phases %standard-phases
(lambda* (#:key outputs #:allow-other-keys) (add-after 'install 'add-symlinks
;; The cross-gcc invokes 'as', 'ld', etc, without the (lambda* (#:key outputs #:allow-other-keys)
;; triplet prefix, so add symlinks. ;; The cross-gcc invokes 'as', 'ld', etc, without the
(let ((out (assoc-ref outputs "out")) ;; triplet prefix, so add symlinks.
(triplet-prefix (string-append ,(boot-triplet) "-"))) (let ((out (assoc-ref outputs "out"))
(define (has-triplet-prefix? name) (triplet-prefix (string-append #$(boot-triplet)
(string-prefix? triplet-prefix name)) "-")))
(define (remove-triplet-prefix name) (define (has-triplet-prefix? name)
(substring name (string-length triplet-prefix))) (string-prefix? triplet-prefix name))
(with-directory-excursion (string-append out "/bin") (define (remove-triplet-prefix name)
(for-each (lambda (name) (substring name
(symlink name (remove-triplet-prefix name))) (string-length triplet-prefix)))
(scandir "." has-triplet-prefix?)))))))
,@(substitute-keyword-arguments (package-arguments binutils) (with-directory-excursion (string-append out "/bin")
((#:configure-flags cf) (for-each (lambda (name)
`(append (list ,(string-append "--target=" (boot-triplet)) (symlink name
"--disable-gprofng") ;requires Bison (remove-triplet-prefix name)))
,cf))))) (scandir "."
has-triplet-prefix?))))))))
(substitute-keyword-arguments (package-arguments binutils)
((#:configure-flags cf)
#~(append (list #$(string-append "--target="
(boot-triplet))
"--disable-gprofng") ;requires Bison
#$cf)))))
(native-inputs '()) ;no Bison (native-inputs '()) ;no Bison
(inputs (%boot0-inputs)))) (inputs (%boot0-inputs))))
@ -3182,24 +3188,22 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(inherit binutils) (inherit binutils)
(source (bootstrap-origin (package-source binutils))) (source (bootstrap-origin (package-source binutils)))
(arguments (arguments
`(#:guile ,%bootstrap-guile (append (list #:guile %bootstrap-guile
#:implicit-inputs? #f #:implicit-inputs? #f
#:allowed-references #:allowed-references `("out" ,glibc-final
("out" ,(this-package-native-input
,glibc-final "libstdc++")
,(this-package-native-input "libstdc++") ,@(if (target-powerpc? (%current-system))
,@(if (target-powerpc? (%current-system)) (list static-bash-for-glibc)
(list static-bash-for-glibc) '())))
'())) (substitute-keyword-arguments (package-arguments binutils)
((#:configure-flags flags #~'())
,@(substitute-keyword-arguments (package-arguments binutils) ;; For gprofng, tell the build system where to look for libstdc++.
((#:configure-flags flags #~'()) #~(append #$flags
;; For gprofng, tell the build system where to look for libstdc++. (list (string-append "LDFLAGS=-L"
#~(append #$flags #$(this-package-native-input
(list (string-append "libstdc++")
"LDFLAGS=-L" "/lib")))))))
#$(this-package-native-input "libstdc++")
"/lib")))))))
(native-inputs (list bison-boot0 (native-inputs (list bison-boot0
libstdc++)) ;for gprofng libstdc++)) ;for gprofng
(inputs (inputs

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013-2018, 2020, 2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013-2018, 2020, 2023-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016, 2019, 2023 Janneke Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2016, 2019, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com> ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
@ -127,7 +127,7 @@
;; to pick up native libs instead of target ones. In ;; to pick up native libs instead of target ones. In
;; practice the RUNPATH of target libs only refers to ;; practice the RUNPATH of target libs only refers to
;; target libs, not native libs, so this is safe. ;; target libs, not native libs, so this is safe.
`(cons "--with-sysroot=/" ,flags))))))) #~(cons "--with-sysroot=/" #$flags)))))))
;; For xtensa-ath9k-elf, apply Qualcomm's patch. ;; For xtensa-ath9k-elf, apply Qualcomm's patch.
(cross (cond ((string=? target "xtensa-ath9k-elf") (cross (cond ((string=? target "xtensa-ath9k-elf")

View File

@ -746,16 +746,17 @@ with a layered architecture of JTAG interface and TAP support.")
"0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck")) "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
(patches '()))) (patches '())))
(arguments (arguments
`(;; FIXME: For some reason there are many test failures. It's not (list
;; obvious how to fix the failures. ;; FIXME: For some reason there are many test failures. It's not
#:tests? #f ;; obvious how to fix the failures.
#:phases #:tests? #f
(modify-phases %standard-phases #:phases
(add-after 'unpack 'chdir #~(modify-phases %standard-phases
(lambda _ (chdir "binutils") #t))) (add-after 'unpack 'chdir
,@(substitute-keyword-arguments (package-arguments xbinutils) (lambda _ (chdir "binutils") #t))
((#:configure-flags flags) #$@(substitute-keyword-arguments (package-arguments xbinutils)
`(cons "--disable-werror" ,flags))))) ((#:configure-flags flags)
#~(cons "--disable-werror" #$flags))))))
(native-inputs (native-inputs
`(("bison" ,bison) `(("bison" ,bison)
("flex" ,flex) ("flex" ,flex)

View File

@ -375,32 +375,34 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(define %binutils-static (define %binutils-static
;; Statically-linked Binutils. ;; Statically-linked Binutils.
(package (inherit binutils) (package
(inherit binutils)
(name "binutils-static") (name "binutils-static")
(arguments (arguments
`(#:configure-flags (cons "--disable-gold" (list #:configure-flags
,(match (memq #:configure-flags #~(cons "--disable-gold"
(package-arguments binutils)) #$(match (memq #:configure-flags (package-arguments binutils))
((#:configure-flags flags _ ...) ((#:configure-flags flags _ ...)
flags))) flags)))
#:make-flags ,(match (memq #:make-flags (package-arguments binutils)) #:make-flags
((#:make-flags flags _ ...) (match (memq #:make-flags (package-arguments binutils))
flags) ((#:make-flags flags _ ...)
(_ ''())) flags)
#:strip-flags '("--strip-all") (_ #~'()))
#:phases (modify-phases %standard-phases #:strip-flags #~'("--strip-all")
(add-before 'configure 'all-static #:phases
(lambda _ #~(modify-phases %standard-phases
;; The `-all-static' libtool flag can only be passed (add-before 'configure 'all-static
;; after `configure', since configure tests don't use (lambda _
;; libtool, and only for executables built with libtool. ;; The `-all-static' libtool flag can only be passed after
(substitute* '("binutils/Makefile.in" ;; `configure', since configure tests don't use libtool,
"gas/Makefile.in" ;; and only for executables built with libtool.
"ld/Makefile.in") (substitute* '("binutils/Makefile.in"
(("^LDFLAGS =(.*)$" line) "gas/Makefile.in" "ld/Makefile.in")
(string-append line (("^LDFLAGS =(.*)$" line)
"\nAM_LDFLAGS = -static -all-static\n"))) (string-append
#t))))))) line
"\nAM_LDFLAGS = -static -all-static\n"))))))))))
(define %binutils-static-stripped (define %binutils-static-stripped
;; The subset of Binutils that we need. ;; The subset of Binutils that we need.