[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to replace %output with #$output?
From: |
Mekeor Melire |
Subject: |
Re: How to replace %output with #$output? |
Date: |
Tue, 22 Mar 2022 08:24:47 +0000 |
2022-03-22 / 07:59 / me@tobias.gr:
> On 22 March 2022 07:26:38 UTC, Mekeor Melire <mekeor@posteo.de> wrote:
>> (list "CC=gcc")
>>
>>With these changes I get this error:
>>
>> Wrong type to apply: "CC=gcc"
>
> That can happen only if you apply the string as a procedure, i.e.
> forgot the the LIST.
The `list` was present. As suggested by Feng Shu in another thread, it
works like this:
--8<---------------cut here---------------start------------->8---
(arguments
(list
#:tests? #f ; no tests
#:make-flags #~(list "CC=gcc")
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'patch-makefile
(lambda _
(substitute* "Makefile"
(("/usr/local") #$output)))))))
--8<---------------cut here---------------end--------------->8---
It also seems to work with:
#:make-flags '(list "CC=gcc")
>>> So does hard-coding 'gcc' over using (cc-for-target).
>>
>>Yes, I would also prefer to use cc-for-target. But I wanted to simplify
>>my code first. Because in order to use cc-for-target, I have to use
>>backticks.
>
> Why? Backticks are just short for UNQUOTE. I don't see why you'd need
> or even want to use that here. If you insist, you could write:
>
> `(,(string-append "CC=" (cc-for-target)))
>
> but I'd much prefer you didn't as I think it's a step back from
>
> (list (string-append "CC=" (cc-for-target)))
Do I have to import cc-for-target from (guix utils)?
In case of:
;; do not have (guix utils) imported
#:make-flags (list (string-append "CC=" (cc-for-target)))
I get this during build:
error: cc-for-target: unbound variable
In case of:
;; have (guix utils) imported
#:make-flags (list (string-append "CC=" (cc-for-target)))
I get this error:
Wrong type to apply: "CC=gcc"
In case of:
;; have (guix utils) imported
#:make-flags #~(list (string-append "CC=" (cc-for-target)))
I get this error:
Unbound variable: cc-for-target
In case of:
;; have (guix utils) imported
#:make-flags `(list (string-append "CC=" ,(cc-for-target)))
I get this error ... Oh, wait, it works!
So this is the working code:
--8<---------------cut here---------------start------------->8---
(arguments
(list
#:tests? #f ; no tests
#:make-flags `(list (string-append "CC=" ,(cc-for-target)))
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'patch-makefile
(lambda _
(substitute* "Makefile"
(("/usr/local") #$output)))))))
--8<---------------cut here---------------end--------------->8---
Putting the comma like this also seems to work:
#:make-flags `(list (string-append "CC=" ,(cc-for-target)))
>>> Very strong opinions on Scheme coding style, that boy.
>>
>>Please don't assume gender. But yes, you can refer to me with the "he"
>>pronoun.
>
> If you believe yourself to be the son of god, you have problems I
> can't help you fix. ;-)
I see. Sorry for misunderstanding :-)