%define codename Gotham

Summary:	XBMC is a free Media Center
Summary(ja): 	XBMC メディアセンター
Name:		xbmc
Version:	13.2
Release: 	1%{?_dist_release}
Source0:	%{name}-%{version}.tar.gz
#Source0:	%{codename}.zip
Source1:	%{name}.desktop
#i18n
#Source10:	xbmc-9.11-langinfo.xml
#Source11:	xbmc-11.0-strings.xml
#Source12:	xbmc-11.0-Confluence-strings.xml
#lircd patch
#Patch0:		xbmc-9.11-lircd.patch
# change default locale and font
Patch1:		%{name}-%{version}-default-locale.patch
#Patch2:		%{name}-%{version}-use-pkgconfig-for-samba.patch
#Patch3:		%{name}-%{version}-dvdread.patch
Patch4:         %{name}-%{version}-vine.patch
License:	GPLv2+
Group:		Applications/Multimedia
URL:		http://xbmc.org/

#Requires:	lsb
Requires:	python-imaging
Requires:	pysqlite
Requires:	hicolor-icon-theme
Requires(post):	 desktop-file-utils
Requires(postun):desktop-file-utils

%if %{?_dist_release} >= "vl7"
BuildRequires:	mariadb-devel
%else
BuildRequires:  MySQL-devel
%endif
BuildRequires:	SDL_gfx-devel
BuildRequires:	SDL_image-devel
BuildRequires:	SDL_mixer-devel
BuildRequires:	alsa-lib-devel
BuildRequires:	avahi-devel
BuildRequires:	bzip2-devel
BuildRequires:	cmake
BuildRequires:	curl-devel
BuildRequires:	cvs
BuildRequires:	dbus-devel
BuildRequires:	desktop-file-utils
BuildRequires:	doxygen
BuildRequires:	enca-devel
BuildRequires:	flac-devel
BuildRequires:	fontconfig-devel
BuildRequires:	fribidi-devel >= 0.19
BuildRequires:	glew-devel
BuildRequires:	gperf
BuildRequires:	gmp-devel
#BuildRequires:	hal-devel
BuildRequires:	jasper-devel
BuildRequires:	java >= 1.6
BuildRequires:	libXinerama-devel
BuildRequires:	libXmu-devel
BuildRequires:	libXrandr-devel
BuildRequires:	libXtst-devel
BuildRequires:	libass-devel
BuildRequires:	libboost-devel
BuildRequires:	libbluray-devel
BuildRequires:	libcap-devel
BuildRequires:	libcdio-devel
BuildRequires:	libdvdread-devel
BuildRequires:	expat-devel
BuildRequires:	libjpeg-devel
BuildRequires:	libmicrohttpd-devel
BuildRequires:	libmms-devel
BuildRequires:	libmodplug-devel
BuildRequires:	libogg-devel
BuildRequires:	libplist-devel
BuildRequires:	libpng-devel
BuildRequires:	libsamplerate-devel
BuildRequires:	libssh-devel
BuildRequires:	libssh2-devel
BuildRequires:	libsmbclient-devel
BuildRequires:	libtiff-devel
BuildRequires:	libtool-ltdl-devel
BuildRequires:	libudev-devel
BuildRequires:	libusb-devel
BuildRequires:	libva-devel
BuildRequires:	libvorbis-devel
BuildRequires:	libxml2-devel
BuildRequires:	libxslt-devel
BuildRequires:	nasm
BuildRequires:	openssl-devel
BuildRequires:	lzo-devel
BuildRequires:	pcre-devel
BuildRequires:	pulseaudio-libs-devel
BuildRequires:	sqlite3-devel
BuildRequires:	swig
BuildRequires:	taglib-devel >= 1.8
BuildRequires:	tinyxml-devel
BuildRequires:	unzip
BuildRequires:	wavpack-devel
BuildRequires:	zlib-devel
BuildRequires:	self-build-faac
BuildRequires:	self-build-faad2
BuildRequires:	self-build-lame
BuildRequires:	self-build-libmad
BuildRequires:	self-build-libmpeg2
BuildRequires:	libvdpau-devel
BuildRequires:  bluez-libs-devel
BuildRequires:  yajl-devel
BuildRequires:  python-devel
BuildRequires:  libshairport-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Packager:	kazutaka, shaolin

%description
XBMC is an award-winning free and open source (GPL) software media player
and entertainment hub for digital media.

Currently XBMC can be used to play almost all popular audio and video formats
around. It was designed for network playback, so you can stream your multimedia
from anywhere in the house or directly from the internet using practically any
protocol available. Use your media as-is: XBMC can play CDs and DVDs directly
from the disk or image file, almost all popular archive formats from your hard
drive, and even files inside ZIP and RAR archives. It will even scan all of
your media and automatically create a personalized library complete with box
covers, descriptions, and fanart. There are playlist and slideshow functions,
a weather forecast feature and many audio visualizations. Once installed,
your computer will become a fully functional multimedia jukebox.

%description -l ja
XBMC はいくつもの賞を受賞したフリーでオープンソース (GPL) な、
デジタルメディア向けのメディアプレイヤー/メディアセンターです。

XBMC は一般的な形式のビデオやオーディオファイルであれば、その殆ど
を再生できます。またネットワークを介した再生にも対応しており、
ホームLAN やインターネットを経由したストリーミングも利用できます。

