Summary: Open source media player based on the Helix framework
Summary(ja): Helix フレームワークに基づくメディアプレイヤー
Name: HelixPlayer
Version: 1.0.7
Release: 6vl1
Group: Applications/Multimedia
License: RPSL, GPL
URL: https://player.helixcommunity.org/
Source0: https://helixcommunity.org/download.php/1950/hxplay-1.0.7-source.tar.bz2
Source1: HelixPlayer-buildrc

Obsoletes: G2player, RealOne
Provides:  G2player, RealOne

Patch0:		%{name}-1.0.beta20040615-cvs-no-update.patch
Patch1:		%{name}-1.0.3-disable-asm.patch
Patch2:		hxplay-1.0.4-nptl.patch
Patch3:		%{name}-1.0.5-missing-header.patch
Patch4:     HelixPlayer-1.0.7-ogg.patch
Patch5:     HelixPlayer-1.0.7-CVE-2007-3410.patch

BuildRequires: libtheora-devel >= 1.0-0.alpha3
BuildRequires: libvorbis-devel
BuildRequires: gtk2-devel python prelink
BuildRequires: libogg-devel XOrg-devel
BuildRequires: desktop-file-utils >= 0.9

ExcludeArch: ppc64 x86_64 s390 s390x ia64
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%description
The Helix Player is an open-source media player built in the Helix 
Community for consumers. Built using GTK, it plays open source formats, 
like Ogg Vorbis and Theora using the powerful Helix DNA Client Media 
Engine.

%description -l ja
Helix Player は Helix Community で作成されたコンシューマ向けの
オープンソースなメディアプレイヤーです．GTKを利用して作成されており，強力な 
Helix DNA Client Media Engine を利用して Ogg Vorbis や Theora などの
オープンソースフォーマットのファイルを演奏/閲覧することが可能です．

%package plugin
Summary:    HelixPlayer's webbrowser plugin
Group:      Applications/Multimedia
Requires:   %{name} = %{version}-%{release}
Requires:   %{_libdir}/mozilla/plugins

%description plugin
This plugin lets your webbrowser play multimedia content through
HelixPlayer


%prep
%setup -q -n hxplay-%{version}
%patch0 -p1 -b cvs-no-update
%patch1 -p1 -b .disable-asm
%patch2 -p1 -b .nptl
%patch3 -p1 -b .missing-header
%patch4 -p0 -b .ogg
%patch5 -p1 -b .CVE-2007-3410

%build
# Change hxplay_gtk_release to whatever string is in the Makefile
BUILDRC=%{SOURCE1} BUILD_ROOT="`pwd`/build" \
	PATH="$PATH:$$BUILD_ROOT/bin" \
	python build/bin/build -v -t release -k -y \
	%{?_smp_mflags} -m hxplay_gtk_release \
	-p green -P helix-client-all-defines-free \
	player_all 

