File k3b.spec of Package k3b

#
# spec file for package k3b
#
# Copyright (c) 2015 SUSE LINUX 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/
#


%bcond_with ffmpeg
%bcond_with mad
%bcond_with lame

Name:           k3b
Version:        2.0.3
Release:        0
Summary:        CD/DVD/Blu-ray Burning Application for KDE
License:        GPL-2.0+
Group:          Productivity/Multimedia/CD/Record

Url:            http://www.k3b.org/
Source:         http://download.kde.org/stable/%{name}/%{name}-%{version}a.tar.xz
# PATCH-FIX-OPENSUSE initial-preference.diff llunak@novell.com -- Make the default handler for .iso files instead of Ark
Patch0:         initial-preference.diff
# PATCH-FIX-OPENSUSE building-docs-once-is-enough.patch  -- Fix build when CMP002 policy is set to NEW
Patch1:         building-docs-once-is-enough.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# only needed to patch broken images in the upstream tarball
BuildRequires:  ImageMagick
BuildRequires:  fdupes
BuildRequires:  flac-devel
%if %{with lame}
BuildRequires:  libmp3lame-devel
%endif
BuildRequires:  libdvdread-devel
%if %{with ffmpeg}
BuildRequires:  libffmpeg-devel
%endif
BuildRequires:  libkcddb4-devel
%if %{with mad}
BuildRequires:  libmad-devel
%endif
BuildRequires:  libmpcdec-devel
BuildRequires:  libmusicbrainz-devel
BuildRequires:  libsamplerate-devel
BuildRequires:  libsndfile-devel
%if %suse_version > 1200
BuildRequires:  pkgconfig(taglib)
%else
BuildRequires:  taglib-devel
%endif
BuildRequires:  libvorbis-devel
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
Requires:       /usr/bin/cdrdao
Requires:       /usr/bin/cdrecord
Requires:       /usr/bin/mkisofs
Requires:       /usr/bin/readcd
Requires:       dvd+rw-tools
%kde4_runtime_requires
Requires(post): shared-mime-info
Requires(postun): shared-mime-info
Recommends:     /usr/bin/normalize
Recommends:     /usr/bin/sox
Recommends:     /usr/bin/transcode
Recommends:     vcdimager
Recommends:     %{name}-lang = %{version}
Provides:       kde4-k3b = 4.2.2.svn951754
Obsoletes:      kde4-k3b < 4.2.2.svn951754

%description
Featuring a simple, yet powerful graphical interface, k3b provides various
options for burning a CD, DVD, or BD (Blu-ray disc). Various types of optical
projects are supported including (but not limited to) audio and data, video
projects for DVD and VCD, as well as multi-session and mixed-mode discs. k3b
also has the ability to erase re-writeable media and can perform more
complicated tasks such as audiovisual encoding and decoding.

%package devel
Summary:        Development files for k3b
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
This package contain files needed for development with k3b.

%lang_package
%prep
%setup -q -n %{name}-%{version}
%patch0
%patch1 -p1

