[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensuse-packaging
Subject:    Re: [opensuse-packaging] skrooge build: kde version specific directories
From:       David Haller <dnh () opensuse ! org>
Date:       2012-03-16 2:46:15
Message-ID: 20120316024614.GA4188 () grusum ! endjinn ! de
[Download RAW message or body]

Hello,

On Thu, 15 Mar 2012, Sascha Manns wrote:
>Anything like:
>%if 0%{?_kde4_version} => 4.8.0
[..]
>But do we have that macro? Or how can i do this job?

An answer to this, not your actual question:

==== /etc/rpm/macros.kde4 ====
%_kde_platform_version 4.6.0
%_kde_pimlibs_version 4.6.0
%_kde_akonadi_version 1.4.95
====

amongst a bunch of other macros.

A different way would be to call kde4-config --version or
kde4-config --kde-version, which also has a lot of other options (for
which there might be no predefined macros in /etc/rpm/macros.kde4.

To get one such output into a rpm-macro use:

%define kde4_foo %(kde4-config --foo [| sed ... ])

e.g.:

==== for a .spec file ====
%define _kde4_sounddir %(kde4-config --path sound | tr : '\\n' | \
    sed -n '/^\\/home\\//d;{p;q;}')
====

To test such stuff you can use 'rpm --eval' or put it in
'~/.rpmmacros' without the %define, but with %:

==== for ~/.rpmmacros or /etc/rpm/macros.* ====
%_kde_sounddir %(kde4-config --path sound | tr : '\\n' | \
    sed -n '/^\\/home\\//d;{p;q;}')
====

and in --eval you don't need to double the '\':

$ rpm --eval "%(kde4-config --path sound | tr : '\n' | \
    sed -n '/^\/home\//d;{p;q;}')"
/usr/share/sounds

BTW: that sed does a 'grep -v '^/home/' | head -n 1' ;)

That "scheme" for running stuff to define a macro in a .spec can be
quite useful ;)

HTH, and apropos \\// ...

Live long and prosper,
-dnh

-- 
> The three "R"s of Microsoft support:
> Retry, Reboot, Reinstall
You forgot one: Repeat                  -- Mark Atwood, Lars Balker Rasmussen
-- 
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org
To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic