diff mbox series

[v2] package/boost: fixup Optimization flag in boost build

Message ID 20200807085811.672959-1-buildroot@heine.tech
State Accepted
Headers show
Series [v2] package/boost: fixup Optimization flag in boost build | expand

Commit Message

Michael Nosthoff Aug. 7, 2020, 8:58 a.m. UTC
When building with Boost Build the CXXFLAGS are extended depending
on the optimization level set. When not defined explicitly the
optimization level depends on the <variant>. For release it's 'speed'
and for debug it's set to 'off'

These flags overwrite the -O flag passed in with TARGET_CXXFLAGS as
it is appended when calling g++.

This commit sets the Optimization flags generated by Boost Build
to the value of TARGET_OPTIMIZATION no matter what level is used.

As Boost Build offers no nice way to alter those values the gcc
toolchain file is altered directly.

Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
---

v1 -> v2:
  - use sed to manipulate gcc.jam directly
  - remove extending user-config.jam

---
 package/boost/boost.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Yann E. MORIN Aug. 7, 2020, 7:19 p.m. UTC | #1
Michael, All,

On 2020-08-07 10:58 +0200, Michael Nosthoff spake thusly:
> When building with Boost Build the CXXFLAGS are extended depending
> on the optimization level set. When not defined explicitly the
> optimization level depends on the <variant>. For release it's 'speed'
> and for debug it's set to 'off'
> 
> These flags overwrite the -O flag passed in with TARGET_CXXFLAGS as
> it is appended when calling g++.
> 
> This commit sets the Optimization flags generated by Boost Build
> to the value of TARGET_OPTIMIZATION no matter what level is used.
> 
> As Boost Build offers no nice way to alter those values the gcc
> toolchain file is altered directly.
> 
> Signed-off-by: Michael Nosthoff <buildroot@heine.tech>

Applied to master, thanks.

Ultimately, it would be nice if upstream had a provision to not set the
optimisation level.

For example, in addition to the existign three levels, 'off', 'speed',
and 'space' (IIRC), maybe suggest they add a new one, maybe 'none', that
would not set any -O flag at all, thus using whatever the user would set
in their CXXFLAGS, or whatever the compiler defaults to...

Regards,
Yann E. MORIN.

> ---
> 
> v1 -> v2:
>   - use sed to manipulate gcc.jam directly
>   - remove extending user-config.jam
> 
> ---
>  package/boost/boost.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/boost/boost.mk b/package/boost/boost.mk
> index ef638fc9df..323802488d 100644
> --- a/package/boost/boost.mk
> +++ b/package/boost/boost.mk
> @@ -134,6 +134,7 @@ define BOOST_CONFIGURE_CMDS
>  	(cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS))
>  	echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam
>  	echo "" >> $(@D)/user-config.jam
> +	sed -i "s/: -O.* ;/: $(TARGET_OPTIMIZATION) ;/" $(@D)/tools/build/src/tools/gcc.jam
>  endef
>  
>  define BOOST_BUILD_CMDS
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Peter Korsgaard Aug. 28, 2020, 3:03 p.m. UTC | #2
>>>>> "Michael" == Michael Nosthoff <buildroot@heine.tech> writes:

 > When building with Boost Build the CXXFLAGS are extended depending
 > on the optimization level set. When not defined explicitly the
 > optimization level depends on the <variant>. For release it's 'speed'
 > and for debug it's set to 'off'

 > These flags overwrite the -O flag passed in with TARGET_CXXFLAGS as
 > it is appended when calling g++.

 > This commit sets the Optimization flags generated by Boost Build
 > to the value of TARGET_OPTIMIZATION no matter what level is used.

 > As Boost Build offers no nice way to alter those values the gcc
 > toolchain file is altered directly.

 > Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
 > ---

 > v1 -> v2:
 >   - use sed to manipulate gcc.jam directly
 >   - remove extending user-config.jam

Committed to 2020.02.x and 2020.05.x, thanks.
diff mbox series

Patch

diff --git a/package/boost/boost.mk b/package/boost/boost.mk
index ef638fc9df..323802488d 100644
--- a/package/boost/boost.mk
+++ b/package/boost/boost.mk
@@ -134,6 +134,7 @@  define BOOST_CONFIGURE_CMDS
 	(cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS))
 	echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam
 	echo "" >> $(@D)/user-config.jam
+	sed -i "s/: -O.* ;/: $(TARGET_OPTIMIZATION) ;/" $(@D)/tools/build/src/tools/gcc.jam
 endef
 
 define BOOST_BUILD_CMDS