From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] pkg-infra: use ?= instead of ifdef
Date: Mon, 19 Mar 2012 22:51:29 +0100 [thread overview]
Message-ID: <201203192251.29275.arnout@mind.be> (raw)
In-Reply-To: <20120319095747.4b571e8f@skate>
On Monday 19 March 2012 09:57:47 Thomas Petazzoni wrote:
> Hello,
>
> Le Mon, 19 Mar 2012 00:28:54 +0100,
> "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be> a ?crit :
>
> > ifdef considers a variable undefined if it is defined as empty. In the
> > GENTARGETS/AUTOTARGETS/CMAKETARGETS infrastructure, the ifdef construct
> > is often used to default to the value from the target-variable if the
> > host-variable is not defined. However, this makes it impossible to
> > override the host-variable as empty. Therefore, use ?= instead to assign
> > the defaults.
>
> Could you share a specific example on why this would be useful? I'm
> sure there are uses cases, but I'm curious about the one you're having.
Good question... There was an example on the list a while back, and a
couple of days later a made a patch for it but it never got sent out.
Now I'm cleaning up my patch queue and just sent it. But I don't remember
the original reason, and looking at the patch doesn't ring a bell either.
In fact, all the ones I fixed in this patch don't really make sense if
they're defined empty, except for the _SUBDIR and maybe _PATCH.
> > I didn't touch the _VERSION infrastructure because I'm afraid to break it.
> > In fact, I think it already is broken (I don't see how that /-to-_
> > substitution can work for host-packages).
>
> Not sure I understand what is broken here. What does "/-to-_" means?
/-to-_ substitution means the subsitution of / into _
$(2)_VERSION = $(subst /,_,$($(3)_VERSION))
I think it's broken because the $($(3)_VERSION) of a host package
has already been substituted before:
$(2)_DL_VERSION = $($(2)_VERSION)
$(2)_VERSION = $(subst /,_,$($(2)_VERSION))
Actually for PKG_VERSION it's OK, but HOST_PKG_DL_VERSION will be
incorrect because it has _ instead of /. Something we wouldn't
notice because we have no packages with / in the version.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120319/ffa2fddf/attachment.html>
prev parent reply other threads:[~2012-03-19 21:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-18 23:28 [Buildroot] [PATCH] pkg-infra: use ?= instead of ifdef Arnout Vandecappelle
2012-03-19 8:57 ` Thomas Petazzoni
2012-03-19 21:51 ` Arnout Vandecappelle [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201203192251.29275.arnout@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/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