File krename.spec of Package krename

#
# spec file for package krename
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           krename
Version:        4.0.7
Release:        2
License:        GPL-2.0+
Summary:        A Powerful Batch Renamer for KDE
Url:            http://www.krename.net/
Group:          Productivity/File utilities
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM desktop-files.diff asterios.dramis@gmail.com -- Make the desktop file KDE and XDG compatible
Patch0:         desktop-files.diff
# PATCH-FIX-UPSTREAM servicemenus-files.patch asterios.dramis@gmail.com -- Make the desktop files KDE and XDG compatible
Patch1:         servicemenus-files.patch
# PATCH-FIX-OPENSUSE krename-4.0.7-static-init-crash.patch rh#684908 asterios.dramis@gmail.com -- Fix crash on static initialization (patch taken from Fedora)
Patch2:         krename-4.0.7-static-init-crash.patch
# PATCH-FIX-UPSTREAM krename-4.0.7_add_common_names_to_FindLIBPODOFO.patch sf#3256922 asterios.dramis@gmail.com -- Fix podofo library names cmake check (patch taken from upstream)
Patch3:         krename-4.0.7_add_common_names_to_FindLIBPODOFO.patch
Patch4:         remove-gplv2-code.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  libexiv2-devel
BuildRequires:  libkde4-devel
BuildRequires:  libpodofo-devel
BuildRequires:  taglib-devel
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
%kde4_runtime_requires

%description
KRename is a powerful batch renamer for KDE. It allows you to easily rename
hundreds or even more files in one go. The filenames can be created by parts of
the original filename, numbering the files or accessing hundreds of informations
about the file, like creation date or Exif informations of an image.

%prep
%setup -q
%patch0
%patch1
%patch2 -p1
%patch3 -p1
# GPLv2 only code, not really needed, lets avoid the license discussion
rm -rf src/modeltest.*
%patch4

# Remove build time references so build-compare can do its work (fix rpmlint warning "file-contains-date-and-time")
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/" src/main.cpp
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/main.cpp

%build
%cmake_kde4 -d build
%make_jobs

%install
cd build
%kde4_makeinstall
cd ..

%if 0%{?suse_version}
%suse_update_desktop_file -r %{name} Qt KDE System FileManager
%endif

%kde_post_install

%find_lang %{name}

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README TODO
%{_kde4_bindir}/krename
%{_kde4_applicationsdir}/krename.desktop
%{_kde4_iconsdir}/hicolor/*/*/krename.png
%{_kde4_iconsdir}/locolor/*/*/krename.png
%{_kde4_servicesdir}/ServiceMenus/krename_all_nonrec.desktop
%{_kde4_servicesdir}/ServiceMenus/krename_dir_rec.desktop

%changelog
openSUSE Build Service is sponsored by