%define _mozillapath	%{_libdir}/mozilla/plugins
%define vine31 0

Summary: A generic mozilla plug-in 
Summary: 汎用 mozilla プラグイン
Name: mozplugger
Version: 1.7.3
Release: 0vl2
License: GPL
Group: Applications/Internet
URL:   http://mozplugger.mozdev.org

Source0: http://mozplugger.mozdev.org/files/mozplugger-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: XOrg-devel
Requires:  sox
Requires:  ImageMagick
Requires:  gqview
Requires:  perl
#Requires:  TiMidity++
%if !%{vine31}
Requires:  totem
%endif
Obsoletes: plugger
Provides:  plugger

%description
MozPlugger is a generic Mozilla plug-in that allows the use of standard Linux
programs as plug-ins for media types on the Internet.

%prep
%setup -q -n %{name}-%{version}

%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" XLIBDIR="/usr/X11R6/%{_lib}" linux

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_mozillapath}/plugins \
	$RPM_BUILD_ROOT%{_libdir}/netscape/plugins \
	$RPM_BUILD_ROOT%{_bindir} \
	$RPM_BUILD_ROOT%{_sysconfdir} \
	$RPM_BUILD_ROOT%{_mandir}/man7

install -m 755 mozplugger-helper $RPM_BUILD_ROOT%{_bindir}
install -m 755 mozplugger-controller $RPM_BUILD_ROOT%{_bindir}
install -m 755 mozplugger.so $RPM_BUILD_ROOT%{_mozillapath}
install -m 644 mozpluggerrc $RPM_BUILD_ROOT%{_sysconfdir}/mozpluggerrc
bzip2 -d mozplugger.7.bz2
install -m 644 mozplugger.7 $RPM_BUILD_ROOT%{_mandir}/man7

mkdir -p $RPM_BUILD_ROOT%{_mozillapath}
ln -s %{_mozillapath}/mozplugger.so \
	 $RPM_BUILD_ROOT%{_libdir}/netscape/plugins/mozplugger.so

%clean
rm -rf $RPM_BUILD_ROOT


%triggerin -- acroread-nppdf
[ "$2" -ge 1 ] || exit 0
if [ -r %{_sysconfdir}/mozpluggerrc ]; then
	perl -pi -e 's@^application/pdf:@\#application/pdf:@g' %{_sysconfdir}/mozpluggerrc
	perl -pi -e 's@^application/x-pdf:@\#application/x-pdf:@g' %{_sysconfdir}/mozpluggerrc
	touch %{_mozillapath}/mozplugger.so
fi

%triggerun -- acroread-nppdf
[ "$2" = "0" ] || exit 0
if [ -r %{_sysconfdir}/mozpluggerrc ]; then
        perl -pi -e 's@^\#application/pdf:@application/pdf:@g' %{_sysconfdir}/mozpluggerrc
	perl -pi -e 's@^\#application/x-pdf:@application/x-pdf:@g' %{_sysconfdir}/mozpluggerrc
	touch %{_mozillapath}/mozplugger.so
fi

%triggerpostun -- acroread-nppdf
[ "$2" = "0" ] || exit 0
if [ -r %{_sysconfdir}/mozpluggerrc ]; then
        perl -pi -e 's@^\#application/pdf:@application/pdf:@g' %{_sysconfdir}/mozpluggerrc
	perl -pi -e 's@^\#application/x-pdf:@application/x-pdf:@g' %{_sysconfdir}/mozpluggerrc
	touch %{_mozillapath}/mozplugger.so
fi

%triggerin -- RealPlayer-rpnp
[ "$2" -ge 1 ] || exit 0
if [ -r %{_sysconfdir}/mozpluggerrc ]; then
	perl -pi -e 's@^audio/x-pn-realaudio-plugin:@\#audio/x-pn-realaudio-plugin:@g' %{_sysconfdir}/mozpluggerrc
	touch %{_mozillapath}/mozplugger.so
fi

%triggerun -- RealPlayer-rpnp
[ "$2" = "0" ] || exit 0
if [ -r %{_sysconfdir}/mozpluggerrc ]; then
        perl -pi -e 's@^\#audio/x-pn-realaudio-plugin@audio/x-pn-realaudio-plugin:@g' %{_sysconfdir}/mozpluggerrc
	touch %{_mozillapath}/mozplugger.so
