From Fedora Project Wiki
Generic template
Name: Version: Release: 1%{?dist} Summary: Group: License: URL: Source0: BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: kdelibs4-devel >= 4 BuildRequires: kde-filesystem >= 4 BuildRequires: cmake BuildRequires: %{?_kde4_macros_api:Requires: kde4-macros(api) = %{_kde4_macros_api} } Requires: %description %prep %setup -q %build mkdir -p %{_target_platform} pushd %{_target_platform} %{cmake_kde4} .. popd make %{?_smp_mflags} -C %{_target_platform} %install rm -rf %{buildroot} mkdir %{buildroot} make install DESTDIR=%{buildroot} -C %{_target_platform} %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %doc %changelog
%files
Some macros are substituted for KDE4:
Normal macro | kde4 macro |
%{_prefix} | %_kde4_prefix |
%{_bindir} | %{_kde4_bindir}} |
%{_sysconfdir} | %{_kde4_sysconfdir} |
%{_libdir} | %{_kde4_libdir} |
%{_datadir} | %{_kde4_datadir} |
%{_datadir}/icons/ | %{_kde4_iconsdir} |
%{_datdir}/config/ | %{_kde4_configdir} |
%{_datdir}/kde4/apps | %{_kde4_appsdir} |
%{_datadir}/doc/ | %{_kde4_docdir} |
%{_sbindir} | %{_kde4_sbindir} |
%{_includedir} | %{_kde4_includedir} |
Icons
If your package is installing some icons to %{_kde4_iconsdir} (and normally it does) you should add this lines to your spec file to update the icon cache properly:
Requires(post): xdg-utils Requires(postun): xdg-utils ... %clean rm -rf %{buildroot} %post xdg-icon-resource forceupdate --theme hicolor 2> /dev/null || : %postun xdg-icon-resource forceupdate --theme hicolor 2> /dev/null || :
This example is for /usr/share/icons/hicolor. If there are addidional icons installed in additional icon sets (for example: /usr/share/icons/crystalsvg) you should add an additional line for these icon set.