Difference between revisions of "Mythplugins-svn-rpmbuild.spec"

From MythTV Official Wiki
Jump to: navigation, search
(updated to match the changes in Mythtv-svn-rpmbuild.spec)
Line 1: Line 1:
 +
This spec is for building MythPlugin RPM packages from a subversion checkout.
 +
 +
It works with both modular (FC5 and later) and non-modular versions of X.
 +
Please read the documentation at the top of the file before using it.
 +
 
<pre>
 
<pre>
 
#
 
#
# Specfile for MythPlugins
+
# Specfile for building MythPlugins RPM's from a subversion checkout.
 +
#
 +
# by:  Chris Petersen <rpm@forevermore.net>
 +
#
 +
#  Modified/Extended from the great (non-svn based) work of:
 +
#    David Bussenschutt <buzz@oska.com>
 +
#    Axel Thimm <Axel.Thimm@ATrpms.net>
 +
#    and others; see changelog at bottom for details.
 +
#
 +
# The latest version of this file can be found at:
 +
#
 +
#    http://www.mythtv.org/wiki/index.php/Mythplugins-svn-rpmbuild.spec
 +
#
 +
# Note:
 +
#
 +
#    This spec relies upon several files included in the ATRPMS mythplugins
 +
#    src.rpm file.  Please install it into your build tree before trying to
 +
#    build anything with this spec.
 +
#
 +
# Explanation of options:
 +
#
 +
# --with(out) modular_x    Override the default detection code for modular X.org
 +
#
 +
# # All plugins get built by default, but you can disable them as you wish:
 +
#
 +
# --without mythbrowser
 +
# --without mythcontrols
 +
# --without mythdvd
 +
# --without mythflix
 +
# --without mythgallery
 +
# --without mythgame
 +
# --without mythmusic
 +
# --without mythnews
 +
# --without mythphone
 +
# --without mythvideo
 +
# --without mythweather
 +
#
 +
# The following options are disabled by default.  Use these options to enable:
 +
#
 +
# --with festival          Enable festival/festvox support in MythPhone
 +
# --with aac                Enable AAC support in MythMusic
 +
# --with transcode          Enable transcode support in MythVideo
 +
# --with vcd                Enable VideoCD support in MythVideo
 +
#
 +
# The following options are enabled by default.  Use these options to disable:
 +
#
 +
# --without opengl          Disable OpenGL support in MythMusic and MythGallery
 +
# --without exif            Disable EXIF support in MythGallery
 +
# --without fftw            Disable FFTW support in MythMusic
 +
# --without sdl            Disable SDL support in MythMusic
 +
#
 +
 
 +
# Edit the following path to point to where you keep your SVN checkout.  Among
 +
# others, it will contain both the mythtv/ and mythplugins/ subdirectories.
 +
%define _svn_root '/usr/src/mythtv-svn/'
 +
 
 +
################################################################################
 +
# The only thing below here that you should feel the need to edit is the
 +
# Version tag, which should be set to the *next* MythTV release.
 +
################################################################################
 +
 
 +
# Are we running modular Xorg?  Default is to auto-detect FC5 or later, but you
 +
# can also specify --with modular_x or --without modular_x to override.
 +
%define _modular_x %(if [ "%{?_with_modular_x}" ]; then echo 1; elif [ "%{?_without_modular_x}" ]; then echo 0; elif [ `rpm -q --queryformat='%{VERSION}' fedora-release` -ge 5 ]; then echo 1; else echo 0; fi)
 +
 
 +
# This script verifies that there is a mythtv SVN checkout at %{_svn_root} and
 +
# if there isn't one, performs an anonymous checkout.  If the checkout already
 +
# exists, it grabs the latest update.  The return value is the current SVN
 +
# revision or a blank string (which will be checked below for errors).
 +
%define _svn_rev %( if [ ! -d '%{_svn_root}/.svn' ] ; then REL=`svn co http://svn.mythtv.org/svn/trunk/ '%{_svn_root}'` ; else REL=`svn update '%{_svn_root}'`; fi; if [ $? != 0 ]; then echo '' ; else echo "$REL" | grep revision | sed -e 's/[^0-9]\\+//g'; fi )
 +
 
 +
#
 +
# Basic descriptive tags for this package:
 
#
 
#
 +
Name:          mythplugins
 +
Version:        0.20
 +
Release:        0.%{_svn_rev}.svn
 +
Summary:        Main plugins to accompany the MythTV DVR.
 +
 +
URL:            http://www.mythtv.org/
 +
License:        GPL
 +
Group:          Applications/Multimedia
  
 
# The following options are enabled by default.  Use --without to disable them
 
# The following options are enabled by default.  Use --without to disable them
Line 36: Line 121:
 
%define with_transcode      %{?_with_transcode:      1} %{!?_with_transcode:      0}
 
%define with_transcode      %{?_with_transcode:      1} %{!?_with_transcode:      0}
 
%define with_vcd            %{?_with_vcd:            1} %{!?_with_vcd:            0}
 
%define with_vcd            %{?_with_vcd:            1} %{!?_with_vcd:            0}
 +
 +
################################################################################
  
 
# This directory isn't defined in rpm's own macro library
 
# This directory isn't defined in rpm's own macro library
 
%define _varlibdir    %{_localstatedir}/lib
 
%define _varlibdir    %{_localstatedir}/lib
  
# where is the SVN repository kept?
+
################################################################################
%define _mythsvnroot    '/root/myth-svn'
 
  
# get initial SVN Revision from the repository....
+
Source0:        http://www.mythtv.org/mc/%{name}-%{version}.tar.bz2
%define _svn_rev %(svn info %{_mythsvnroot}/%{name} | grep Revision | cut --delimiter=: -f 2 | tr -d ' ' )
 
 
 
