Rpmbuild SPEC file - variable declaration

arnaud gaboury arnaud.gaboury at gmail.com
Sun Sep 13 14:01:27 UTC 2015


On Sun, Sep 13, 2015 at 3:53 PM, Reindl Harald <h.reindl at thelounge.net> wrote:
>
>
> Am 13.09.2015 um 15:39 schrieb arnaud gaboury:
>>
>> On Sun, Sep 13, 2015 at 2:16 PM, Rex Dieter <rdieter at math.unl.edu> wrote:
>>>
>>> arnaud gaboury wrote:
>>>
>>>> When declaring a variable value,  I wonder if the any difference/best
>>>> practice between these methods:
>>>>
>>>> export VAR=MyValue
>>>> %{define} VAR MyValue
>>>> %{global} VAR MyValue
>>>
>>>
>>> best practice is to use global, it is explicitly mentioned here:
>>>
>>> https://fedoraproject.org/wiki/Packaging:Guidelines#.25global_preferred_over_.25define
>>
>>
>> Very good. TY for short and precise answer.
>>
>> Now, for build flags macros and variables, I want to add some options
>> to the default one. I am not sure how to add options in a clean way.
>> These extra flags are used because I build with Intel Compiler:
>>
>> 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:

....
# ---- 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} \\\
...................

**************************************************
I use shared library I declare this way:

export LD_LIBRARY_PATH=${my_lib_path}:{my_lib2_path}

Any macro or %{variable} to declare these sahred libs? Couldn't find
anything (or missed it).
Thank you again for your tips.


>
>
> --
> devel mailing list
> devel at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/devel
> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct



-- 

google.com/+arnaudgabourygabx


More information about the devel mailing list