LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File sphinxtrain.spec of Package sphinxtrain (Project home:malcolmlewis:TESTING)

#
# spec file for package sphinxtrain
#
# Copyright (c) 2014 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# 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/
#

# NOTE: rpmlint complains about "only non-binary in /usr/lib", but some of the
# files there, even though they are not ELF files, are in fact arch-specific.

Name:           sphinxtrain
Version:        1.0.8
Release:        0
Summary:        Acoustic model trainer for CMU's Sphinx tools
License:        GPL-2.0+
Group:          Applications/Multimedia
Url:            http://cmusphinx.sourceforge.net/
Source0:        http://downloads.sourceforge.net/cmusphinx/%{name}-%{version}.tar.gz
# This file was accidentally omitted from the upstream source tarball.
Source1:        g2p_train.hpp
#PATCH-FIX-OPENSUSE sphinxtrain-g2p_train-fixes.patch malcolmlewis@opensuse.org -- Fix new ngram include names and openfst 1.3.3 changes.
Patch0:         sphinxtrain-g2p_train-fixes.patch
BuildRequires:  alsa-devel
BuildRequires:  gcc-c++
BuildRequires:  lapack-devel
BuildRequires:  libngram0-devel
BuildRequires:  libsamplerate-devel
BuildRequires:  libsndfile-devel
BuildRequires:  libtool
BuildRequires:  openfst-devel
#BuildRequires:  perl
BuildRequires:  pkg-config
#BuildRequires:  python-Cython
#BuildRequires:  python-devel
BuildRequires:  python-numpy-devel
#BuildRequires:  python-setuptools
BuildRequires:  python-scipy
BuildRequires:  sphinxbase-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SphinxTrain is Carnegie Mellon University's open source acoustic model
trainer.  It contains the scripts and instructions necessary for building
models for the CMU Sphinx Recognizer.

%prep
%setup -q
%patch0 -p1
# Add an accidentally omitted header file
cp -p %{S:1} src/programs/g2p_train
# Remove spurious-executable-perm  
find python/ -type f -exec chmod a-x {} \;
# Fix "Your file uses  __DATE and __TIME__ this causes the package to rebuild when not needed warning"
# We use the date from the changes file
set_date_time=`date --date "@\`stat --format %Y %{_sourcedir}/%{name}.changes\`" +"%B %Y %H:%M"`
sed -i -e "s/\_\_DATE\_\_,\_\_TIME\_\_/\"$set_date_time\"/g" src/programs/mllr_transform/main.c
sed -i -e "s/\_\_DATE\_\_, \_\_TIME\_\_/\"$set_date_time\"/g" src/programs/bw/main.c
%ifarch x86_64
   sed -i -e "s/lib\//lib64\//g" scripts/sphinxtrain
   sed -i -e "s/lib\//lib64\//g" scripts/000.comp_feat/make_feats.pl
   sed -i -e "s/lib\//lib64\//g" scripts/000.comp_feat/slave_feat.pl
   sed -i -e "s/lib\//lib64\//g" scripts/decode/psdecode.pl
   sed -i -e "s/lib\//lib64\//g" scripts/decode/verify_dec.pl
   sed -i -e "s/lib\//lib64\//g" scripts/decode/slave.pl
%endif

%build
%configure  --enable-static=no \
	    --with-openfst-includes=%{_includedir}/ \
	    --enable-g2p-decoder
# Get rid of undesirable hardcoded rpaths; also workaround libtool reordering
# -Wl,--as-needed after all the libraries.
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' \
    -e 's|CC="g..|& -Wl,--as-needed|' \
    -i libtool

make %{?_smp_mflags}

%install
%makeinstall
#FIXME Remove for the moment?
rm -rf %{buildroot}%{_libdir}/%{name}/python \
       %{buildroot}%{_includedir}
# Remove executable bits set.
find %{buildroot}%{_libdir}/%{name}/scripts/lib -name \*.pm -exec chmod a-x {} \;
find %{buildroot}%{_libdir}/%{name}/scripts/lib -name \*.txt -exec chmod a-x {} \;

%files
%defattr(-,root,root)
%doc COPYING NEWS README
%{_bindir}/%{name}
%{_libexecdir}/%{name}
%{_libdir}/%{name}

%changelog