rpm macro magic help

Sandro Mani manisandro at gmail.com
Thu Nov 7 13:10:19 UTC 2013


On 07.11.2013 12:38, Michael Schwendt wrote:
> On Sat, 02 Nov 2013 18:40:46 +0100, Sandro Mani wrote:
>
>> On 02.11.2013 18:18, Kevin Kofler wrote:
>>> Hi,
>>>
>>> Sandro Mani wrote:
>>>> %define do_build() \
>>>> mkdir build_win%{1}_%{2}; \
>>>> (cd build_win%{1}_%{2}; \
>>>> %{mingw%{1}_qmake_%{2}} 'PREFIX=%{mingw%{1}_prefix}'
>>>> 'TARGET=quazip-%{2}' ../libquazip; \
>>>> %{mingw%{1}_make} %{?_smp_mflags}; \
>>>> )\
>>>> %{nil}
>>> Ewww!
>>>
>>> Sorry to rain on your parade, but are you sure this (and with the fix for
>>> the nested expansion, it becomes even more ugly) is compatible with the
>>> "spec files must be legible" packaging guideline?
>>>
>> That is a valid point. I don't know what is better,
> Well, a Shell Function would be more readable, for example. It would
> accept normal arguments to fill in variables -- instead of global RPM
> macros, which are substituted in the entire spec file.
Uhm, how can one this be done? Shell variables are substituted after 
macro expansion, so i.e.

function do_build {
arch=$1
qt_version=$2
%{mingw${arch}_qmake_${qt_version}}
}

would hardly work? Or are you suggesting passing the entire macros as 
arguments? I.e.

function do_build {
qmake=$1
make=$2
${qmake} <args>
${make} %{?_smp_mflags}}
[...]
do_build "%{mingw32_qmake_qt4}" "%{mingw32_make}"


Sandro





More information about the devel mailing list