diff mbox series

[bug#47182,07/18] gnu: binutils-final: Support more Power architectures.

Message ID 20210316064511.2891553-7-cmmarusich@gmail.com
State Accepted
Headers show
Series Add support for powerpc64le-linux (wip-ppc64le-for-master) | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Christopher Marusich March 16, 2021, 6:45 a.m. UTC
* gnu/packages/commencement.scm (binutils-final)[arguments]: When checking if
the system is a Power architecture, instead of hard-coding "powerpc-linux",
use the target-powerpc? procedure so it works on more Power architectures.
[inputs]: Likewise.
---
 gnu/packages/commencement.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Efraim Flashner March 16, 2021, 7:49 a.m. UTC | #1
On Mon, Mar 15, 2021 at 11:45:00PM -0700, Chris Marusich wrote:
> * gnu/packages/commencement.scm (binutils-final)[arguments]: When checking if
> the system is a Power architecture, instead of hard-coding "powerpc-linux",
> use the target-powerpc? procedure so it works on more Power architectures.
> [inputs]: Likewise.
> ---
>  gnu/packages/commencement.scm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
> index c0732bbf62d..d4511ed9148 100644
> --- a/gnu/packages/commencement.scm
> +++ b/gnu/packages/commencement.scm
> @@ -3516,14 +3516,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
>         #:implicit-inputs? #f
>         #:allowed-references
>         ,@(match (%current-system)
> -         ("powerpc-linux"
> +         ((? target-powerpc?)

I wonder if this would be better as ,@(if target-powerpc?
I didn't test to see how it would work with cross compiling, I don't
know if binutils-final gets built in that case.

>            `(("out" ,glibc-final ,static-bash-for-glibc)))
>           (_
>            `(("out" ,glibc-final))))
>         ,@(package-arguments binutils)))
>      (inputs
>       (match (%current-system)
> -       ("powerpc-linux"
> +       ((? target-powerpc?)
>          `(("bash" ,static-bash-for-glibc)
>            ,@(%boot2-inputs)))
>         (_ (%boot2-inputs))))))
> -- 
> 2.26.2
> 
> 
> 
>
Christopher Marusich March 18, 2021, 6:10 a.m. UTC | #2
Efraim Flashner <efraim@flashner.co.il> writes:

> On Mon, Mar 15, 2021 at 11:45:00PM -0700, Chris Marusich wrote:
>> * gnu/packages/commencement.scm (binutils-final)[arguments]: When checking if
>> the system is a Power architecture, instead of hard-coding "powerpc-linux",
>> use the target-powerpc? procedure so it works on more Power architectures.
>> [inputs]: Likewise.
>> ---
>>  gnu/packages/commencement.scm | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
>> index c0732bbf62d..d4511ed9148 100644
>> --- a/gnu/packages/commencement.scm
>> +++ b/gnu/packages/commencement.scm
>> @@ -3516,14 +3516,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
>>         #:implicit-inputs? #f
>>         #:allowed-references
>>         ,@(match (%current-system)
>> -         ("powerpc-linux"
>> +         ((? target-powerpc?)
>
> I wonder if this would be better as ,@(if target-powerpc?
> I didn't test to see how it would work with cross compiling, I don't
> know if binutils-final gets built in that case.

Are the final inputs ever cross-compiled?  I'm having trouble thinking
of a case when binutils-final would ever be cross-compiled.  The package
(like all the final inputs) exist specifically to provide the native GCC
used for building the rest of the things in the system.  In a case where
you want to cross-compile e.g. GNU Hello, Guix first uses these final
inputs to (natively) build a cross compilation toolchain, and then it
will use that one to cross-compile GNU Hello.

I don't think we need to account for cross-compliation of the final
inputs, but please correct me if I'm wrong.
Efraim Flashner March 18, 2021, 8:29 a.m. UTC | #3
On Wed, Mar 17, 2021 at 11:10:23PM -0700, Chris Marusich wrote:
> Efraim Flashner <efraim@flashner.co.il> writes:
> 
> > On Mon, Mar 15, 2021 at 11:45:00PM -0700, Chris Marusich wrote:
> >> * gnu/packages/commencement.scm (binutils-final)[arguments]: When checking if
> >> the system is a Power architecture, instead of hard-coding "powerpc-linux",
> >> use the target-powerpc? procedure so it works on more Power architectures.
> >> [inputs]: Likewise.
> >> ---
> >>  gnu/packages/commencement.scm | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
> >> index c0732bbf62d..d4511ed9148 100644
> >> --- a/gnu/packages/commencement.scm
> >> +++ b/gnu/packages/commencement.scm
> >> @@ -3516,14 +3516,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
> >>         #:implicit-inputs? #f
> >>         #:allowed-references
> >>         ,@(match (%current-system)
> >> -         ("powerpc-linux"
> >> +         ((? target-powerpc?)
> >
> > I wonder if this would be better as ,@(if target-powerpc?
> > I didn't test to see how it would work with cross compiling, I don't
> > know if binutils-final gets built in that case.
> 
> Are the final inputs ever cross-compiled?  I'm having trouble thinking
> of a case when binutils-final would ever be cross-compiled.  The package
> (like all the final inputs) exist specifically to provide the native GCC
> used for building the rest of the things in the system.  In a case where
> you want to cross-compile e.g. GNU Hello, Guix first uses these final
> inputs to (natively) build a cross compilation toolchain, and then it
> will use that one to cross-compile GNU Hello.
> 
> I don't think we need to account for cross-compliation of the final
> inputs, but please correct me if I'm wrong.
> 

I first tried to cross compile binutils-final from x86_64 but it failed
because all the mes packages don't support powerpc yet. Then I tried
emulating an aarch64 machine to cross compile binutils-final and that
failed at make-boot0. I think we can assume that binutils-final (and the
other -final packages) aren't going to be cross compiled.

,@(if might be cleaner to look at, but ,@(match makes it easier to
make change later without worrying about nested if statements. Which
hopefully shouldn't be an issue anyway for binutils-final.
diff mbox series

Patch

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index c0732bbf62d..d4511ed9148 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3516,14 +3516,14 @@  exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
        #:implicit-inputs? #f
        #:allowed-references
        ,@(match (%current-system)
-         ("powerpc-linux"
+         ((? target-powerpc?)
           `(("out" ,glibc-final ,static-bash-for-glibc)))
          (_
           `(("out" ,glibc-final))))
        ,@(package-arguments binutils)))
     (inputs
      (match (%current-system)
-       ("powerpc-linux"
+       ((? target-powerpc?)
         `(("bash" ,static-bash-for-glibc)
           ,@(%boot2-inputs)))
        (_ (%boot2-inputs))))))