From 5ff48a8230ba7546790ce46b84a5f4304fccd874 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 5 Mar 2008 00:00:03 +0000 Subject: [PATCH] - Update to 2.23.0, rework the -gstreamer/-xine backend split to switch libraries instead of having replacements for all the binaries --- totem-bin-backend-ondemand.sh | 100 +++++++++++++++----------- totem.spec | 129 +++++++++++----------------------- 2 files changed, 99 insertions(+), 130 deletions(-) diff --git a/totem-bin-backend-ondemand.sh b/totem-bin-backend-ondemand.sh index 5080758..5a434b5 100644 --- a/totem-bin-backend-ondemand.sh +++ b/totem-bin-backend-ondemand.sh @@ -1,51 +1,67 @@ #!/bin/sh -# setup some variables -BIN=totem -ARCH="$(uname -m)" - -if [ "$ARCH" == "x86_64" ];then - _LIBDIR="/usr/lib64" -elif [ "$ARCH" == "ppc64" ];then - _LIBDIR="/usr/lib64" -else - _LIBDIR="/usr/lib" -fi - # start functions -setBackend() { -TOTEM_BACKEND=$1 -# Default to GStreamer if there's no config -if [ -z $TOTEM_BACKEND ] ; then - TOTEM_BACKEND=gstreamer -fi -# Default to GStreamer if the backend is invalid -if [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then - TOTEM_BACKEND=gstreamer -fi +usage() { + echo "Usage:" + echo "- As root, to set the default backend, system-wide:" + echo " $0 -b " + echo + echo "- As a normal user, to run a program with a specific backend:" + echo " $0 -b [program options...]" + echo + echo "- \"backend name\" is one of gstreamer or xine" + echo "- \"program name\" is one of totem, totem-audio-preview," + echo " totem-video-indexer or totem-video-thumbnailer" + echo + exit 1 +} - if [ "$UID" -eq "0" ];then - ln -sf totem-plugin-viewer-$TOTEM_BACKEND /usr/libexec/totem-plugin-viewer - ln -sf ../../libtotem-properties-page-$TOTEM_BACKEND.so ${_LIBDIR}/nautilus/extensions-2.0/libtotem-properties-page.so - fi - gconftool-2 -s /apps/totem/backend $TOTEM_BACKEND --type string - exit 0 +set_backend() { + TOTEM_BACKEND=$1 + # Default to GStreamer if there's no config + if [ -z $TOTEM_BACKEND ] ; then + echo "*** No backend name passed ***" + usage + fi + # Default to GStreamer if the backend is invalid + if [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then + echo "*** Invalid backend name ***" + usage + fi + + # FIXME if someone can explain update-alternatives to me + + exit 0 } # end functions -# start execution -if [ "$1" == "-b" ];then - # if we are setting backend, do so and exit - setBackend $2 -elif [ -z $TOTEM_BACKEND ] ; then - # Default to GStreamer if there's no config - TOTEM_BACKEND=gstreamer -elif [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then - # Default to GStreamer if the backend is invalid - TOTEM_BACKEND=gstreamer +# If root, just try to set the default backend +if [ "$UID" -eq "0" ] ; then + if [ "$1" != "-b" -o -z "$2" ] ; then + usage; + fi + set_backend $2 +else + if [ "$1" != "-b" -o -z "$2" ] ; then + usage; + fi + TOTEM_BACKEND=$2 + + if [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then + echo "*** Invalid backend name passed ***" + usage + fi + + BIN=$3 + if [ -z "$BIN" ] ; then + echo "*** No program name passed ***" + usage + fi + if [ $BIN != "totem" -a $BIN != "totem-audio-preview" -a $BIN != "totem-video-indexer" -a $BIN != "totem-video-thumbnailer" ] ; then + echo "*** Wrong program name ***" + usage + fi + shift 3 + LD_PRELOAD=libgdk-x11-2.0.so.0:libbaconvideowidget-$TOTEM_BACKEND.so.0.0.0 exec $BIN "$@" fi -# if no opts are passed, do this -TOTEM_BACKEND="$(gconftool-2 -g /apps/totem/backend)" -exec $BIN-$TOTEM_BACKEND "$@" -exit $? diff --git a/totem.spec b/totem.spec index 5765ef4..58ff25f 100644 --- a/totem.spec +++ b/totem.spec @@ -1,4 +1,3 @@ -%define with_gstreamer 1 %define with_xine 1 %define gstreamer_version 0.10.1 @@ -10,7 +9,7 @@ Summary: Movie player for GNOME Name: totem -Version: 2.21.96 +Version: 2.23.0 Release: 1%{?dist} License: GPLv2 with exception Group: Applications/Multimedia @@ -73,7 +72,6 @@ Totem is simple movie player for the Gnome desktop. It features a simple playlist, a full-screen mode, seek and volume controls, as well as a pretty complete keyboard navigation. -%if %{with_gstreamer} %package gstreamer Summary: Gstreamer backend for Totem Group: Applications/Multimedia @@ -88,7 +86,6 @@ BuildRequires: gstreamer-plugins-good >= %gstreamer_plugins_good_version %description gstreamer This package provides the gstreamer backend for the Totem media player. -%endif %if %{with_xine} %package xine @@ -98,7 +95,6 @@ Provides: %{name}-backend Requires: %{name} = %{version} Requires: xine-lib >= %{xine_version} BuildRequires: xine-lib-devel >= %{xine_version} -Obsoletes: totem-xine-plparser <= %{version}-%{release} %description xine This package provides the xine backend for the Totem media player. @@ -171,29 +167,14 @@ Requires: %{name} = %{version}-%{release} A plugin to allow you to share your current playlist (and the files included in that playlist) with other Totems on the same local network. -%if %{with_gstreamer} -%package nautilus-gstreamer +%package nautilus Summary: Video and Audio Properties tab for Nautilus Group: Applications/Multimedia Requires: %{name} = %{version}-%{release} -%description nautilus-gstreamer -A Nautilus extension that shows the properties of audio and video files in -the properties dialogue. This package provides the plugin linked against the -gstreamer backend. -%endif - -%if %{with_xine} -%package nautilus-xine -Summary: Video and Audio Properties tab for Nautilus -Group: Applications/Multimedia -Requires: %{name} = %{version}-%{release} - -%description nautilus-xine -A Nautilus extension that shows the properties of audio and video files in -the properties dialogue. This package provides the plugin linked against the -xine backend. -%endif +%description nautilus +A Nautilus extension that shows the properties of audio and video files in• +the properties dialogue. %prep %setup -q -c @@ -217,7 +198,6 @@ mv totem-%{version} gstreamer %build -%if %{with_gstreamer} pushd gstreamer # try to work around a problem where gst-inspect does # not find playbin the first time around @@ -228,28 +208,24 @@ export MOZILLA_PLUGINDIR=%{_libdir}/mozilla/plugins --enable-mozilla \ --enable-nautilus \ --disable-scrollkeeper \ - --disable-nvtv \ - --program-suffix '-gstreamer' + --disable-nvtv make %{?_smp_mflags} popd -%endif %if %{with_xine} +# Build the xine-lib backend with minimum dependencies pushd xine -# works around a bug where xine compilation fails due to gnome-keyring.h not -# being found ** this seems to be fixed now ** -#export CFLAGS="-I/usr/include/gnome-keyring-1/" export MOZILLA_PLUGINDIR=%{_libdir}/mozilla/plugins %configure \ --enable-xine \ --disable-gstreamer \ - --enable-mozilla \ - --enable-nautilus \ + --disable-mozilla \ + --disable-nautilus \ --disable-scrollkeeper \ - --disable-nvtv \ - --program-suffix '-xine' + --disable-nvtv +cd src/backend/ make %{?_smp_mflags} popd %endif @@ -258,53 +234,35 @@ popd rm -rf $RPM_BUILD_ROOT export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 -%if %{with_gstreamer} # GSTREAMER INSTALL pushd gstreamer/ make install DESTDIR=$RPM_BUILD_ROOT +# move the backend library away +mv $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget.so.0.0.0 $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0 # language hack %find_lang %{name} --with-gnome mv %{name}.lang ../ -# nautilus plugin doesn't use --program-suffix: copy manually -install -m755 ./src/.libs/libtotem-properties-page.so $RPM_BUILD_ROOT%{_libdir}/libtotem-properties-page-gstreamer.so popd -%endif %if %{with_xine} # XINE INSTALL -pushd xine +pushd xine/src/backend make install DESTDIR=$RPM_BUILD_ROOT -# nautilus plugin doesn't use --program-suffix :/ -# copy manually -install -m755 ./src/.libs/libtotem-properties-page.so $RPM_BUILD_ROOT%{_libdir}/libtotem-properties-page-xine.so +mv $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget.so.0.0.0 $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget-xine.so.0.0.0 popd %endif +# Restore the default backend +ln -sf %{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0 $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget.so.0.0.0 + rm -f $RPM_BUILD_ROOT%{_libdir}/totem/plugins/*/*.{a,la} \ $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/*.{a,la} \ - $RPM_BUILD_ROOT%{_libdir}/nautilus/extensions-2.0/*.{a,la} - -# nautilus plugin doesn't use --program-suffix :/ -# remove binary file so we can symlink it -rm -f $RPM_BUILD_ROOT%{_libdir}/nautilus/extensions-2.0/libtotem-properties-page.so -mkdir -p $RPM_BUILD_ROOT%{_libdir}/nautilus/extensions-2.0/ -ln -sf ../../libtotem-properties-page-gstreamer.so $RPM_BUILD_ROOT%{_libdir}/nautilus/extensions-2.0/libtotem-properties-page.so + $RPM_BUILD_ROOT%{_libdir}/nautilus/extensions-2.0/*.{a,la} \ + $RPM_BUILD_ROOT%{_libdir}/libbaconvideowidget*.{a,la} %find_lang %{name} --with-gnome -# these man pages are one and the same... so make one copy -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/%{name}*xine* -mv $RPM_BUILD_ROOT%{_mandir}/man1/%{name}-gstreamer.1 \ - $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1 -mv $RPM_BUILD_ROOT%{_mandir}/man1/totem-video-thumbnailer-gstreamer.1 \ - $RPM_BUILD_ROOT%{_mandir}/man1/totem-video-thumbnailer.1 - -install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/%{name} -# link other binaries -ln -sf %{name} $RPM_BUILD_ROOT%{_bindir}/%{name}-video-thumbnailer -ln -sf %{name} $RPM_BUILD_ROOT%{_bindir}/%{name}-video-indexer -ln -sf %{name} $RPM_BUILD_ROOT%{_bindir}/%{name}-audio-preview -ln -sf %{name}-plugin-viewer-gstreamer $RPM_BUILD_ROOT%{_libexecdir}/%{name}-plugin-viewer +install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/%{name}-backend %clean rm -rf $RPM_BUILD_ROOT @@ -323,6 +281,10 @@ if [ -x /usr/bin/gtk-update-icon-cache ]; then /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor fi +%post gstreamer -p /sbin/ldconfig + +%post xine -p /sbin/ldconfig + %pre if [ "$1" -gt 1 ]; then export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` @@ -332,7 +294,7 @@ if [ "$1" -gt 1 ]; then %{_sysconfdir}/gconf/schemas/totem-video-thumbnail.schemas \ >& /dev/null || : fi - + %preun if [ "$1" -eq 0 ]; then export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` @@ -352,6 +314,10 @@ if [ -x /usr/bin/gtk-update-icon-cache ]; then /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor fi +%postun gstreamer -p /sbin/ldconfig + +%postun xine -p /sbin/ldconfig + %post mythtv export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-install-rule \ @@ -385,6 +351,7 @@ fi %config %{_sysconfdir}/gconf/schemas/totem-handlers.schemas %config %{_sysconfdir}/gconf/schemas/totem-video-thumbnail.schemas %{_bindir}/%{name} +%{_bindir}/%{name}-backend %{_bindir}/%{name}-video-thumbnailer %{_bindir}/%{name}-video-indexer %{_bindir}/%{name}-audio-preview @@ -392,6 +359,8 @@ fi %{_datadir}/%{name}/ %{_libdir}/nautilus/extensions-2.0/*.so* %dir %{_libexecdir}/totem +%{_libexecdir}/totem/totem-bugreport.py* +%{_libdir}/libbaconvideowidget.so* %dir %{_libdir}/totem/plugins %{_libdir}/totem/plugins/gromit %{_libdir}/totem/plugins/ontop @@ -437,37 +406,21 @@ fi %defattr(-, root, root) %{_libdir}/totem/plugins/publish -%if %{with_gstreamer} %files gstreamer -%{_bindir}/%{name}-gstreamer -%{_bindir}/%{name}-video-thumbnailer-gstreamer -%{_bindir}/%{name}-video-indexer-gstreamer -%{_bindir}/%{name}-audio-preview-gstreamer -%{_libexecdir}/totem-plugin-viewer-gstreamer -%{_libexecdir}/totem/*gstreamer* - -%files nautilus-gstreamer -%defattr(-, root, root) -# installed to libdir so we can symlink the real spot -%{_libdir}/libtotem*gstreamer*.so* -%endif +%{_libdir}/libbaconvideowidget.so.0.0.0 +%{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0 %if %{with_xine} %files xine -%{_bindir}/%{name}-xine -%{_bindir}/%{name}-video-thumbnailer-xine -%{_bindir}/%{name}-video-indexer-xine -%{_bindir}/%{name}-audio-preview-xine -%{_libexecdir}/totem-plugin-viewer-xine -%{_libexecdir}/totem/*xine* - -%files nautilus-xine -%defattr(-, root, root) -# installed to libdir so we can symlink the real spot -%{_libdir}/libtotem*xine*.so* +%{_libdir}/libbaconvideowidget-xine.so.0.0.0 %endif %changelog +* Tue Mar 04 2008 - Bastien Nocera - 2.23.0-1 +- Update to 2.23.0, rework the -gstreamer/-xine backend split to + switch libraries instead of having replacements for all the + binaries + * Mon Mar 03 2008 - Bastien Nocera - 2.21.96-1 - Update to 2.21.96 - Add ppc and ppc64 to ExcludeArch as liboil is crashing on us (#435771)