Re: [OE-core] [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
On 09/04/2018 07:19 PM, Richard Purdie wrote: On Tue, 2018-09-04 at 08:15 +, Peter Kjellerstedt wrote: -Original Message- From: openembedded-core-boun...@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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
On Tue, 2018-09-04 at 08:15 +, Peter Kjellerstedt wrote: > > -Original Message- > > From: openembedded-core-boun...@lists.openembedded.org > > > core-boun...@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 > > --- > > 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 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
> -Original Message- > From: openembedded-core-boun...@lists.openembedded.org core-boun...@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 > --- > 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')}" > > ## > # Settings used by bitbake-layers. > -- > 2.7.4 //Peter -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[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 --- 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" ## # Settings used by bitbake-layers. -- 2.7.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core