%define i18n_version 1.0.5

Name: k3b
Version: 1.0.5
Release: 5%{?_dist_release}
Summary: CD/DVD burning application for KDE
Summary(ja): KDE 用の CD/DVD 作成アプリケーション
Source0: http://downloads.sf.net/k3b/%{name}-%{version}.tar.bz2
Source1: http://downloads.sf.net/k3b/%{name}-i18n-%{i18n_version}.tar.bz2
Source2: k3brc
License: GPLv2
Group: Applications/Archiving
URL: http://www.k3b.org/

Requires: qt, libvorbis, libogg, self-build-lame
Requires: libzvt, libpng, libjpeg, libdvdread
Requires: libidn, id3lib, kdelibs, cdrtools-cdrecord
Requires: cdrtools-mkisofs, dvd+rw-tools, audiofile, arts
Requires: gamin, cdrdao, cdparanoia, dbus-qt3
Requires: flac, dvdrecord, libstdc++2_10
Requires: libstdc++2_10-compat, sox, libsndfile
Requires: alsa-lib, libsamplerate, libmusicbrainz-devel

BuildPreReq: qt-devel, libvorbis-devel, self-build-lame
BuildPreReq: libogg-devel, libzvt-devel
BuildPreReq: libpng-devel, libjpeg-devel, libdvdread-devel, libidn-devel
BuildPreReq: id3lib-devel, kdelibs-devel, audiofile-devel
BuildPreReq: arts-devel, gamin-devel, zlib-devel
BuildPreReq: flac-devel, taglib-devel, libmng-devel, dbus-qt3-devel
BuildPreReq: libmusicbrainz-devel, sox-devel, libsndfile-devel
BuildRequires: desktop-file-utils, libsamplerate-devel, alsa-lib-devel
BuildRequires: libmusicbrainz-devel, hal-devel

# X libs
%if %{?_dist_release} == "vl5"
Requires: xorg-x11-libs
BuildPreReq: xorg-x11-devel
%endif
%if %{?_dist_release} == "vl4"
Requires: XOrg
BuildPreReq: XOrg-devel
%endif

# self-build
Requires: self-build-libmad
BuildRequires: self-build-libmad
##Requires: libmad
##BuildRequires: libmad-devel

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

ExcludeArch: s390 s390x

Patch2: k3b-1.0.3-umount.patch
# manual bufsize (upstream?)
Patch4: k3b-1.0.4-manualbufsize.patch
# upstream patches
# http://bugs.kde.org/151816 , k3b can't reload media for verification
Patch100: k3b-1.0.4-kde#151816.patch
# http://bugs.kde.org/156684 , alternative to patch100
Patch101: k3b-1.0.5-kde#156684.patch
# put k3b-(iso,cue).desktop to xdg_apps_DATA , see http://bugzilla.redhat.com/419681
# upstreamed 2008-08-27
Patch105: k3b-1.0.5-hidden.patch

Vendor: Project Vine
Distribution: Vine Linux

%description
K3b is a CD and DVD burning application for Linux systems optimized for KDE. 
It provides a comfortable user interface to perform most 
CD/DVD burning tasks like creating an Audio CD from a set of audio files or copying a CD.

%description -l ja
k3b は、KDE の為に最適化された Linux システム用の CD/DVD 作成アプリケーションです。
多様なCD/DVDの作成に快適なユーザーインターフェースを提供します。
また、音楽データや CD の複製等、音楽 CD を簡単に作成できます。

%package i18n
Summary: K3b internationalization RPM
Summary(ja): k3b 国際化 RPM
Group: Applications/Archiving
Requires: %{name} = %{version}-%{release}
%description i18n
K3b can be internationalized.
%description -l ja i18n
k3b を国際化します。

BuildRequires: kdelibs-devel >= 3.1

%prep
%setup -q -a 1

##ALL Fedora patch
%patch2 -p1 -b .umount
# set in k3brc too 
%patch4 -p1 -b .manualbufsize
%patch100 -p1 -b .kde#151816
%patch101 -p1 -b .kde#156684
%patch105 -p1 -b .hidden

%package devel
Summary: Files for the development of applications which will use %{name} 
Group: Development/Libraries
%description devel
%{summary}.

%build
unset QTDIR || : ; . /etc/profile.d/qt.sh

%configure \
	--with-k3bsetup=yes \
	--includedir=%{_includedir}/k3b \
	--with-cdrecord-suid-root \
	--disable-rpath \
	--disable-debug \
	--disable-warnings \
	--without-ffmpeg \
	--with-lame \
	--with-libmad \
	--with-alsa \
	--with-oggvorbis \
	--with-flac \
	--with-external-libsamplerate \
	--with-sndfile \
	--with-musicbrainz \
	--with-libdvdread \
	--enable-new-ldflags
#	--without-musepack 
#       --disable-dependency-tracking --enable-final \


%{__make} %{?_smp_mflags}

# Build for i18n
pushd %{name}-i18n-%{i18n_version}
%configure
%{__make} %{?_smp_mflags}
popd

%install
rm -rf $RPM_BUILD_ROOT
%{__make} install DESTDIR=$RPM_BUILD_ROOT

# install for i18n
pushd %{name}-i18n-%{i18n_version}
%{__make} install DESTDIR=$RPM_BUILD_ROOT
popd

# *.h new dir 
%{__mkdir} -p $RPM_BUILD_ROOT%{_includedir}/k3b

# install for k3brc
%{__install} -D -m 644 -p %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/config/k3brc

