%define 	srcdir 		RealPlayer-8.0-1
#%define 	debug_package 	%{nil}

Summary: 	Real Player (R) 8.0
Name: 		realplayer
Version: 	8.0.3.421
Release: 	0.fdr.1
Epoch:		0
License: 	Commercial
ExclusiveArch: 	i386 
Group: 		Applications/Multimedia
Source0: 	rp8_linux20_libc6_i386_cs2_rpm
Source1: 	rv9_libc6_i386_cs2.tgz
Source2: 	realplayer.desktop
Source3:	realplayer.png
Url: 		http://forms.real.com/real/player/unix/unix.html
BuildRoot: 	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:	fedora-rpmdevtools
Requires: 	XFree86

%description
Real Player (R) 8.0.

%package 	plugin
Summary: 	Real Player (R) plugin for Mozilla/Konqueror/Opera.
Requires: 	%{name} = %{epoch}:%{version}-%{release}
Group: 		Applications/Networking

%description plugin
Real Player (R) plugin for Mozilla/Konqueror/Opera.

%prep
%setup -cT
/usr/bin/fedora-unrpm %{SOURCE0} &> /dev/null || :
tar xf %{SOURCE1}

%build
# Empty build section

%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_bindir} \
	$RPM_BUILD_ROOT%{_libdir}/%{name} \
	$RPM_BUILD_ROOT%{_libdir}/mozilla/plugins \
	$RPM_BUILD_ROOT%{_datadir}/applications \
	$RPM_BUILD_ROOT%{_datadir}/pixmaps

# The guts. HTML documentations goes here, since
# it's hard linked in the About menu entry. 
cp -a 	%{srcdir}%{_libdir}/RealPlayer8/Codecs \
	%{srcdir}%{_libdir}/RealPlayer8/Common \
	%{srcdir}%{_libdir}/RealPlayer8/Help \
	%{srcdir}%{_libdir}/RealPlayer8/Plugins \
	%{srcdir}%{_libdir}/RealPlayer8/*.rm \
	$RPM_BUILD_ROOT%{_libdir}/%{name}

# Fix permissions
find $RPM_BUILD_ROOT%{_libdir}/%{name} -type f -exec chmod 644 {} \;
find $RPM_BUILD_ROOT%{_libdir}/%{name} -type d -exec chmod 755 {} \;
find $RPM_BUILD_ROOT%{_libdir}/%{name} -name "*.so.*" -exec chmod 755 {} \;

# RV9 codecs
install -m755 rv9/codecs/drv4.so.6.0 rv9/codecs/rv40.so.6.0 \
	$RPM_BUILD_ROOT%{_libdir}/%{name}/Codecs

# Install binary in lib dir 
install -m755 %{srcdir}%{_bindir}/X11/realplay \
	$RPM_BUILD_ROOT%{_libdir}/%{name}/realplay.bin  

# Startup script with NTPL workaround
echo "#!/bin/sh" >> realplay 
echo "export LD_ASSUME_KERNEL=2.2.5" >> realplay 
echo "%{_libdir}/%{name}/realplay.bin \$* &" >> realplay 
install -m755 realplay $RPM_BUILD_ROOT%{_bindir}

# RPM installation marker
touch $RPM_BUILD_ROOT%{_libdir}/%{name}/rpminstalled

# Browser plugin
install -m755 %{srcdir}%{_libdir}/netscape/plugins/rpnp.so \
	$RPM_BUILD_ROOT%{_libdir}/mozilla/plugins
install -m644 %{srcdir}%{_libdir}/netscape/plugins/raclass.zip \
	$RPM_BUILD_ROOT%{_libdir}/mozilla/plugins

# Icon
install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/pixmaps

# Desktop file
desktop-file-install --vendor fedora \
        --dir $RPM_BUILD_ROOT/%{_datadir}/applications \
        --add-category X-Fedora \
        --add-category Application \
        --add-category AudioVideo \
        %{SOURCE2}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%doc %{srcdir}%{_libdir}/RealPlayer8/LICENSE 
%doc %{srcdir}%{_libdir}/RealPlayer8/README
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*
%{_bindir}/*
%{_datadir}/applications/*
%{_datadir}/pixmaps/*

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

%changelog
* Fri May 30 2003 Peter Backlund <peter.backlund@home.se>
- Initial packaging.