#
 
# Below, you'll find the basic configuration for this package
 
#
 
Name:          mythplugins
 
Version:        0.19
 
Release:        0.%{_svn_rev}.svn
 
Summary:        Main plugins to accompany the MythTV DVR.
 
 
 
URL:            http://www.mythtv.org/
 
#License:        GPL2 - bad according to rpmlint
 
License:        GPL
 
Group:          Applications/Multimedia
 
 
 
Source0:        http://www.mythtv.org/mc/%{name}-%{version}.%{_svn_rev}.tar.bz2
 
  
 
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
# we leave _builddir to default to /usr/src/redhat/BUILD or wherever user wants.
 
# %define _builddir /usr/src/redhat/BUILD
 
 
# dont change here, we assume /usr, as BUILD_ROOT overrides at 'make install' time
 
#%define _prefix /usr
 
  
 
################################################################################
 
################################################################################
Line 73: Line 137:
 
# Global build requirements
 
# Global build requirements
 
BuildRequires:  gcc-c++
 
BuildRequires:  gcc-c++
 +
BuildRequires:  qt-devel >= 3
 +
 +
# Yeah. we do need subversion, don't we...
 +
BuildRequires:  subversion
 +
 +
# The modular version of Xorg requires a different set of build packages
 +
%if %{_modular_x}
 +
BuildRequires:  mesa-libGLU-devel
 +
BuildRequires:  libXv-devel
 +
BuildRequires:  libXxf86vm-devel
 +
BuildRequires:  libXmu-devel
 +
%else
 
BuildRequires:  XFree86-devel
 
BuildRequires:  XFree86-devel
BuildRequires:  qt-devel >= 3
+
%endif
  
 
%if %{with_opengl}
 
%if %{with_opengl}
Line 123: Line 199:
 
BuildRequires:  cdparanoia-devel
 
BuildRequires:  cdparanoia-devel
 
BuildRequires:  lame-devel
 
BuildRequires:  lame-devel
BuildRequires:  XFree86-devel
 
 
%endif
 
%endif
 
%if %{with_fftw}
 
%if %{with_fftw}
Line 316: Line 391:
  
 
%prep
 
%prep
echo SVN REVISION: %{_svn_rev} in folder: %{_mythsvnroot}/%{name}
 
if [ ! -f '%{_mythsvnroot}/%{name}/README' ] ; then
 
  # dont have SVN yet? get it!
 
  cd %{_mythsvnroot}
 
  svn co http://cvs.mythtv.org/svn/trunk/%{name}
 
else
 
  # got SVN already? update it!
 
  cd %{_mythsvnroot}/%{name}
 
  svn update .
 
fi
 
  
# re-determine SVN version, and see if it's changed since we started..
+
# If there was a problem getting the svn revision, we need to alert the user.
# changed slightly, so that rpmbuild doesn't cache the old _svn_rev
+
%if !%{_svn_rev}
SVNNEW=`svn info %{_mythsvnroot}/%{name} | grep Revision | cut --delimiter=: -f 2 | tr -d ' '`
+
    echo -e "\n\nThere was a problem determing the current SVN revision."  \
echo NEW SVN REVISION: $SVNNEW
+
            "\nAny subversion errors should be listed a few lines above"    \
 
+
            "\nthis error message. Please resolve them and try again.\n\n"
# abort if SVN revision has changed since we started this specfile...
+
    exit 1
if %{_svn_rev} != $SVNNEW ] ; then
+
%endif
echo SVN revision changed from %{_svn_rev} to $SVNNEW. Please re-run rpmbuild now...
 
false
 
fi
 
 
 
cd -
 
 
 
# finally, sync SVN to the rpm build directory...
 
