Supporting multiple GNU toolchains

Kyle Kloepper Kyle.Kloepper at riverbed.com
Tue Nov 13 22:16:57 UTC 2012


In my build environment I have multiple GNU toolchains. For instance gcc 4.4 to compile kernel, 4.6 for general programs, and 4.7 for experimental work.

To make full use of these toolchains when packaging components, I am looking to do two things:

  1.  Set a default toolchain used by all invocations of rpmbuild (which may or may not be the same toolchain used when I compile outside of rpmbuild)
  2.  Allow a SPEC file to easily select a specific toolchain to use. This selection would override the default toolchain for the machine

My plan to accomplish this was to redefine the %configure macro in /etc/rpm/macros.toolchain and add the following:

%_CC /opt/gcc4_6/bin/gcc
%_CXX /opt/gcc4_6/bin/g++
%configure \
  CC=%{_CC} ; export CC ; \
  CXX=%{_CXX} ; export CXX ; \
  ...

Then in a specific SPEC file the toolchain could be selected by changing the %_CC and %_CXX variables:

...
%define _CC /usr/bin/gcc
%define _CXX /usr/bin/g++
...

Is this the best way to allow multiple toolchains to coexist for packaging with RPM?

-Kyle

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20121113/9a4bfbc1/attachment.html>


More information about the Rpm-list mailing list