File festival.spec of Package festival

#
# spec file for package festival (Version 1.96)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           festival
BuildRequires:  gcc-c++ ncurses-devel pkgconfig
Url:            http://www.cstr.ed.ac.uk/projects/festival/
License:        BSD3c
Group:          Productivity/Text/Convertors
AutoReqProv:    on
Version:        1.96
Release:        128
Summary:        The Festival Speech Synthesis System
Source0:        festival-%{version}-beta.tar.bz2
Source1:        speech_tools-1.2.96-beta.tar.bz2
Source2:        festlex_CMU.tar.bz2
Source3:        festvox_kallpc16k.tar.bz2
Source4:        festlex_POSLEX.tar.bz2
Source5:        sysconfig.festival
Source6:        rcfestival
# festival patches
Patch0:         %{name}-%{version}.patch
Patch1:         festival-1.95-gcc4.patch
Patch2:         festival-1.95-examples.patch
Patch3:         festival-text2wave-manpage.patch
Patch4:         festival-1.95-libdir.patch
Patch7:         festival-1.95-audsp.patch
Patch8:         festival-1.96-chroot.patch
# PATCH-FIX-UPSTREAM festival-no-LD_LIBRARY_PATH-extension.patch bnc#642507 vuntz@opensuse.org -- Do not change LD_LIBRARY_PATH in binaries, to avoid any risks
Patch9:         festival-no-LD_LIBRARY_PATH-extension.patch
# PATCH-FIX-UPSTREAM festival-safe-temp-file.patch bnc#642507 vuntz@opensuse.org -- Create temporary files in a safe way
Patch10:        festival-safe-temp-file.patch
# speech-tools patches
Patch11:        speech_tools-1.2.95-gcc4.patch
Patch12:        speech_tools-1.2.95-config.patch
Patch13:        speech_tools-1.2.95-gcc41.patch
Patch14:        speech_tools-1.2.95-returnvalue.patch
Patch15:        speech_tools-1.2.96-beta.patch
Patch16:        speech_tools-1.2.96-beta-const.patch
# PATCH-FIX-UPSTREAM speech_tools-no-LD_LIBRARY_PATH-extension.patch vuntz@opensuse.org -- Do not change LD_LIBRARY_PATH in binaries, to avoid any risks
Patch17:        speech_tools-no-LD_LIBRARY_PATH-extension.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %fillup_prereq /usr/sbin/useradd /usr/sbin/groupadd

%description
Festival is a multilingual speech synthesis system developed at CSTR.
It offers a full text-to-speech system with various APIs as well as an
environment for development and research of speech synthesis
techniques. It is written in C++ and has a Scheme-based command
interpreter for general control.

%package devel
License:        MIT
Summary:        Development Package for Festival
Group:          Productivity/Text/Convertors
AutoReqProv:    on
Requires:       %name == %version

%description devel
Files needed for developing software that uses Festival.

%prep
%setup -q -b 1 -b 2 -b 3 -b 4 -q -n festival
%patch0
%patch1
%patch2 -p1
%patch3 -p1
%patch4
%patch7
%patch8
%patch9 -p1
%patch10 -p1
cd ../speech_tools
#%patch11 -p1
%patch12
%patch13 -p1
%patch14 -p1
%patch15
%patch16
%patch17 -p1

%build
# festival
./configure --prefix=%_prefix \
	    --libdir=%_libdir \
	    --datadir=%_datadir/festival \
	    --sysconfdir=%_sysconfdir
# speech tools
cd ../speech_tools
./configure --prefix=%_prefix \
            --libdir=%_libdir \
	    --datadir=%_datadir/festival \
            --sysconfdir=%_sysconfdir
make CC="gcc -fPIC $RPM_OPT_FLAGS" CXX="g++ $RPM_OPT_FLAGS -fPIC -Wno-non-template-friend -ffriend-injection -fno-strict-aliasing"
cd ../festival
make CC="gcc -fPIC $RPM_OPT_FLAGS" CXX="g++ $RPM_OPT_FLAGS -fPIC -Wno-non-template-friend -ffriend-injection -fno-strict-aliasing"
make doc

