Rpmbuild SPEC file - variable declaration

Reindl Harald h.reindl at thelounge.net
Sun Sep 13 14:07:00 UTC 2015



Am 13.09.2015 um 16:01 schrieb arnaud gaboury:
> On Sun, Sep 13, 2015 at 3:53 PM, Reindl Harald <h.reindl at thelounge.net> wrote:
>>> export CFFLAGS= '-xHost -mavx -fp-model precise'
>>> %configure
>>>      CFFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
>>>      ........
>>>
>>> Is above the the best way?
>>
>>
>> no
>>
>> * there is no reason to mention CFLAGS in %configure again
>> * you don't want the default macro at the end because
>>    it would probably override your overrides
>> * export CFFLAGS="%optflags -xHost -mavx -fp-model precise"
>
> Got it. Found this way in /usr/lib/rpm/macros file:

well, that below defines the default %configure macro which you want to 
override which can be replaced / overriden in ~/.rpmmacros

[builduser at testserver:~]$ cat .rpmmacros
%_topdir %(echo $HOME)/rpmbuild
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot

%dist                   .fc22.%(echo $(/bin/date +%Y%m%d)).rh
%fedora                 22
%fc22                   1
%packager               Reindl Harald
%vendor                 thelounge interactive design
%_smp_mflags            -j10
%_include_minidebuginfo 0
%_binary_payload        w1.gzdio
%_source_payload        w1.gzdio
%__global_ldflags       -Wl,-z,now -Wl,-z,relro,-z,noexecstack

%configure \
   CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS; \
   CXXFLAGS="${CXXFLAGS:-%optflags}"; export CXXFLAGS; \
   FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}"; export FFLAGS; \
   FCFLAGS="${FCFLAGS:-%optflags -I%_fmoddir}"; export FCFLAGS; \
   LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS; \
   ./configure \\\
    --host=x86_64-redhat-linux \\\
    --build=x86_64-redhat-linux \\\
    --target=x86_64-redhat-linux \\\
    --program-prefix=%{?_program_prefix} \\\
    --disable-dependency-tracking \\\
    --prefix=%{_prefix} \\\
    --exec-prefix=%{_exec_prefix} \\\
    --bindir=%{_bindir} \\\
    --sbindir=%{_sbindir} \\\
    --sysconfdir=%{_sysconfdir} \\\
    --datadir=%{_datadir} \\\
    --includedir=%{_includedir} \\\
    --libdir=%{_libdir} \\\
    --libexecdir=%{_libexecdir} \\\
    --localstatedir=%{_localstatedir} \\\
    --sharedstatedir=%{_sharedstatedir} \\\
    --mandir=%{_mandir} \\\
    --infodir=%{_infodir}


> ....
> # ---- specfile macros.
> # Macro(s) here can be used reliably for reproducible builds.
> # (Note: Above is the goal, below are the macros under development)
> #
> # The configure macro runs autoconf configure script with platform specific
> # directory structure (--prefix, --libdir etc) and compiler flags
> # such as CFLAGS.
> #
> # The configure macro should be invoked as %configure (rather than %{configure})
> # because the rest of the arguments will be expanded using %*.
> #
> %_configure ./configure
> %configure \
>    CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
>    CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
>    FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
>    %{_configure} --host=%{_host} --build=%{_build} \\\

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20150913/a8fc2420/attachment.sig>


More information about the devel mailing list