Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	Peter Kjellerstedt <peter.kjellerstedt@axis.com>,
	"openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
Date: Wed, 5 Sep 2018 14:12:15 +0800	[thread overview]
Message-ID: <e8d15baa-ee1f-430f-d58c-9a79ff3ea145@windriver.com> (raw)
In-Reply-To: <57b7ac2a8b41e1c54460989cd27231330bb6cc33.camel@linuxfoundation.org>



On 09/04/2018 07:19 PM, Richard Purdie wrote:
> On Tue, 2018-09-04 at 08:15 +0000, Peter Kjellerstedt wrote:
>>> -----Original Message-----
>>> From: openembedded-core-bounces@lists.openembedded.org
>>> <openembedded-
>>> core-bounces@lists.openembedded.org> On Behalf Of Robert Yang
>>> Sent: den 4 september 2018 08:37
>>> To: openembedded-core@lists.openembedded.org
>>> Subject: [OE-core] [PATCH 1/1] bitbake.conf: Make
>>> BUILD_OPTIMIZATION
>>> respect to DEBUG_BUILD
>>>
>>> We may also need debug native tools, so make BUILD_OPTIMIZATION
>>> respect to
>>> DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which
>>> isn't
>>> convenient.
>>>
>>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>>> ---
>>>   meta/conf/bitbake.conf | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
>>> index 1941633..df62445 100644
>>> --- a/meta/conf/bitbake.conf
>>> +++ b/meta/conf/bitbake.conf
>>> @@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
>>>   DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS}
>>> -pipe"
>>>   SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',
>>> 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
>>>   SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
>>> DEBUG_OPTIMIZATION"
>>> -BUILD_OPTIMIZATION = "-O2 -pipe"
>>> +BUILD_OPTIMIZATION = "${@['-O2', '-O -g -feliminate-unused-debug-
>>> types -fno-omit-frame-pointer'][d.getVar('DEBUG_BUILD') == '1']}
>>> -pipe"
>>
>> Can we make that more readable:
>>
>> BUILD_OPTIMIZATION = "${@'-O -g -feliminate-unused-debug-types -fno-
>> omit-frame-pointer' if d.getVar('DEBUG_BUILD') == '1' else '-O2'}
>> -pipe"
>>
>> Should probably do the same for SELECTED_OPTIMIZATION while at it:
>>
>> SELECTED_OPTIMIZATION = "${@d.getVar('DEBUG_OPTIMIZATION' if
>> d.getVar('DEBUG_BUILD') == '1' else 'FULL_OPTIMIZATION')}"
> 
> If we're going to deal with readability and usability we could add
> something like:
> 
> def vartrue(var, iftrue, iffalse, d):
>      if oe.types.boolean(d.getVar(var)):
>          return iftrue
>      else:
>          return iffalse

Thanks, looks good, I will send a V2.

// Robert

> 
> to lib/oe/utils and then:
> 
> BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)}"
> 
> Cheers,
> 
> Richard
> 
> 


      reply	other threads:[~2018-09-05  6:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04  6:36 [PATCH 0/1] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD Robert Yang
2018-09-04  6:36 ` [PATCH 1/1] " Robert Yang
2018-09-04  8:15   ` Peter Kjellerstedt
2018-09-04 11:19     ` Richard Purdie
2018-09-05  6:12       ` Robert Yang [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=e8d15baa-ee1f-430f-d58c-9a79ff3ea145@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.kjellerstedt@axis.com \
    --cc=richard.purdie@linuxfoundation.org \
    /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