%install
make install DESTDIR=$RPM_BUILD_ROOT
cd ../speech_tools
make install DESTDIR=$RPM_BUILD_ROOT
cd ../festival
# install binarys
install -D bin/text2wave $RPM_BUILD_ROOT%_bindir/text2wave
install -m 755 bin/festival* $RPM_BUILD_ROOT%_bindir/
install -m 755 examples/saytime $RPM_BUILD_ROOT%_bindir/
# install manpages
install -D -m 644 doc/festival.1 $RPM_BUILD_ROOT%_mandir/man1/festival.1
install -m 644 doc/festival_client.1 $RPM_BUILD_ROOT%_mandir/man1/
install -m 644 doc/text2wave.1 $RPM_BUILD_ROOT%_mandir/man1/
# install configs
install -D lib/festival.scm $RPM_BUILD_ROOT%_sysconfdir/festival.scm
# install dictionarys
install -D lib/dicts/cmu/cmudict-0.4.out $RPM_BUILD_ROOT%_datadir/%name/dicts/cmu/cmudict-0.4.out
install -m 644 lib/dicts/cmu/*.scm $RPM_BUILD_ROOT%_datadir/%name/dicts/cmu/
install -m 644 lib/dicts/wsj.wp39.poslexR $RPM_BUILD_ROOT%_datadir/%name/dicts/
install -m 644 lib/dicts/wsj.wp39.tri.ngrambin $RPM_BUILD_ROOT%_datadir/%name/dicts/
# install voices
mkdir -p $RPM_BUILD_ROOT/usr/share/festival/voices/english/kal_diphone/festvox
mkdir -p $RPM_BUILD_ROOT/usr/share/festival/voices/english/kal_diphone/group
cp lib/voices/english/kal_diphone/group/* $RPM_BUILD_ROOT/usr/share/festival/voices/english/kal_diphone/group/
cp lib/voices/english/kal_diphone/festvox/*.scm $RPM_BUILD_ROOT/usr/share/festival/voices/english/kal_diphone/festvox
# install data
cp lib/*.scm $RPM_BUILD_ROOT/usr/share/festival/
cp lib/*.ngrambin $RPM_BUILD_ROOT/usr/share/festival/
cp lib/*.gram $RPM_BUILD_ROOT/usr/share/festival/
cp lib/*.el $RPM_BUILD_ROOT/usr/share/festival/
install -D lib/etc/unknown_Linux/audsp $RPM_BUILD_ROOT/usr/lib/festival/audsp
# install libs
install -D src/lib/libFestival.a  $RPM_BUILD_ROOT/%_libdir/libFestival.a
# install includes
mkdir -p $RPM_BUILD_ROOT%_includedir/
install -m 644 src/include/*.h $RPM_BUILD_ROOT%_includedir/
cd ../speech_tools
# install includes
mkdir -p $RPM_BUILD_ROOT%_includedir/instantiate
mkdir -p $RPM_BUILD_ROOT%_includedir/ling_class
mkdir -p $RPM_BUILD_ROOT%_includedir/rxp
mkdir -p $RPM_BUILD_ROOT%_includedir/sigpr
mkdir -p $RPM_BUILD_ROOT%_includedir/unix
install -m 644 include/*h $RPM_BUILD_ROOT%_includedir
install -m 644 include/instantiate/*h $RPM_BUILD_ROOT%_includedir/instantiate
install -m 644 include/ling_class/*h $RPM_BUILD_ROOT%_includedir/ling_class
install -m 644 include/rxp/*h $RPM_BUILD_ROOT%_includedir/rxp
install -m 644 include/sigpr/*h $RPM_BUILD_ROOT%_includedir/sigpr
install -m 644 include/unix/*h $RPM_BUILD_ROOT%_includedir/unix
# install libs
install -m 644 lib/lib*.a $RPM_BUILD_ROOT%_libdir
# install init script
install -m 755 -D %{S:6} $RPM_BUILD_ROOT/etc/init.d/%name
install -d $RPM_BUILD_ROOT%_sbindir
ln -sf ../../etc/init.d/%name $RPM_BUILD_ROOT/usr/sbin/rc%name
# installl sysconfig file
install -m 644 -D %{S:5} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%name

%clean
rm -rf $RPM_BUILD_ROOT

%pre
/usr/sbin/groupadd -r festival 2> /dev/null || :
/usr/sbin/useradd -r -o -g festival -s /bin/false -c "Festival daemon" -d /usr/share/festival/ festival 2> /dev/null || :

%post
%{fillup_only}

%preun
%stop_on_removal %name 

%postun
%restart_on_update %name
%insserv_cleanup

%files 
%defattr(-,root,root)
%doc COPYING README INSTALL examples/*.text examples/ex1.* examples/*.scm examples/*.dtd
%_sysconfdir/festival.scm
%_sysconfdir/init.d/%name
%_bindir/festival
%_bindir/festival_client
%_bindir/festival_server
%_bindir/festival_server_control
%_bindir/text2wave
%_bindir/saytime
%_sbindir/rc%name
%_prefix/lib/festival
%_datadir/festival
%_mandir/man1/*
/var/adm/fillup-templates/*

%files devel
%defattr(-,root,root)
%_includedir/*
%_libdir/lib*.a

%changelog