Chris Marusich writes:
> (define binutils-boot0
> (package
> (inherit binutils)
> (source (bootstrap-origin (package-source binutils)))
> (name "binutils-cross-boot0")
> (arguments
> `(#:guile ,%bootstrap-guile
>#:implicit-inputs? #f
>
>#:modules ((guix build gnu-build-system)
> (guix build utils)
> (ice-9 ftw)); for 'scandir'
>
>,@(substitute-keyword-arguments (package-arguments binutils)
>((#:configure-flags cf)
> `(cons ,(string-append "--target=" (boot-triplet))
>,cf))
>;; The presence of '%standard-phases as the default value here is
>;; important. It ensures that even when (package-argument
>;; binutils) does not already contain the #:phases keyword
>;; argument, the substitution will occur. If you omit a default
>;; value and (package-arguments binutils) does not contain the
>;; #:phases keyword argument (e.g., on an x86_64-linux system),
>;; then the substitution will not occur, and no phases at all will
>;; be added.
>((#:phases phases '%standard-phases)
> `(modify-phases ,phases
>,@(if (string=? (%current-system) "powerpc-linux")
> '((add-after 'unpack 'disable-rust-libiberty-test
> (lambda _
>(substitute* "libiberty/testsuite/Makefile.in"
> ((" check-rust-demangle ") ""))
>#t)))
> '())
>(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?)))
>
> (inputs (%boot0-inputs
Sorry, I meant to write this instead:
(define binutils-boot0
(package
(inherit binutils)
(source (bootstrap-origin (package-source binutils)))
(name "binutils-cross-boot0")
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
#:modules ((guix build gnu-build-system)
(guix build utils)
(ice-9 ftw)); for 'scandir'
,@(substitute-keyword-arguments (package-arguments binutils)
((#:configure-flags cf)
`(cons ,(string-append "--target=" (boot-triplet))
,cf))
;; The presence of '%standard-phases as the default value here is
;; important. It ensures that even when (package-argument
;; binutils) does not already contain the #:phases keyword
;; argument, the substitution will occur. If you omit a default
;; value and (package-arguments binutils) does not contain the
;; #:phases keyword argument (e.g., on an x86_64-linux system),
;; then the substitution will not occur, and no phases at all will
;; be added.
((#:phases phases '%standard-phases)
`(modify-phases ,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?)))
(inputs (%boot0-inputs
The point is that we can probably "inherit" the phases, so we wouldn't
have to repeat ourselves.
--
Chris
signature.asc
Description: PGP signature