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

View file

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

View file

@ -1,5 +1,5 @@
;;; 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 © 2016, 2019, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
@ -127,7 +127,7 @@ (define* (cross-binutils* target
;; to pick up native libs instead of target ones. In
;; practice the RUNPATH of target libs only refers to
;; 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.
(cross (cond ((string=? target "xtensa-ath9k-elf")

View file

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

View file

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