rsync --cvs-exclude -rav %{_mythsvnroot}/%{name}/* %{_builddir}/%{name}-%{version}/
 
touch %{_sourcedir}/%{name}-%{version}.%{_svn_rev}.tar.bz2
 
 
 
echo Release is: %{release}
 
 
 
# '-n mythtv' would mean source goes to 'mythtv' not %{name}-%{version} (ie  mythtv-0.19)
 
%setup -q -n %{name}-%{version} -D -T
 
  
#where are we? we be here:
+
# Since we'll be copying the files from the repository checkout instead of
cd %{_builddir}/%{name}-%{version}
+
# extracting a tarball (-T), we only need to create the target directory (-c).
 +
%setup -q -T -c
  
 +
# Copy the checkout to the rpm build directory.
 +
    rsync -a --cvs-exclude              \
 +
          %{_svn_root}/%{name}/*        \
 +
          %{_builddir}/%{name}-%{version}/
  
 
# Replace static lib paths with %{_lib} so we build properly on x86_64
 
# Replace static lib paths with %{_lib} so we build properly on x86_64
 
# systems, where the libs are actually in lib64.
 
# systems, where the libs are actually in lib64.
if [ "%{_lib}" != "lib" ]; then
+
    if [ "%{_lib}" != "lib" ]; then
  grep -rl /lib/ . | xargs perl -pi -e's,/lib/,/%{_lib}/,g'
+
        grep -rl '"lib"' . | xargs sed -i -e 's,/lib/,/%{_lib}/,g'
  grep -rl /lib$ . | xargs perl -pi -e's,/lib$,/%{_lib},'
+
        grep -rl /lib/   . | xargs sed -i -e 's,/lib/,/%{_lib}/,g'
  grep -rl '/lib ' . | xargs perl -pi -e's,/lib ,/%{_lib} ,g'
+
        grep -rl /lib$   . | xargs sed -i -e 's,/lib$,/%{_lib},'
fi
+
        grep -rl '/lib ' . | xargs sed -i -e 's,/lib ,/%{_lib} ,g'
 +
    fi
  
 
# MythMusic fix:  /mnt/store -> /var/lib/mythmusic
 
# MythMusic fix:  /mnt/store -> /var/lib/mythmusic
Line 483: Line 540:
 
     OPTS="$OPTS --disable-vcd"
 
     OPTS="$OPTS --disable-vcd"
 
%endif
 
%endif
 
#only way to guarantee prefix is kept correct at present:
 
#make distclean
 
touch Makefile ; find . -name Makefile | head -1 | xargs rm
 
  
 
# Configure
 
# Configure
./configure --prefix=%{_prefix} $OPTS
+
./configure \
 +
    --prefix=%{_prefix}           \
 +
    --libdir-name=%{_lib}          \
 +
    --libdir=%{_libdir}            \
 +
    --mandir=%{_mandir}            \
 +
    $OPTS
  
 
# Make
 
# Make
Line 528: Line 586:
  
 
################################################################################
 
################################################################################
 +
 
%clean
 
%clean
 
rm -rf %{buildroot}
 
rm -rf %{buildroot}
 +
 +
################################################################################
  
 
%files
 
%files
Line 722: Line 783:
 
%{_datadir}/mythtv/mythvideo/scripts/imdb.pl
 
%{_datadir}/mythtv/mythvideo/scripts/imdb.pl
 
%{_datadir}/mythtv/mythvideo/scripts/allocine.pl
 
%{_datadir}/mythtv/mythvideo/scripts/allocine.pl
 +
%{_datadir}/mythtv/mythvideo/scripts/ofdb.pl
 
%{_varlibdir}/mythvideo
 
%{_varlibdir}/mythvideo
  
Line 754: Line 816:
 
%endif
 
%endif
 
################################################################################
 
################################################################################
 
  
 
%changelog
 
%changelog
* Tue Jan 03 2006 David Bussenschutt <buzz@oska.com> %{version}-%{release}
+
* Sat Apr 01 2006 Chris Petersen <rpm@forevermore.net>
- Converted/Modified Chris' July 19 2005 spec to fully automate build of SVN for nightly snapshots.
+
- Enhance SVN support so that the build doesn't fail if there were updated files in the repository.
- resolved svn chicken-and-egg 'what version is this specfile?' question, by aborting on svn revision change
+
- Add detection for modular X.org so we don't need two spec files.
- ran results through rpmlint and fixed other minor errors (minor install perms)
+
- Add documentation at the top of the file for the --with and --without options.
- made all package,description,files keywords use -n syntax for clarity
 
  
 
* Sun Nov 27 2005 Martin Ebourne <martin@zepler.org>
 
* Sun Nov 27 2005 Martin Ebourne <martin@zepler.org>
Line 791: Line 851:
 
* Thu Apr 14 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
 
* Thu Apr 14 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
 
- Merging plugins into one build (matching the new source layout).
 
- Merging plugins into one build (matching the new source layout).
 
 
</pre>
 
</pre>

Revision as of 00:42, 2 April 2006

This spec is for building MythPlugin RPM packages from a subversion checkout.

It works with both modular (FC5 and later) and non-modular versions of X. Please read the documentation at the top of the file before using it.

#
# Specfile for building MythPlugins RPM's from a subversion checkout.
#
# by:   Chris Petersen <rpm@forevermore.net>
#
#  Modified/Extended from the great (non-svn based) work of:
#     David Bussenschutt <buzz@oska.com>
#     Axel Thimm <Axel.Thimm@ATrpms.net>
#     and others; see changelog at bottom for details.
#
# The latest version of this file can be found at:
#
#     http://www.mythtv.org/wiki/index.php/Mythplugins-svn-rpmbuild.spec
#
# Note:
#
#     This spec relies upon several files included in the ATRPMS mythplugins
#     src.rpm file.  Please install it into your build tree before trying to
#     build anything with this spec.
#
# Explanation of options:
#
# --with(out) modular_x     Override the default detection code for modular X.org
#
# # All plugins get built by default, but you can disable them as you wish:
#
# --without mythbrowser
# --without mythcontrols
# --without mythdvd
# --without mythflix
# --without mythgallery
# --without mythgame
# --without mythmusic
# --without mythnews
# --without mythphone
# --without mythvideo
# --without mythweather
#
# The following options are disabled by default.  Use these options to enable:
#
# --with festival           Enable festival/festvox support in MythPhone
# --with aac                Enable AAC support in MythMusic
# --with transcode          Enable transcode support in MythVideo
# --with vcd                Enable VideoCD support in MythVideo
#
# The following options are enabled by default.  Use these options to disable:
#
# --without opengl          Disable OpenGL support in MythMusic and MythGallery
# --without exif            Disable EXIF support in MythGallery
# --without fftw            Disable FFTW support in MythMusic
# --without sdl             Disable SDL support in MythMusic
#

# Edit the following path to point to where you keep your SVN checkout.  Among
# others, it will contain both the mythtv/ and mythplugins/ subdirectories.
%define _svn_root '/usr/src/mythtv-svn/'

################################################################################
# The only thing below here that you should feel the need to edit is the
# Version tag, which should be set to the *next* MythTV release.
################################################################################

# Are we running modular Xorg?  Default is to auto-detect FC5 or later, but you
# can also specify --with modular_x or --without modular_x to override.
%define _modular_x %(if [ "%{?_with_modular_x}" ]; then echo 1; elif [ "%{?_without_modular_x}" ]; then echo 0; elif [ `rpm -q --queryformat='%{VERSION}' fedora-release` -ge 5 ]; then echo 1; else echo 0; fi)

# This script verifies that there is a mythtv SVN checkout at %{_svn_root} and
# if there isn't one, performs an anonymous checkout.  If the checkout already
# exists, it grabs the latest update.  The return value is the current SVN
# revision or a blank string (which will be checked below for errors).
%define _svn_rev %( if [ ! -d '%{_svn_root}/.svn' ] ; then REL=`svn co http://svn.mythtv.org/svn/trunk/ '%{_svn_root}'` ; else REL=`svn update '%{_svn_root}'`; fi; if [ $? != 0 ]; then echo '' ; else echo "$REL" | grep revision | sed -e 's/[^0-9]\\+//g'; fi )

#
# Basic descriptive tags for this package:
#
Name:           mythplugins
Version:        0.20
Release:        0.%{_svn_rev}.svn
Summary:        Main plugins to accompany the MythTV DVR.

URL:            http://www.mythtv.org/
License:        GPL
Group:          Applications/Multimedia

# The following options are enabled by default.  Use --without to disable them
# OpenGL for MythMusic and MythGallery
%define with_opengl        %{?_without_opengl:  0} %{!?_without_opengl:  1}

# All plugins get built by default, but you can disable them as you wish
%define with_mythbrowser    %{?_without_mythbrowser:  0} %{!?_without_mythbrowser:  1}
%define with_mythcontrols   %{?_without_mythcontrols: 0} %{!?_without_mythcontrols: 1}
%define with_mythdvd        %{?_without_mythdvd:      0} %{!?_without_mythdvd:      1}
%define with_mythflix       %{?_without_mythflix:     0} %{!?_without_mythflix:     1}
%define with_mythgallery    %{?_without_mythgallery:  0} %{!?_without_mythgallery:  1}
%define with_mythgame       %{?_without_mythgame:     0} %{!?_without_mythgame:     1}
%define with_mythmusic      %{?_without_mythmusic:    0} %{!?_without_mythmusic:    1}
%define with_mythnews       %{?_without_mythnews:     0} %{!?_without_mythnews:     1}
%define with_mythphone      %{?_without_mythphone:    0} %{!?_without_mythphone:    1}
%define with_mythvideo      %{?_without_mythvideo:    0} %{!?_without_mythvideo:    1}
%define with_mythweather    %{?_without_mythweather:  0} %{!?_without_mythweather:  1}

# MythGallery
%define with_exif           %{?_without_exif:         0} %{!?_without_exif:         1}
# MythMusic
%define with_fftw           %{?_without_fftw:         0} %{!?_without_fftw:         1}
%define with_sdl            %{?_without_sdl:          0} %{!?_without_sdl:          1}

# The following options are disabled by default.  Use --with to enable them

# MythPhone
%define with_festival       %{?_with_festival:        1} %{!?_with_festival:        0}
# MythMusic
%define with_aac            %{?_with_aac:             1} %{!?_with_aac:             0}
# MythVideo
%define with_transcode      %{?_with_transcode:       1} %{!?_with_transcode:       0}
%define with_vcd            %{?_with_vcd:             1} %{!?_with_vcd:             0}

################################################################################

# This directory isn't defined in rpm's own macro library
%define _varlibdir     %{_localstatedir}/lib

################################################################################

Source0:        http://www.mythtv.org/mc/%{name}-%{version}.tar.bz2

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

################################################################################

# Global build requirements
BuildRequires:  gcc-c++
BuildRequires:  qt-devel >= 3

# Yeah. we do need subversion, don't we...
BuildRequires:  subversion

# The modular version of Xorg requires a different set of build packages
%if %{_modular_x}
BuildRequires:  mesa-libGLU-devel
BuildRequires:  libXv-devel
BuildRequires:  libXxf86vm-devel
BuildRequires:  libXmu-devel
%else
BuildRequires:  XFree86-devel
%endif

%if %{with_opengl}
BuildRequires:  /usr/include/GL/gl.h
%endif

%if %{with_mythbrowser}
Requires:       mythbrowser      >= %{version}
BuildRequires:  libmyth-devel    >= %{version}
BuildRequires:  kdelibs-devel
%endif

%if %{with_mythdvd}
Requires:       mythdvd          >= %{version}
BuildRequires:  libdvdread-devel >= 0.9.4
# nasm >= 0.98.36
BuildRequires:  nasm
BuildRequires:  mjpegtools-devel >= 1.6.1
BuildRequires:  xvidcore-devel   >= 0.9.1
BuildRequires:  a52dec-devel
BuildRequires:  libfame-devel    >= 0.9.0
BuildRequires:  libdvdcss-devel  >= 1.2.7
# For <= RH8.0
BuildRequires:  freetype-devel
%endif
%if %{with_transcode}
BuildRequires:  transcode        >= 0.6.8
%endif

%if %{with_mythgallery}
Requires:       mythgallery      >= %{version}
BuildRequires:  libtiff-devel
BuildRequires:  libexif-devel
%endif

%if %{with_mythgame}
Requires:       mythgame         >= %{version}
BuildRequires:  zlib-devel
%endif

%if %{with_mythmusic}
Requires:       mythmusic     >= %{version}
BuildRequires:  libmad-devel
BuildRequires:  libid3tag-devel
BuildRequires:  libvorbis-devel >= 1.0
BuildRequires:  flac-devel >= 1.0.4
BuildRequires:  libcdaudio-devel >= 0.99.6
BuildRequires:  cdparanoia-devel
BuildRequires:  lame-devel
%endif
%if %{with_fftw}
BuildRequires:  fftw2-devel >= 2.1.3
BuildRequires:  fftw2-devel < 3
%endif
%if %{with_sdl}
BuildRequires:  SDL-devel
%endif
%if %{with_aac}
# This REQUIRES the atrpms version because others are missing mp4ff_int_types.h
BuildRequires:  faad2-devel
%endif

%if %{with_mythnews}
Requires:       mythnews         >= %{version}
%endif

%if %{with_mythphone}
Requires:       mythphone        >= %{version}
BuildRequires:  libmyth-devel    >= %{version}
BuildRequires:  libtermcap-devel
%endif
%if %{with_festival}
BuildRequires:  festival-devel
%endif

%if %{with_mythvideo}
Requires:       mythvideo        >= %{version}
Requires:       perl-XML-Simple
%endif

%if %{with_mythweather}
Requires:       mythweather      >= %{version}
%endif

%description
This is a consolidation of all the official MythTV plugins that used to be
distributed as separate downloads from mythtv.org.

################################################################################
%if %{with_mythbrowser}

%package -n mythbrowser
Summary:    A small web browser module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythbrowser
MythBrowser is a full fledged web-browser (multiple tabs) to display
webpages in full-screen mode. Simple page navigation is
possible. Starting with version 0.13 it also has full support for
mouse driven navigation (right mouse opens and clos es the popup
menu).

MythBrowser also contains a BookmarkManager to manage the website
links in a simple mythplugin.

%endif
################################################################################
%if %{with_mythcontrols}

%package -n mythcontrols
Summary:    A key control editor plugin for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythcontrols
A key control editor plugin for MythTV.

%endif
################################################################################
%if %{with_mythdvd}

%package -n mythdvd
Summary:    A DVD player module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')
Requires:   transcode >= 0.6.8

%description -n mythdvd
MythDVD is a MythTV module that allows you to play DVD's on a myth-box
and (optionally) rip DVD's and transcode their video and audio content
to other (generally smaller) formats. The playing features are simply
myth-style wrappers for your favourite DVD playing software (mplayer,
ogle, xine, etc). The transcoding is based on and derived from the
excellent transcode package.

%endif
################################################################################
%if %{with_mythflix}

%package -n mythflix
Summary:    A Netflix module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythflix
MyhtFlix is a MythTV plugin for adding movies to your Netflix queue. It
currently supports the ablity to view your queue and add movies to your queue.

%endif
################################################################################
%if %{with_mythgallery}

%package -n mythgallery
Summary:    A gallery/slideshow module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythgallery
A gallery/slideshow module for MythTV.

%endif
################################################################################
%if %{with_mythgame}

%package -n mythgame
Summary:    A game frontend (xmame, nes, snes, pc) for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythgame
A game frontend (xmame, nes, snes, pc) for MythTV.

%endif
################################################################################
%if %{with_mythmusic}

%package -n mythmusic
Summary:    The music player add-on module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythmusic
Music add-on for mythtv.

%endif
################################################################################
%if %{with_mythnews}

%package -n mythnews
Summary:    An RSS news feed plugin for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythnews
An RSS news feed plugin for MythTV.

%endif
################################################################################
%if %{with_mythphone}

%package -n mythphone
Summary:    A video conferencing module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythphone
Mythphone is a phone and videophone capability on MYTH using the
standard SIP protocol.  It is compatible with Microsoft XP Messenger
and with SIP Service Providers such as Free World Dialup
(fwd.pulver.com).

%endif
################################################################################
%if %{with_mythvideo}

%package -n mythvideo
Summary:    A generic video player frontend module for MythTV.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')
Requires:   mplayer

%description -n mythvideo
A generic video player frontend module for MythTV.

%endif
################################################################################
%if %{with_mythweather}

%package -n mythweather
Summary:    A MythTV module that displays a weather forcast.
Group:      Applications/Multimedia
Requires:   mythtv-frontend-api = %(echo %{version} | awk -F. '{print $1 "." $2}')

%description -n mythweather
A MythTV module that displays a weather forcast.

%endif
################################################################################

%prep

# If there was a problem getting the svn revision, we need to alert the user.
%if !%{_svn_rev}
    echo -e "\n\nThere was a problem determing the current SVN revision."   \
            "\nAny subversion errors should be listed a few lines above"    \
            "\nthis error message.  Please resolve them and try again.\n\n"
    exit 1
%endif

# Since we'll be copying the files from the repository checkout instead of
# extracting a tarball (-T), we only need to create the target directory (-c).
%setup -q -T -c

# Copy the checkout to the rpm build directory.
    rsync -a --cvs-exclude               \
          %{_svn_root}/%{name}/*         \
          %{_builddir}/%{name}-%{version}/

# Replace static lib paths with %{_lib} so we build properly on x86_64
# systems, where the libs are actually in lib64.
    if [ "%{_lib}" != "lib" ]; then
        grep -rl '"lib"' . | xargs sed -i -e 's,/lib/,/%{_lib}/,g'
        grep -rl /lib/   . | xargs sed -i -e 's,/lib/,/%{_lib}/,g'
        grep -rl /lib$   . | xargs sed -i -e 's,/lib$,/%{_lib},'
        grep -rl '/lib ' . | xargs sed -i -e 's,/lib ,/%{_lib} ,g'
    fi

# MythMusic fix:  /mnt/store -> /var/lib/mythmusic
%if %{with_mythmusic}
sed -i -e 's#/mnt/store/music#%{_varlibdir}/mythmusic#' mythmusic/mythmusic/globalsettings.cpp
%endif

# MythVideo fix:  /mnt/store -> /var/lib/mythvideo
%if %{with_mythvideo}
sed -i -e 's#/share/Movies/dvd#%{_varlibdir}/mythvideo#' mythvideo/mythvideo/globalsettings.cpp
%endif

# Add some include paths
#cat >> settings.pro << EOF
#INCLUDEPATH += %{_includedir}/mythtv
#INCLUDEPATH += %{_includedir}/speech_tools
#EOF

#%if %{with_festival}
#cat >> settings.pro << EOF
#INCLUDEPATH += %{_includedir}/festival
#EOF
#%endif

# Prevent all of those nasty installs to ../../../../../bin/whatever
echo "QMAKE_PROJECT_DEPTH = 0" >> mythtv.pro
echo "QMAKE_PROJECT_DEPTH = 0" >> settings.pro

################################################################################

%build
# Need to set $QTDIR?
[ -n "$QTDIR" ] || . %{_sysconfdir}/profile.d/qt.sh

# Initialize the options string
OPTS=""

# Enable OpenGL (for MythMusic and MythGallery)
%if %{with_opengl}
    OPTS="$OPTS --enable-opengl"
%else
    OPTS="$OPTS --disable-opengl"
%endif

# Disable any of the plugins?
%if !%{with_mythmusic}
    OPTS="$OPTS --disable-mythmusic"
%endif
%if !%{with_mythbrowser}
    OPTS="$OPTS --disable-mythbrowser"
%endif
%if !%{with_mythcontrols}
    OPTS="$OPTS --disable-mythcontrols"
%endif
%if !%{with_mythdvd}
    OPTS="$OPTS --disable-mythdvd"
%endif
%if !%{with_mythflix}
    OPTS="$OPTS --disable-mythflix"
%endif
%if !%{with_mythgallery}
    OPTS="$OPTS --disable-mythgallery"
%endif
%if !%{with_mythgame}
    OPTS="$OPTS --disable-mythgame"
%endif
%if !%{with_mythmusic}
    OPTS="$OPTS --disable-mythmusic"
%endif
%if !%{with_mythnews}
    OPTS="$OPTS --disable-mythnews"
%endif
%if !%{with_mythphone}
    OPTS="$OPTS --disable-mythphone"
%endif
%if !%{with_mythvideo}
    OPTS="$OPTS --disable-mythvideo"
%endif
%if !%{with_mythweather}
    OPTS="$OPTS --disable-mythweather"
%endif

# MythGallery options
%if %{with_exif}
    OPTS="$OPTS --enable-exif"
%else
    OPTS="$OPTS --disable-exif"
%endif

# MythMusic options
%if %{with_aac}
    OPTS="$OPTS --enable-aac"
%else
    OPTS="$OPTS --disable-aac"
%endif
%if %{with_fftw}
    OPTS="$OPTS --enable-fftw"
%else
    OPTS="$OPTS --disable-fftw"
%endif
%if %{with_sdl}
    OPTS="$OPTS --enable-sdl"
%else
    OPTS="$OPTS --disable-sdl"
%endif

# MythPhone options
%if %{with_festival}
    OPTS="$OPTS --enable-festival"
%else
    OPTS="$OPTS --disable-festival"
%endif

# MythVideo options
%if %{with_transcode}
    OPTS="$OPTS --enable-transcode"
%else
    OPTS="$OPTS --disable-transcode"
%endif
%if %{with_vcd}
    OPTS="$OPTS --enable-vcd"
%else
    OPTS="$OPTS --disable-vcd"
%endif

# Configure
./configure \
    --prefix=%{_prefix}            \
    --libdir-name=%{_lib}          \
    --libdir=%{_libdir}            \
    --mandir=%{_mandir}            \
    $OPTS

# Make
#qmake mythplugins.pro
make

################################################################################

%install
rm -rf %{buildroot}
make install INSTALL_ROOT=%{buildroot}

# Create some directories that are specific to the rpm installation

%if %{with_mythgallery}
mkdir -p %{buildroot}%{_varlibdir}/pictures
%endif

%if %{with_mythgame}
mkdir -p %{buildroot}%{_datadir}/mythtv/games/nes/{roms,screens}
mkdir -p %{buildroot}%{_datadir}/mythtv/games/snes/{roms,screens}
mkdir -p %{buildroot}%{_datadir}/mythtv/games/PC/screens
mkdir -p %{buildroot}%{_datadir}/xmame
ln -s %{_datadir}/xmame %{buildroot}%{_datadir}/mythtv/games/xmame
mkdir -p %{buildroot}%{_datadir}/xmame/flyers
ln -s snap %{buildroot}%{_datadir}/xmame/screens

cp -a mythgame/gamelist.xml %{buildroot}%{_datadir}/mythtv/games/PC/
%endif

%if %{with_mythmusic}
mkdir -p %{buildroot}%{_varlibdir}/mythmusic
%endif

%if %{with_mythvideo}
mkdir -p %{buildroot}%{_varlibdir}/mythvideo
%endif

################################################################################

%clean
rm -rf %{buildroot}

################################################################################

%files
%defattr(-,root,root,-)
%doc COPYING

################################################################################
%if %{with_mythbrowser}

%files -n mythbrowser
%defattr(-,root,root,-)
%doc mythbrowser/README mythbrowser/COPYING mythbrowser/AUTHORS
%{_bindir}/mythbrowser
%{_libdir}/mythtv/plugins/libmythbookmarkmanager.so
%{_datadir}/mythtv/themes/default/webpage.png
%{_datadir}/mythtv/i18n/mythbrowser_*.qm

%endif
################################################################################
%if %{with_mythcontrols}

%files -n mythcontrols
%defattr(-,root,root,-)
%doc mythcontrols/AUTHORS mythcontrols/TODO mythcontrols/COPYING mythcontrols/README
%{_datadir}/mythtv/i18n/mythcontrols_*.qm
%{_libdir}/mythtv/plugins/libmythcontrols.so
%{_datadir}/mythtv/themes/default/controls-ui.xml
%{_datadir}/mythtv/themes/default/kb-button-off.png
%{_datadir}/mythtv/themes/default/kb-button-on.png

%endif
################################################################################
%if %{with_mythdvd}

%files -n mythdvd
%defattr(-,root,root,-)
%doc mythdvd/README mythdvd/UPGRADING mythdvd/COPYING mythdvd/AUTHORS
%{_libdir}/mythtv/plugins/libmythdvd.so
%{_datadir}/mythtv/dvd_settings.xml
%{_datadir}/mythtv/dvdmenu.xml
%{_datadir}/mythtv/themes/default/dvd-ui.xml
%{_datadir}/mythtv/themes/default/md_*.png
%{_datadir}/mythtv/i18n/mythdvd_*.qm
%{_bindir}/mtd

%endif
################################################################################
%if %{with_mythflix}

%files -n mythflix
%defattr(-,root,root,-)
%doc mythflix/README mythflix/COPYING
%{_libdir}/mythtv/plugins/libmythflix.so
%{_datadir}/mythtv/mythflix/netflix-rss.xml
%{_datadir}/mythtv/mythflix/scripts/netflix.pl
%{_datadir}/mythtv/netflix_menu.xml
%{_datadir}/mythtv/themes/default/netflix-ui.xml
%{_datadir}/mythtv/themes/default/title_netflix.png
%{_datadir}/mythtv/i18n/mythflix_*.qm

%endif
################################################################################
%if %{with_mythgallery}

%files -n mythgallery
%defattr(-,root,root,-)
%doc mythgallery/README mythgallery/UPGRADING mythgallery/COPYING
%{_libdir}/mythtv/plugins/libmythgallery.so
%{_datadir}/mythtv/themes/default/gallery-ui.xml
%{_datadir}/mythtv/themes/default/gallery-*.png
%{_datadir}/mythtv/i18n/mythgallery_*.qm
%{_varlibdir}/pictures

%endif
################################################################################
%if %{with_mythgame}

%files -n mythgame
%defattr(-,root,root,-)
%doc mythgame/README mythgame/UPGRADING
%{_libdir}/mythtv/plugins/libmythgame.so
%{_datadir}/mythtv/games
%config %{_datadir}/mythtv/games/PC/gamelist.xml
%{_datadir}/xmame/screens
%{_datadir}/xmame/flyers
%{_datadir}/mythtv/game_settings.xml
%{_datadir}/mythtv/themes/default/game-ui.xml
%{_datadir}/mythtv/i18n/mythgame_*.qm

%endif
################################################################################
%if %{with_mythmusic}

%files -n mythmusic
%defattr(-,root,root,-)
%doc mythmusic/README mythmusic/UPGRADING mythmusic/COPYING mythmusic/AUTHORS mythmusic/musicdb
%{_libdir}/mythtv/plugins/libmythmusic.so
%{_varlibdir}/mythmusic
%{_datadir}/mythtv/musicmenu.xml
%{_datadir}/mythtv/music_settings.xml
%{_datadir}/mythtv/i18n/mythmusic_*.qm
%{_datadir}/mythtv/themes/default/ff_button_off.png
%{_datadir}/mythtv/themes/default/ff_button_on.png
%{_datadir}/mythtv/themes/default/ff_button_pushed.png
%{_datadir}/mythtv/themes/default/mm_blackhole_border.png
%{_datadir}/mythtv/themes/default/mm_blankbutton_off.png
%{_datadir}/mythtv/themes/default/mm_blankbutton_on.png
%{_datadir}/mythtv/themes/default/mm_blankbutton_pushed.png
%{_datadir}/mythtv/themes/default/mm_checked.png
%{_datadir}/mythtv/themes/default/mm_checked_high.png
%{_datadir}/mythtv/themes/default/mm_down_arrow.png
%{_datadir}/mythtv/themes/default/mm_left_arrow.png
%{_datadir}/mythtv/themes/default/mm_leftright_off.png
%{_datadir}/mythtv/themes/default/mm_leftright_on.png
%{_datadir}/mythtv/themes/default/mm_leftright_pushed.png
%{_datadir}/mythtv/themes/default/mm_rating.png
%{_datadir}/mythtv/themes/default/mm_right_arrow.png
%{_datadir}/mythtv/themes/default/mm_unchecked.png
%{_datadir}/mythtv/themes/default/mm_unchecked_high.png
%{_datadir}/mythtv/themes/default/mm_up_arrow.png
%{_datadir}/mythtv/themes/default/mm_volume_background.png
%{_datadir}/mythtv/themes/default/mm_volume_tick.png
%{_datadir}/mythtv/themes/default/mm_waiting.png
%{_datadir}/mythtv/themes/default/music-sel-bg.png
%{_datadir}/mythtv/themes/default/music-ui.xml
%{_datadir}/mythtv/themes/default/next_button_off.png
%{_datadir}/mythtv/themes/default/next_button_on.png
%{_datadir}/mythtv/themes/default/next_button_pushed.png
%{_datadir}/mythtv/themes/default/pause_button_off.png
%{_datadir}/mythtv/themes/default/pause_button_on.png
%{_datadir}/mythtv/themes/default/pause_button_pushed.png
%{_datadir}/mythtv/themes/default/play_button_off.png
%{_datadir}/mythtv/themes/default/play_button_on.png
%{_datadir}/mythtv/themes/default/play_button_pushed.png
%{_datadir}/mythtv/themes/default/prev_button_off.png
%{_datadir}/mythtv/themes/default/prev_button_on.png
%{_datadir}/mythtv/themes/default/prev_button_pushed.png
%{_datadir}/mythtv/themes/default/rew_button_off.png
%{_datadir}/mythtv/themes/default/rew_button_on.png
%{_datadir}/mythtv/themes/default/rew_button_pushed.png
%{_datadir}/mythtv/themes/default/selectionbar.png
%{_datadir}/mythtv/themes/default/stop_button_off.png
%{_datadir}/mythtv/themes/default/stop_button_on.png
%{_datadir}/mythtv/themes/default/stop_button_pushed.png
%{_datadir}/mythtv/themes/default/text_button_off.png
%{_datadir}/mythtv/themes/default/text_button_on.png
%{_datadir}/mythtv/themes/default/text_button_pushed.png
%{_datadir}/mythtv/themes/default/track_info_background.png

%endif
################################################################################
%if %{with_mythnews}

%files -n mythnews
%defattr(-,root,root,-)
%doc mythnews/README mythnews/AUTHORS mythnews/COPYING
%{_libdir}/mythtv/plugins/libmythnews.so
%{_datadir}/mythtv/mythnews
%{_datadir}/mythtv/themes/default/news-ui.xml
%{_datadir}/mythtv/themes/default/news-info-bg.png
%{_datadir}/mythtv/i18n/mythnews_*.qm

%endif
################################################################################
%if %{with_mythphone}

%files -n mythphone
%defattr(-,root,root,-)
%doc mythphone/README mythphone/COPYING mythphone/AUTHORS mythphone/TODO
%{_libdir}/mythtv/plugins/libmythphone.so
%{_datadir}/mythtv/themes/default/phone-ui.xml
%{_datadir}/mythtv/themes/default/webcam-ui.xml
%{_datadir}/mythtv/themes/default/mp_*.png
%{_datadir}/mythtv/themes/default/phone.png
%{_datadir}/mythtv/i18n/mythphone_*.qm

%endif
################################################################################
%if %{with_mythvideo}

%files -n mythvideo
%defattr(-,root,root,-)
%doc mythvideo/README mythvideo/UPGRADING mythvideo/COPYING mythvideo/videodb
%{_libdir}/mythtv/plugins/libmythvideo.so
%{_datadir}/mythtv/i18n/mythvideo_*.qm
%{_datadir}/mythtv/themes/default/video-ui.xml
%{_datadir}/mythtv/themes/default/mv-*.png
%{_datadir}/mythtv/themes/default/mv_*.png
%{_datadir}/mythtv/video_settings.xml
%{_datadir}/mythtv/videomenu.xml
%{_datadir}/mythtv/mythvideo/scripts/README
%{_datadir}/mythtv/mythvideo/scripts/imdb.pl
%{_datadir}/mythtv/mythvideo/scripts/allocine.pl
%{_datadir}/mythtv/mythvideo/scripts/ofdb.pl
%{_varlibdir}/mythvideo

%endif
################################################################################
%if %{with_mythweather}

%files -n mythweather
%defattr(-,root,root,-)
%doc mythweather/README mythweather/COPYING
%{_libdir}/mythtv/plugins/libmythweather.so
%{_datadir}/mythtv/i18n/mythweather_*.qm
%{_datadir}/mythtv/mythweather
%{_datadir}/mythtv/themes/default/weather-ui.xml
%{_datadir}/mythtv/themes/default/cloudy.png
%{_datadir}/mythtv/themes/default/fair.png
%{_datadir}/mythtv/themes/default/flurries.png
%{_datadir}/mythtv/themes/default/fog.png
%{_datadir}/mythtv/themes/default/logo.png
%{_datadir}/mythtv/themes/default/lshowers.png
%{_datadir}/mythtv/themes/default/mcloudy.png
%{_datadir}/mythtv/themes/default/mw-*.png
%{_datadir}/mythtv/themes/default/mwmain.png
%{_datadir}/mythtv/themes/default/pcloudy.png
%{_datadir}/mythtv/themes/default/rainsnow.png
%{_datadir}/mythtv/themes/default/showers.png
%{_datadir}/mythtv/themes/default/snowshow.png
%{_datadir}/mythtv/themes/default/sunny.png
%{_datadir}/mythtv/themes/default/thunshowers.png
%{_datadir}/mythtv/themes/default/unknown.png

%endif
################################################################################

%changelog
* Sat Apr 01 2006 Chris Petersen <rpm@forevermore.net>
- Enhance SVN support so that the build doesn't fail if there were updated files in the repository.
- Add detection for modular X.org so we don't need two spec files.
- Add documentation at the top of the file for the --with and --without options.

* Sun Nov 27 2005 Martin Ebourne <martin@zepler.org>
- Added MythFlix

* Fri Jul 22 2005 Chris Petersen <rpm@forevermore.net>
- Add mythcontrols
- General cleanup and adding of conditionals

* Sat Jul 16 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Reenable mythplugins.

* Tue Jun  7 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Disable transcode for now until transcode catches up with ffmpeg
  and libquicktime.

* Tue May 17 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to 0.18.1.

* Thu May 12 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update the cvs fixes.

* Thu Apr 21 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Add cvsfixes for 0.18.

* Fri Apr 15 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to 0.18.

* Thu Apr 14 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Merging plugins into one build (matching the new source layout).