desktop-file-install --vendor="vine" \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications/kde \
  $RPM_BUILD_ROOT%{_datadir}/applications/kde/*.desktop

# remove the .la files
%{__rm} -rf $RPM_BUILD_ROOT%{_libdir}/libk3b*.la 
#%{__rm} -rf $RPM_BUILD_ROOT%{_libdir}/kde3/*.la

# remove i18n for Plattdeutsch (Low Saxon)
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/locale/nds

%find_lang k3b
%find_lang k3bsetup
%find_lang libk3b
%find_lang libk3bdevice
cat k3b.lang k3bsetup.lang libk3b.lang libk3bdevice.lang >> all.lang

%post
touch --no-create %{_datadir}/icons/hicolor ||:
gtk-update-icon-cache -q %{_datadir}/icons/hicolor 2> /dev/null ||:
update-desktop-database %{_datadir}/applications > /dev/null 2>&1 ||:

%postun
touch --no-create %{_datadir}/icons/hicolor ||:
gtk-update-icon-cache -q %{_datadir}/icons/hicolor 2> /dev/null ||:
update-desktop-database %{_datadir}/applications > /dev/null 2>&1 ||:

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files -f all.lang
%defattr(-,root,root,755)
%doc AUTHORS README COPYING TODO ChangeLog
%doc %{_docdir}/HTML/*/*
%{_bindir}/k3b
%{_bindir}/k3bsetup
%{_datadir}/applications/kde/*.desktop
%{_datadir}/mimelnk/application/*.desktop
%{_libdir}/kde3/*.la
%{_libdir}/libk3b*.so.*
%{_libdir}/kde3/*.so
%{_datadir}/apps/konqsidebartng/virtual_folders/services/*.desktop
%{_datadir}/services/*.desktop
%{_datadir}/services/videodvd.protocol
%{_datadir}/apps/k3b/*
%{_datadir}/apps/konqueror/servicemenus/*
%{_datadir}/config/k3brc
%{_datadir}/sounds/*
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/applnk/Settings/System/k3bsetup2.desktop

# k3b-i18n Files
%files i18n
%lang(da) %doc %{_docdir}/HTML/da/*
%lang(de) %doc %{_docdir}/HTML/de/*
%lang(es) %doc %{_docdir}/HTML/es/*
%lang(et) %doc %{_docdir}/HTML/et/*
%lang(fr) %doc %{_docdir}/HTML/fr/*
%lang(pt) %doc %{_docdir}/HTML/pt/*
%lang(ru) %doc %{_docdir}/HTML/ru/*
%lang(sv) %doc %{_docdir}/HTML/sv/*
#%{_localedir}/*

%files devel
%defattr(-,root,root,-)
%{_includedir}/k3b/*.h
%{_libdir}/libk3b*.so

%changelog
* Mon Feb 09 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0.5-5
- changed to Requires: self-build-libmad from libmad
- changed to BuildRequires: self-build-libmad from libmad-devel
- added Requires: %{name} = %{version}-%{release} in k3b-i18n subpackage

* Sun Jan 18 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0.5-4
- removed Release: tag of k3b-i18n subpackage

* Sat Jan 17 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0.5-3
- rebuild with libdvdread.so.4 for vl4 <BTS:651>
- spec in utf-8
- merged the spec of 1.0.5-1vl4 release: 
  - added --with-lame --with-libdvdread in %%configure options
  - set --vendor="vine" in desktop-file-install

* Mon Jan 12 2009 TOSHI <milk-tea1977@dune.ocn.ne.jp> 1.0.5-1
- new upstream release
- change %{_includedir}/k3b
- drop {_localedir}/*  (i18n)
- add devel Package

* Fri Jan 2 2009 TOSHI <milk-tea1977@dune.ocn.ne.jp> 1.0.5-2vl5
- It returned it: %{_libdir}/kde3/*.la

* Wed Dec 31 2008 TOSHI <milk-tea1977@dune.ocn.ne.jp> 1.0.5-1vl5
- new upstream release.
- spec in utf-8, and applied vine versioning policy.
- Remove *.la.
- specfile updates.

*Tue Dec 26 2006 TOSHI <vine-jp@mail.goo.ne.jp> 0.12.17-0vl1
-new upstream release

*Sun Jun 18 2006 TOSHI <toshi-52@sa.il24.net> 0.12.15-0vl3
-with-k3bsetup=no option is deleted.

*Sat Apr 15 2006 TOSHI <toshi-52@sa.il24.net> 0.12.15-0vl1
-new upstream release
-Requires -> sox and libsndfile added
-BuildPreReq -> sox-devel and libsndfile-devel added
-with-k3bsetup=no option added

*Sun Apr 9 2006 TOSHI <toshi-52@sa.il24.net> 0.12.14-0vl1
-new upstream release

*Tue Feb 14 2006 TOSHI <vine-jp@mail.goo.ne.jp> 0.12.10-0vl1
-new upstream release
-Requires -> Libstdc++2_10 and libstdc++2_10-compat added

*Sat Feb 9 2006 TOSHI <vine-jp@mail.goo.ne.jp> 0.12.10-0vl1
-new upstream release
-added i18n to spec

*Thu Aug 16 2005 TOSHI <toshi-52@s5.dion.ne.jp> 0.12.3-0vl1
-new upstream release

* Thu Jul 12 2005 TOSHI <toshi-52@s5.dion.ne.jp> 0.12.2-0vl1
-new upstream release

* Thu May 30 2005 TOSHI <toshi-52@s5.dion.ne.jp> 0.12beta2-0vl1
-1st Release.