chmod -x build/*.txt

%install
rm -rf %{buildroot}
mkdir -p $RPM_BUILD_ROOT%{_bindir}

cat > $RPM_BUILD_ROOT%{_bindir}/hxplay <<EOF
#!/bin/sh
HELIX_LIBS=%{_libdir}/helix
export HELIX_LIBS
exec %{_bindir}/hxplay.bin "\$@"
EOF

install -p -m 755 release/hxplay.bin %{buildroot}/%{_bindir}/
chmod a+x %{buildroot}/%{_bindir}/*

mkdir -p %{buildroot}/%{_libdir}/helix/common
install -p -m 755 player/installer/archive/temp/common/*.so %{buildroot}/%{_libdir}/helix/common/
mkdir -p %{buildroot}/%{_libdir}/helix/plugins
install -p -m 755 player/installer/archive/temp/plugins/*.so %{buildroot}/%{_libdir}/helix/plugins/

mkdir -p %{buildroot}/%{_libdir}/helix
install -p -m 644 player/installer/archive/temp/LICENSE %{buildroot}/%{_libdir}/helix/
install -p -m 644 player/installer/archive/temp/README %{buildroot}/%{_libdir}/helix/
(cd %{buildroot}/%{_docdir}/%{name}-%{version} && ln -s %{_libdir/helix} .)

mkdir -p %{buildroot}/%{_libdir}/helix/codecs
install -p -m 755 player/installer/archive/temp/codecs/*.so %{buildroot}/%{_libdir}/helix/codecs/
mkdir -p %{buildroot}/%{_libdir}/mozilla/plugins
install -p -m 755 player/installer/archive/temp/mozilla/nphelix.so %{buildroot}/%{_libdir}/mozilla/plugins/
install -p -m 644 player/installer/archive/temp/mozilla/nphelix.xpt %{buildroot}/%{_libdir}/mozilla/plugins
mkdir -p %{buildroot}/%{_datadir}/application-registry/
install -p -m 644 player/installer/common/hxplay.applications %{buildroot}/%{_datadir}/application-registry/
# Desktop file
mkdir -p %{buildroot}/%{_datadir}/applications/
cp -p player/installer/common/hxplay.desktop player/installer/common/realplay.desktop
desktop-file-install  --vendor vine \
        --dir %{buildroot}%{_datadir}/applications \
        --add-category X-Fedora \
        player/installer/common/realplay.desktop

mkdir -p %{buildroot}/%{_datadir}/mime-info/
install -p -m 644 player/installer/common/hxplay.keys %{buildroot}/%{_datadir}/mime-info/
install -p -m 644 player/installer/common/hxplay.mime %{buildroot}/%{_datadir}/mime-info/

mkdir -p %{buildroot}/%{_libdir}/helix/share/hxplay
(cd %{buildroot}/%{_libdir}/helix/share/ && ln -s %{_datadir}/icons/hicolor/48x48/apps/hxplay.png .)
install -p -m 644 player/app/gtk/res/default/*.png %{buildroot}/%{_libdir}/helix/share/hxplay/
install -p -m 644 player/app/gtk/res/hxplay/*.png %{buildroot}/%{_libdir}/helix/share/hxplay/

for LANGUAGE in "de" "es" "fr" "it" "ja" "ko" "pt_BR" "zh_CN" "zh_TW"; do
	dir=%{buildroot}/%{_datadir}/locale/$LANGUAGE/LC_MESSAGES/
	mkdir -p $dir
	install -p -m 644 "player/installer/archive/temp/share/locale/$LANGUAGE/player.mo" "$dir/hxplay.mo"
	install -p -m 644 "player/installer/archive/temp/share/locale/$LANGUAGE/widget.mo" "$dir/libgtkhx.mo"
done

for SIZE in "16x16" "32x32" "48x48" "128x128" "192x192" ; do
	mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/$SIZE
	mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/$SIZE/apps
	mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/$SIZE/mimetypes

	ICON=player/app/gtk/res/icons/hxplay/hxplay_${SIZE}.png
	if [ -f "$ICON" ] ; then
		mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/${SIZE}/apps
		install -p -m 644 "$ICON" %{buildroot}/%{_datadir}/icons/hicolor/${SIZE}/apps/hxplay.png
	fi

	for MIME in \
		"application-ram"     \
		"application-rpm"     \
		"application-rm"      \
		"audio-ra"            \
		"video-rv" ; do

		ICON=player/app/gtk/res/icons/hxplay/mime-${MIME}_${SIZE}.png
		if [ -f "$ICON" ] ; then
			mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/${SIZE}/mimetypes
			install -p -m 644 "$ICON" %{buildroot}/%{_datadir}/icons/hicolor/${SIZE}/mimetypes/hxplay-${MIME}.png
		fi
	done
done

# Hack to get rid of executable stack on shared object files
execstack -c %{buildroot}/%{_libdir}/helix/codecs/colorcvt.so
execstack -c %{buildroot}/%{_libdir}/helix/codecs/cvt1.so
execstack -c %{buildroot}/%{_libdir}/helix/plugins/vidsite.so


chmod -x %{buildroot}/%{_datadir}/application-registry/hxplay.applications
chmod -x %{buildroot}/%{_datadir}/mime-info/hxplay.mime
chmod -x %{buildroot}/%{_libdir}/helix/LICENSE
chmod -x %{buildroot}/%{_datadir}/mime-info/hxplay.keys

%{find_lang} hxplay
%{find_lang} libgtkhx
cat hxplay.lang > %{name}.lang
cat libgtkhx.lang >> %{name}.lang

%clean
rm -rf $RPM_BUILD_ROOT

%post
update-desktop-database %{_datadir}/applications
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :

%postun
update-desktop-database %{_datadir}/applications
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :

%files -f %{name}.lang
%defattr(-,root,root)
%doc build/*.txt
%{_bindir}/hxplay*
%{_libdir}/helix
#{_libdir}/mozilla/plugins/*
%{_datadir}/icons/hicolor/*
%{_datadir}/mime-info/*
%{_datadir}/applications/*.desktop
%{_datadir}/application-registry/hxplay.applications
#{_datadir}/locale/*/*

