CFLAGS in python noarch packages

Ralf Corsepius rc040203 at freenet.de
Tue Jul 12 13:24:34 UTC 2005


On Tue, 2005-07-12 at 13:53 +0100, Paul Howarth wrote:
> The fedora-rpmdevtools package contains a template for a python package 
> with %build as:

I know too little about python to be able to comment on it, but having
investigated a bit recently on the perl stuff, ...

> CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
> 
> This compares with the perl equivalent of:
> 
> CFLAGS="$RPM_OPT_FLAGS" %{__perl} Makefile.PL INSTALLDIRS=vendor
> make %{?_smp_mflags} OPTIMIZE="$RPM_OPT_FLAGS"
This construct is arguable.

IMO, it can be reduced to
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"
make %{?_smp_mflags}

> For perl noarch packages, it's usual to strip out the optimization 
> flags, resulting in:
>
> %{__perl} Makefile.PL INSTALLDIRS=vendor
> make %{?_smp_mflags}
This is only partially true.

You can remove OPTIMIZE and CFLAGS for noarch-rpms, because CFLAGS etc.
are meaningless for noarch-rpms.

If you omit them for binary packages, in most cases (at least in
ExtUtils::MakeMaker based configurations), a default set of OPTIMIZE
flags will be used, which is identical to RPM_OPT_FLAGS. I.e. the rpm
spec will be using the CFLAGS of the rpm base-architecture, but will not
acknowledge the target architecture (rpmbuild --target=...).

To make perl-rpms target-architecture aware, depending on a package's
internals, RPM_OPT_FLAGS must be passed to a package's configuration. In
most cases this is OPTIMIZE.

> Does the same apply in python, i.e. reduce to:
> 
> %{__python} setup.py build
> 
> Looking at a few python packages in cvs, everyone seems to be retaining 
> the CFLAGS setting; is this necessary or even useful?

Probably. c.f. above.

Ralf





More information about the fedora-extras-list mailing list