# patch image with wrong dimensions - fix rpmlint warning "wrong-icon-size"
pushd src/icons/actions
for f in hi16*.png; do
  geom=$(identify -ping "$f"|cut -f3 -d" ")
  x=${geom%x*}
  y=${geom#*x}
  if [ "$x" != "16" -o "$y" != "16" ]; then
    if [ "$x" -gt "$y" ]; then
      nugeom="${x}x${x}"
      grav=south
    elif [ "$x" -lt "$y" ]; then
      nugeom="${y}x${y}"
      grav=center
    else
       nugeom=""
    fi
    [ -n "$nugeom" ] && mogrify -extent "$nugeom" -background transparent -gravity "$grav" "$f"
    mogrify -scale 16x16 -background transparent "$f"
  fi
done
popd

%build
export RPM_OPT_FLAGS="%{optflags} -fno-strict-aliasing"

%cmake_kde4 -d build -- -DK3B_ENABLE_HAL_SUPPORT=OFF
%make_jobs

%install
%kde4_makeinstall -C build

%if 0%{?suse_version}
%suse_update_desktop_file -r k3b Qt KDE AudioVideo DiscBurning
%endif

# Remove unneeded locales
%if 0%{?suse_version} && 0%{?suse_version} < 1140
rm -rf %{buildroot}%{_datadir}/locale/ast/
rm -rf %{buildroot}%{_datadir}/locale/csb/
rm -rf %{buildroot}%{_datadir}/locale/hne/
rm -rf %{buildroot}%{_datadir}/locale/sr@ijekavian/
rm -rf %{buildroot}%{_datadir}/locale/sr@ijekavianlatin/
%endif

# symlink solid actions into place known to Plasma 5, remove once k3b is KF5-based
mkdir -p %{buildroot}%{_datadir}/solid/actions
pushd %{buildroot}%{_kde4_appsdir}/solid/actions/
for i in k3b_*.desktop; do
ln -s %{_kde4_appsdir}/solid/actions/$i %{buildroot}%{_datadir}/solid/actions/
done
popd

# Fix rpmlint warning "files-duplicate*"
%fdupes -s %{buildroot}

%find_lang k3b k3b.lang
%find_lang k3bsetup k3b.lang
%find_lang libk3b k3b.lang
%find_lang libk3bdevice k3b.lang
%find_lang kio_videodvd k3b.lang

%kde_post_install

%post
/sbin/ldconfig
/usr/bin/update-mime-database %{_datadir}/mime >/dev/null 2>&1 ||:

%postun
/sbin/ldconfig
/usr/bin/update-mime-database %{_datadir}/mime >/dev/null 2>&1 ||:

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc COPYING* ChangeLog FAQ PERMISSIONS README
%{_kde4_bindir}/k3b
%{_kde4_bindir}/k3bsetup
%{_kde4_modulesdir}/k3b*.so
%{_kde4_modulesdir}/kcm_k3b*.so
%{_kde4_modulesdir}/kio_videodvd.so
%{_kde4_libexecdir}/k3bsetuphelper
%{_kde4_libdir}/libk3bdevice.so.*
%{_kde4_libdir}/libk3blib.so.*
%{_kde4_applicationsdir}/k3b.desktop
%doc %{_kde4_htmldir}/en/k3b/
%{_kde4_iconsdir}/hicolor/*/apps/k3b.*
%{_kde4_appsdir}/k3b/
%{_kde4_appsdir}/konqsidebartng/virtual_folders/services/videodvd.desktop
%dir %{_kde4_appsdir}/solid
%dir %{_kde4_appsdir}/solid/actions
%{_kde4_appsdir}/solid/actions/k3b_*.desktop
%dir %{_datadir}/solid
%dir %{_datadir}/solid/actions
%{_datadir}/solid/actions/k3b_*.desktop
%{_kde4_servicesdir}/ServiceMenus/k3b_*.desktop
%{_kde4_servicesdir}/k3b*.desktop
%{_kde4_servicesdir}/kcm_k3b*.desktop
%{_kde4_servicesdir}/videodvd.protocol
%{_kde4_servicetypesdir}/k3bplugin.desktop
%{_kde4_datadir}/mime/packages/x-k3b.xml
%config %{_sysconfdir}/dbus-1/system.d/org.kde.kcontrol.k3bsetup.conf
%{_kde4_datadir}/dbus-1/system-services/org.kde.kcontrol.k3bsetup.service
%{_kde4_datadir}/polkit-1/actions/org.kde.kcontrol.k3bsetup.policy

%files devel
%defattr(-,root,root,-)
%{_kde4_includedir}/k3b*.h
%{_kde4_libdir}/libk3bdevice.so
%{_kde4_libdir}/libk3blib.so

%files lang -f k3b.lang
%defattr(-,root,root,-)
%exclude %{_kde4_htmldir}/en/k3b/

%changelog
openSUSE Build Service is sponsored by