%files plugin
%defattr(-,root,root)
%{_libdir}/mozilla/plugins/*


%changelog
* Fri Aug 17 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.7-6vl1
- new upstream release
  * Thu Jun 28 2007 Aurelien Bompard <abompard@fedoraproject.org> 1:1.0.7-6
  - fix bug 245838 (CVE-2007-3410)
  * Fri Dec 08 2006 Aurelien Bompard <abompard@fedoraproject.org> 1:1.0.7-5
  - add patch to make ogg/vorbis work (bug 218896)
  * Thu Sep 28 2006 Aurelien Bompard <abompard@fedoraproject.org> 1:1.0.7-4
  - fixes from bug 201006 comment 20
  * Thu Sep 28 2006 Aurelien Bompard <abompard@fedoraproject.org> 1:1.0.7-3
  - split the webbrowser plugin
  * Tue Sep 19 2006 Aurelien Bompard <abompard@fedoraproject.org> 1:1.0.7-2
  - added fixes from bug 201006 comment 2

* Tue Nov  8 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.6-1vl1
- new upstream release
  * Tue Sep 27 2005 John (J5) Palmieri <johnp@redhat.com> - 1:1.0.6-1
  - Fix for CAN-2005-2710
  * Fri Jun 24 2005 Colin Walters <walters@redhat.com> 1:1.0.5-1
  - New patch HelixPlayer-1.0.5-missing-header.patch

* Sun Jun  5 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.4-4vl1
- new upstream release
  * Thu Mar 3 2005 Ray Strode <rstrode@redhat.com> 1:1.0.3-4
  - Update to 1.0.3 to fix 150098 and 150103.
  - Add some execshield foo to stop some execstack regressions
  - Add libogg-devel build req to tame compiler
  * Wed Jan 24 2005 Colin Walters <walters@redhat.com> 1:1.0.2-3
  - Remove EULA from License field (there is no EULA AFAICS), and
    add GPL
  * Wed Jan 05 2005 Colin Walters <walters@redhat.com> 1:1.0.2-2
  - Apply patch from ville.skytta@iki.fi to avoid
    owning /usr/lib/mozilla (144237)
  * Mon Jan 03 2005 Colin Walters <walters@redhat.com> 1:1.0.2-1
  - New upstream version 1.0.2
  - Switch to hxplay_gtk_stable branch

* Sat Oct 16 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.1-1vl1
- new upstream release
- Drop upstreamed HelixPlayer-1.0.beta20040615-mmx-clobber.patch
- Drop HelixPlayer-1.0.beta20040615-desktop.patch per request
- Switch to bingo-gold target
- added Japanese summary and description

* Thu Sep  9 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.0.298-3vl2
- fixed %files section (Thanks to IWAI Masaharu)
- added GPL and RPSL files into %doc

* Sun Sep  5 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.0.298-3vl1
- Build for Vine
- changed version numberring

* Mon Aug 23 2004 Colin Walters <walters@redhat.com> 1.0.gold-3
- Install README and LICENSE

* Fri Aug 06 2004 Colin Walters <walters@redhat.com> 1.0.gold-2
- Put mozilla plugins in correct directory (#129305)

* Mon Aug 02 2004 Colin Walters <walters@redhat.com> 1.0.gold-1
- Update to gold
- Use setup -n to set directory instead of repacking tarball
- Switch bif target to bingo-gold-free

* Thu Jul 29 2004 Colin Walters <walters@redhat.com> 1.0.beta20040615-6
- Rework Summary a bit
- Minor spec cleanups

* Mon Jul 26 2004 Colin Walters <walters@redhat.com> 1.0.beta20040615-5
- Add patch to port to GtkFileChooser
- ExcludeArch ppc

* Fri Jul 16 2004 Colin Walters <walters@redhat.com> 1.0.beta20040615-4
- Restore MIME icon installation into hicolor directory 

* Fri Jul 16 2004 Colin Walters <walters@redhat.com> 1.0.beta20040615-3
- Add patch to fix desktop file name
- Set build failure color to "green" to exit on any error
- Add smp_mflags variable for parallel building

* Thu Jul 15 2004 Colin Walters <walters@redhat.com> 1.0.beta20040615-2
- BR latest theora
- More spec file bits
- Install logo for real

* Mon Jul 12 2004 Colin Walters <walters@redhat.com> 1.0.beta20040615-1
- Some spec file cleanups

* Mon Jun 8 2004 Ryan Gammon <rgammon@real.com>
- Adding /usr/share/pixmap, document icons

* Mon Jun 7 2004 Nicholas Hart <nhart@real.com>
- added .mime/.keys/.applications files

* Wed May 5 2004 Ryan Gammon <rggammon@helixcommunity.org>
- Updating icons

* Thu Jan 13 2004  Nicholas Hart <nhart@helixcommunity.org>
- tweaked some paths to deal with tarball generated by player/installer/app
- changed, reformatted some of the package info

* Sat Dec 27 2003 Thomas Chung <tchung@linuxinstall.org> 0.2.0.0-20031224
- First RPM build for Fedora Core 1