また、XBMC は CD や DVD を直接再生できるだけでなく、ハードディスク
上のディスクイメージや一般的なアーカイブ、ZIP や RAR アーカイブ等で
あってもそのまま利用できます。

XBMC は PC 上のメディアファイルをスキャンして、自動的にライブラリ
を構築し、カバーアートや説明、ファンアート等を付加してくれます。
その他にも、プレイリストやスライドショー、天気予報、オーディオの
ビジュアライゼーション機能等を備えています。

XBMC をインストールすれば、あなたの PC は多機能なマルチメディア
ジュークボックスに生まれ変わります。


%prep
%setup -q -n %{name}-%{version}-%{codename}
%patch1 -p1 -b .default-locale
#%patch2 -p0 -b .use-pkgconfig-for-samba
#%patch3 -p1 -b .dvdread
%patch4 -p1 -b .vine

#setup language files
#%{__cp} -f %{SOURCE10} language/Japanese/langinfo.xml
#%{__cp} -f %{SOURCE11} language/Japanese/strings.xml
#%{__mkdir} -p addons/skin.confluence/language/Japanese
#%{__cp} -f %{SOURCE12} addons/skin.confluence/language/Japanese/strings.xml

%build
%ifarch x86_64
LIBS="-L/usr/lib64/mysql $LIBS"
%else
LIBS="-L/usr/lib/mysql $LIBS"
%endif

export LIBS

./bootstrap
%configure --disable-debug \
           --disable-ccache \
           --enable-gl \
           --enable-sdl \
           --enable-pulse \
           --enable-vdpau  \
           --enable-vaapi  \
           --enable-xrandr  \
           --enable-projectm  \
           --enable-x11  \
           --enable-libudev \
           --enable-ffmpeg-libvorbis \
           --enable-dvdcss \
           --enable-mid \
           --enable-libmp3lame \
           --enable-libbluray \
           --enable-libvorbisenc \
           --enable-libcap \
           --with-lirc-device=%{_localstatedir}/run/lirc/lircd \
           --docdir=%{_docdir}/%{name}-%{version}

%{__make} %{?_smp_mflags}


%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}

#install man pages
%{__mkdir_p} %{buildroot}/%{_mandir}/man1
%{__cp} docs/manpages/* %{buildroot}/%{_mandir}/man1
gzip -9nf %{buildroot}/%{_mandir}/man1/*

# Install desktop file
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE1}


%post
update-desktop-database %{_datadir}/applications>& /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache -q %{_datadir}/icons/hicolor ||:
fi

%postun
update-desktop-database %{_datadir}/applications>& /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache -q %{_datadir}/icons/hicolor ||:
fi


%clean
%{__rm} -rf %{buildroot}


%files
%defattr(-,root,root)
%doc %{_docdir}/%{name}-%{version}
%{_bindir}/%{name}
%{_bindir}/%{name}-standalone
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/xsessions/XBMC.desktop
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_includedir}/%{name}
%{_libdir}/%{name}
%{_mandir}/man1/*

%changelog
* Mon Jan 12 2015 Munehiro Yamamoto <munepi@vinelinux.org> 13.2-1
- new upstream release (13.2 Gotham)
- dropped BuildRequires: hal-devel

* Tue Jun 17 2014 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 13.1-1
- new upstream release (13.1 Gotham)
- add Source7 (Patch4) to get rid of lsb dependency

* Wed May  7 2014 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 13.0-1
- new upstream release (13.0 Gotham)
- source tarball not released yet - get the zip archive from github instead

* Fri Oct 25 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 12.2-4
- revert 12.2-3 changes (subtitles won't be displayed correctly)

* Wed Oct 23 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 12.2-3
- use external ffmpeg and other libraries

* Wed Oct 23 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 12.2-2
- minor fix

* Thu Aug  8 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 12.2-1
- new upstream release

* Mon Mar  4 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 12.0-2
- add patch to fix build failure with samba > 4.0 (BTS: 0002557)

* Sun Feb 10 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 12.0-1
- new upstream release

* Fri Mar 30 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 11.0-5
- fix silly typo in Source11

* Thu Mar 29 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 11.0-4
- Source11 and Source12 (Japanese strings) much updated

* Wed Mar 28 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 11.0-3
- update Packager

* Wed Mar 28 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 11.0-2
- update Source11 (Japanese strings)

* Wed Mar 28 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 11.0-1
- new upstream release
- add build depencencies for bluez-libs-devel, yajl-devel, yasm & python-devel

* Fri Feb 04 2011 Kazutaka HARADA <kazutaka@vinelinux.org> 10.0-3
- delete build_vine5 macro: libvdpau is now available on 5.2

* Thu Jan 27 2011 Kazutaka HARADA <kazutaka@vinelinux.org> 10.0-2
- add --disable-ccache option (<BTS:VineLinux:1100>)
- update Patch1 to change default timezone

* Tue Jan 18 2011 Kazutaka HARADA <kazutaka@vinelinux.org> 10.0-1
- new upstream release
- drop patch0: use configure option to specity lirc device)
- drop Source10: included in upstream
- update Source11 & 12: japanese translation
- add Souce1: xbmc.desktop with japanese description

* Sat Jan 02 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 9.11-1
- initial build for Vine Linux
- add patch0: change lircd socket location
- add Source10-12: japanese translation & langinfo