fi

%triggerpostun -- RealPlayer-rpnp
[ "$2" = "0" ] || exit 0
if [ -r %{_sysconfdir}/mozpluggerrc ]; then
        perl -pi -e 's@^\#audio/x-pn-realaudio-plugin:@audio/x-pn-realaudio-plugin:@g' %{_sysconfdir}/mozpluggerrc
	touch %{_mozillapath}/mozplugger.so
fi


%files
%defattr(-,root,root)
%doc README COPYING
%config(noreplace) %{_sysconfdir}/mozpluggerrc
%{_bindir}/mozplugger-helper
%{_bindir}/mozplugger-controller
%{_libdir}/netscape/plugins/mozplugger.so
%{_mozillapath}/mozplugger.so
%{_mandir}/man7/*

%changelog
* Sat Jul 22 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.7.3-0vl2
- rebuilt for VineSeed (4.0)
- changed Group to Applications/Internet

* Fri May 12 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7.3-0vl1.1
- rebuild with %%vine31 defined

* Fri May 12 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7.3-0vl1.1
- rebuild with %%vine31 defined

* Thu May 11 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7.3-0vl1
- rebuild for Vine Linux 3.x

* Thu May 11 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7.3-0vl2
- new upstream release

* Wed May 18 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7.2-0vl1
- new upstream source

* Sun Dec 21 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.2-0vl1
- initial build for Vine Linux

* Thu Dec 18 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.4.2-2mdk
- Added Patch0: removed -cache 100 (cause hang with mplayer sometimes), moved
  ooffice before soffice.

* Thu Dec 18 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.4.2-1mdk
- Release 1.4.2.
- Removed Patch0, merged upstream.
- Removed Patch5 (no longer needed).
- Removed Patch3 (lib64), merged upstream.
- Removed Patch4 (amd64), merged upstream.

* Mon Oct 20 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 1.3.0-8mdk
- Really make sure it works on 64-bit platforms.

* Mon Oct 13 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 1.3.0-7mdk
- Really make it work on amd64.

* Mon Oct 13 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 1.3.0-6mdk
- lib64 fixes

* Fri Sep 12 2003 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.3.0-5mdk
- Backported patch from 1.3.2 to fix a regression (so to find the
  the mozplugger helper in ~/.mozilla, ~/.netscape or ~/.opera).

* Tue Sep 02 2003 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.3.0-4mdk
- Avoid "exits" in timidity entry, otherwise MIDI file is played only once.

* Tue Sep 02 2003 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.3.0-3mdk
- Added Requires: TiMidiTy++.
- added text/rtf mime type, and use ooffice also to handle it.

* Sun Aug 31 2003 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.3.0-2mdk
- Backported patches from 1.3.1: removed dead code & fixed problems with
  timidity.
- Use -vo xv,x11.
- Used by default mozplugger for application/pdf mime-type. Enabled 
  triggering for acroread-nppdf, and RealPlayer-rpnp package.

* Mon Jul 07 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.3.0-1mdk
- Release 1.3.0.
- Removed Patch1.
- Default plugin dir to %{_mozillapath}.

* Mon Jun 16 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.2.1-2mdk
- Fixed Patch0 (it wasn't totally merged in upstream!!).

* Mon Jun 16 2003 Per リyvind Karlsen <peroyvind@sintrax.net> 1.2.1-1mdk
- Release 1.2.1
- quiet setup
- dropped P0, merged upstream
- regenerate P1

* Mon May 12 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1.3-1mdk
- Release 1.1.3.

* Tue Feb 18 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1.1-3mdk
- use noisy option for quicktime entry too.

* Tue Feb 18 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1.1-2mdk
- Removed .bmp,.png from mozpluggerrc, because natively supported.
- Use noisy option.

* Mon Feb 17 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1.1-1mdk
- Release: 1.1.1.
- Updated Patch0.
- Removed Patch2, now merged into main.

* Mon Feb 17 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1-3mdk
- Removed preload from ogg entry in mozpluggerrc.
- Updated Patch2.
- Set path of mozilla.

* Sun Feb 16 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1-2mdk
- Updated URL.

* Sun Feb 16 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.1-1mdk
- Release 1.1.

* Sat Feb 15 2003 Giuseppe Ghib<ghibo@mandrakesoft.com> 1.0-1mdk
- Initial release ofn mozplugger 1.0.
- Readatped patches of previous plugger.

* Sat Dec 14 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-8mdk
- added application/x-maplyer2 to /etc/pluggerrc for .wmv files
- added mplayer in Requires:.

* Sat Sep 07 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-7mdk
- added audio/x-realaudio to /etc/pluggerrc.

* Sat Aug 31 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-6mdk
- added missed MPlayer in video/x-mpeg mime item of pluggerrc.

* Fri Aug 30 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-5mdk
- removed audio/x-pn-realaudio-plugin in pluggerrc (let the
  native rpnp.so plugin provide this if needed).
- added in /etc/pluggerrc: application/vnd.rn-realmedia, application/smil,
  audio/vnd.rn-realaudio, audio/x-pn-realaudio, video/vnd.rn-realvideo
  to be used with realplay.

* Wed Aug 28 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-4mdk
- Removed streaming for mtvp (video/x-mpeg) and mpg123 (audio/x-mp3) because
  streaming doesn't work under mozilla.
- Moved mtvp beyond xine and mplayer in video/x-mpeg.
- Let application/pdf, application/x-pdf be used with the acroread plugin
  because it works better than "swallowing".
- Added OpenOffice mime entries in pluggerrc (from RH).
- Added Typo & Description patches from RH.
- Added Patch4 for compiling with gcc 2.96 (but not yet enabled).
- Updated mozilla path.

* Sun Aug 04 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-3mdk
- Fixed path (bug #33) for new mozilla.

* Mon Jan 28 2002 Frederic Crozat <fcrozat@mandrakesoft.com> 4.0-2mdk
- Remove dependency on netscape, since plugger can be user by mozilla
  and its derivate

* Sat Jan 26 2002 Giuseppe Ghib<ghibo@mandrakesoft.com> 4.0-1mdk
- updated to version 4.0.
- updated pluggerrc file.
- removed debug patch (Patch1).
- updated Patch2.
- added Patch3 (-mozilla), merged from RedHat.

* Sat Aug 26 2001 Giuseppe Ghib<ghibo@mandrakesoft.com> 3.3-1mdk
- updated to version 3.3.
- new pluggerrc file.

* Thu Jul 19 2001 Stefan van der Eijk <stefan@eijk.nu> 3.2-8mdk
- BuildRequires:	XFree86-devel
- Copyright --> License

* Wed Mar 14 2001 Giuseppe Ghib<ghibo@mandrakesoft.com> 3.2-7mdk
- removed debug.

* Fri Sep 29 2000 Giuseppe Ghib<ghibo@mandrakesoft.com> 3.2-6mdk
- more macros.
- removed xanim in Requires.

* Tue Aug 29 2000 Giuseppe Ghib<ghibo@mandrakesoft.com> 3.2-5mdk
- use of %%_mandir.

* Sat Apr 22 2000 Giuseppe Ghib<ghibo@mandrakesoft.com> 3.2-4mdk
- changed plugger debug file from /tmp/ndebug to $HOME/tmp/plugger-debug.
  so netscape doesn't crashes if /tmp/ndebug is already existing and
  not writeble (e.g. because owned by a different user).

* Fri Apr 21 2000 Denis Havlik <denis@mandrakesoft.com> 3.2-3mdk
- fixed "Requires:" (netscape-common -> netscape)

* Wed Apr 19 2000 Denis Havlik <denis@mandrakesoft.com> 3.2-2mdk
- spechelper, fixed release, 
- added "Obsoletes: npxanim"
- added "Requires: netscape-common xanim mikmod mpg123 sox ImageMagick"

* Wed Apr 19 2000 Giuseppe Ghib<ghibo@mandrakesoft.com> 3.2-1mdk
- initial build based on RedHat 3.2-2 version
- removed png from pluggerrc (netscape has native support for it).
- fixed group.
- added man page.

* Thu Jan 27 2000 Tim Powers <timp@redhat.com>
- fixed munged group, summary etc.

* Tue Nov 23 1999 Tim Powers <timp@redhat.com>
- updated to 3.2
- quiet scripts
- updated patch

* Sat Aug 21 1999 Bill Nottingham <notting@redhat.com>
- initial build
