unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Mekeor Melire <mekeor@posteo.de>
To: Tobias Geerinckx-Rice <me@tobias.gr>
Cc: help-guix@gnu.org
Subject: Re: How to replace %output with #$output?
Date: Tue, 22 Mar 2022 08:24:47 +0000	[thread overview]
Message-ID: <87r16uxte0.fsf@posteo.de> (raw)
In-Reply-To: <074D2F67-B364-4486-8698-F723F3517CB0@tobias.gr>

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 :-)


  reply	other threads:[~2022-03-22  9:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 21:31 How to replace %output with #$output? Mekeor Melire
2022-03-21 21:57 ` Tobias Geerinckx-Rice
2022-03-22  7:26   ` Mekeor Melire
2022-03-22  7:59     ` Tobias Geerinckx-Rice
2022-03-22  8:24       ` Mekeor Melire [this message]
2022-03-22 16:26         ` Tobias Geerinckx-Rice
2022-03-22  8:16     ` Feng Shu
2022-03-22  8:51       ` Mekeor Melire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r16uxte0.fsf@posteo.de \
    --to=mekeor@posteo.de \
    --cc=help-guix@gnu.org \
    --cc=me@tobias.gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).