File krename.spec of Package krename

#
# spec file for package krename
#
# Copyright (c) 2012 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/
#


Name:           krename
Version:        4.0.9
Release:        0
Summary:        A Powerful Batch Renamer for KDE
License:        GPL-2.0+
Group:          Productivity/File utilities
Url:            http://www.krename.net/
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-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)
Patch2:         krename-4.0.7_add_common_names_to_FindLIBPODOFO.patch
# PATCH-FIX-UPSTREAM remove-gplv2-code.diff dmueller@suse.de -- Remove GPLv2 only code (only used for self-testing)
Patch3:         remove-gplv2-code.diff
BuildRequires:  libexiv2-devel
BuildRequires:  libkde4-devel
BuildRequires:  libpodofo-devel
%if %suse_version > 1200
BuildRequires:  pkgconfig(taglib)
%else
BuildRequires:  taglib-devel
%endif
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%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
# GPLv2 only code, not really needed, lets avoid the license discussion
rm -rf src/modeltest.*
%patch3

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

%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