Blob Blame History Raw
Name:           sphinxbase
Version:        0.7
Release:        1%{?dist}
Summary:        Common library for CMU Sphinx voice recognition products

Group:          Development/Libraries
License:        BSD
URL:            http://cmusphinx.sourceforge.net/
Source0:        http://downloads.sourceforge.net/cmusphinx/%{name}-%{version}.tar.gz
# This patch has not been sent upstream, as it fixes a Fedora-specific problem.
# Install the Python egg in the Fedora way.
Patch0:         sphinxbase-python.patch
# This patch is a temporary workaround to the "file" type being removed from
# Cython.  This is only a workaround as Python 3 doesn't expose a file type at
# the C API level (which is why Cython removed it).
Patch1:         sphinxbase-python-file.patch

BuildRequires:  alsa-lib-devel
BuildRequires:  bison
BuildRequires:  blas-devel
BuildRequires:  Cython
BuildRequires:  doxygen
BuildRequires:  lapack-devel
BuildRequires:  libsndfile-devel
BuildRequires:  perl
BuildRequires:  pkgconfig
BuildRequires:  python2-devel
BuildRequires:  python-setuptools
BuildRequires:  tex(latex)

%description
Sphinxbase is a common library for CMU Sphinx voice recognition products.
This package does not provide voice recognition by itself.

%package devel
Summary:        Header and other development files for sphinxbase
Group:          Development/Libraries
Requires:       %{name}-libs = %{version}-%{release}, alsa-lib-devel, pkgconfig

%description devel
Header files and other development files for sphinxbase.

%package libs
Summary:        Libraries for sphinxbase
Group:          Development/Libraries

%description libs
The libraries for sphinxbase.

%package python
Summary:        Python interface to sphinxbase
Group:          Development/Libraries
Requires:       %{name}-libs = %{version}-%{release}

%description python
Python interface to sphinxbase.

%prep
%setup -q
%patch0
%patch1

iconv -f ISO8859-1 -t UTF-8 -o AUTHORS.new AUTHORS
touch -r AUTHORS.new AUTHORS
mv -f AUTHORS.new AUTHORS

# Force code generation with a newer version of Cython
rm -f python/sphinxbase.c

%build
%configure --disable-static --disable-rpath

# Get rid of undesirable hardcoded runpaths
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
    -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
    -i libtool

# Get rid of undesirable direct library dependencies
sed -i 's/-lpthread -lm -lblas -llapack/-lm/' src/libsphinxad/Makefile
sed -i 's/-lasound //' src/libsphinxbase/Makefile
sed -i 's/-lasound //' src/libsphinxbase/fe/Makefile
sed -i 's/-lasound //' src/libsphinxbase/feat/Makefile
sed -i 's/-lasound //' src/libsphinxbase/lm/Makefile
sed -i 's/-lasound //' src/libsphinxbase/util/Makefile
sed -i 's/-lasound //' src/sphinx_adtools/Makefile
sed -i 's/-lasound //' src/sphinx_cepview/Makefile
sed -i 's/-lasound //' src/sphinx_fe/Makefile
sed -i 's/-lasound //' src/sphinx_jsgf2fsg/Makefile
sed -i 's/-lasound //' src/sphinx_lmtools/Makefile

# Build the programs and libraries
make %{?_smp_mflags}

# Build the man pages
cd doc
export LD_LIBRARY_PATH=../src/libsphinxbase/.libs:../src/libsphinxad/.libs
for prog in sphinx_cepview sphinx_fe; do
  perl args2man.pl ../src/${prog}/${prog} < ${prog}.1.in > ${prog}.1
done
perl args2man.pl ../src/sphinx_adtools/sphinx_pitch < sphinx_pitch.1.in > sphinx_pitch.1

%install
# Install the binaries and libraries
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}
make install DESTDIR=$RPM_BUILD_ROOT

# Install the man pages
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
cp -p doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1

# Fix libtool damage
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
cd src/libsphinxad/.libs
gcc ${RPM_OPT_FLAGS} -std=gnu99 -shared cont_ad_base.o ad_alsa.o \
  -L$RPM_BUILD_ROOT%{_libdir} -lsphinxbase -lasound -lm \
  -Wl,-soname -Wl,libsphinxad.so.0 \
  -o $RPM_BUILD_ROOT%{_libdir}/libsphinxad.so.0.0.1

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/man1/*

%files devel
%defattr(-,root,root,-)
%doc doc/html
%{_includedir}/sphinxbase
%{_libdir}/libsphinxad.so
%{_libdir}/libsphinxbase.so
%{_libdir}/pkgconfig/sphinxbase.pc

%files libs
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/libsphinxad.so.*
%{_libdir}/libsphinxbase.so.*

%files python
%defattr(-,root,root,-)
%{python_sitearch}/*

%changelog
* Tue Apr 19 2011 Jerry James <loganjerry@gmail.com> - 0.7-1
- New upstream release

* Mon Aug 16 2010 Jerry James <loganjerry@gmail.com> - 0.6.1-1
- New upstream release

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Fri Nov 20 2009 Jerry James <loganjerry@gmail.com> - 0.4.1-2
- Update python BRs for Rawhide

* Mon Jun  1 2009 Jerry James <loganjerry@gmail.com> - 0.4.1-1
- Initial RPM