5a6b4fa
Name:           openfst
Jerry James 21dcb1f
Version:        1.3.3
28235dd
Release:        1%{?dist}
5a6b4fa
Summary:        Weighted finite-state transducer library
5a6b4fa
5a6b4fa
Group:          Development/Libraries
5a6b4fa
License:        ASL 2.0
5a6b4fa
URL:            http://www.openfst.org/
5a6b4fa
Source0:        http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-%{version}.tar.gz
5a6b4fa
Source1:        http://openfst.cs.nyu.edu/twiki/pub/Contrib/OpenFstBashComp/openfstbc
5a6b4fa
# Man pages written by Jerry James.  The text of the man pages is lifted from
5a6b4fa
# the sources, so it is under the same copyright and license.  In short, I
5a6b4fa
# contributed the formatting, but none of the text (with a few very small
5a6b4fa
# exceptions).
5a6b4fa
Source2:        openfst-man.tar.xz
5a6b4fa
5a6b4fa
%description
ce61fe6
OpenFst is a library for constructing, combining, optimizing, and
ce61fe6
searching weighted finite-state transducers (FSTs).  Weighted
ce61fe6
finite-state transducers are automata where each transition has an input
ce61fe6
label, an output label, and a weight.  The more familiar finite-state
ce61fe6
acceptor is represented as a transducer with each transition's input and
ce61fe6
output label equal.  Finite-state acceptors are used to represent sets
ce61fe6
of strings (specifically, regular or rational sets); finite-state
ce61fe6
transducers are used to represent binary relations between pairs of
ce61fe6
strings (specifically, rational transductions).  The weights can be used
ce61fe6
to represent the cost of taking a particular transition.
5a6b4fa
5a6b4fa
FSTs have key applications in speech recognition and synthesis, machine
5a6b4fa
translation, optical character recognition, pattern matching, string
5a6b4fa
processing, machine learning, information extraction and retrieval among
ce61fe6
others.  Often a weighted transducer is used to represent a
ce61fe6
probabilistic model (e.g., an n-gram model, pronunciation model).  FSTs
ce61fe6
can be optimized by determinization and minimization, models can be
ce61fe6
applied to hypothesis sets (also represented as automata) or cascaded by
ce61fe6
finite-state composition, and the best results can be selected by
ce61fe6
shortest-path algorithms.
5a6b4fa
5a6b4fa
%package devel
5a6b4fa
Summary:        Development files for OpenFst
5a6b4fa
Group:          Development/Libraries
5a6b4fa
Requires:       %{name}%{?_isa} = %{version}-%{release}
5a6b4fa
5a6b4fa
%description devel
ce61fe6
This package includes the necessary files to develop systems with
ce61fe6
OpenFst.
5a6b4fa
5a6b4fa
%package tools
5a6b4fa
Summary:        Command-line tools for working with FSTs
5a6b4fa
Group:          Applications/Multimedia
5a6b4fa
Requires:       %{name}%{?_isa} = %{version}-%{release}
5a6b4fa
5a6b4fa
%description tools
5a6b4fa
This package contains command-line tools that give access to OpenFst
5a6b4fa
functionality.
5a6b4fa
5a6b4fa
%prep
5a6b4fa
%setup -q
40fda84
%setup -q -T -D -a 2
5a6b4fa
b026d97
# Add missing linkage, remove unnecessary linkage, and make sure libraries
b026d97
# are built in the correct order so linkage is possible.
28235dd
sed -e 's|^LIBS =|LIBS = ../lib/libfst.la|' -i src/script/Makefile.in
28235dd
sed -e 's|^LIBS =|LIBS = ../../lib/libfst.la|' \
5a6b4fa
    -i src/extensions/compact/Makefile.in
28235dd
sed -e 's|^LIBS =|LIBS = ../../lib/libfst.la|' \
2cbd22f
    -i src/extensions/const/Makefile.in
28235dd
sed -e 's|^LIBS =|LIBS = ../../lib/libfst.la|' \
2cbd22f
    -i src/extensions/lookahead/Makefile.in
28235dd
sed -e 's|^LIBS =|LIBS = ../../lib/libfst.la|' \
ce61fe6
    -e 's|^\(libfstpdtscript_la_LIBADD =\).*|\1 ../../script/libfstscript.la|' \
5a6b4fa
    -i src/extensions/pdt/Makefile.in
28235dd
sed -e 's|^\(libfstfarscript_la_LIBADD =\).*|\1 ../../lib/libfst.la libfstfar.la|' \
ce61fe6
    -e 's|^\(@HAVE_SCRIPT_TRUE@libfst_LTLIBRARIES =\).*|\1 libfstfar.la libfstfarscript.la|' \
5a6b4fa
    -i src/extensions/far/Makefile.in
5a6b4fa
5a6b4fa
%build
Jerry James 21dcb1f
%configure --enable-bin --enable-compact-fsts --enable-const-fsts \
Jerry James 21dcb1f
  --enable-far --enable-ngram-fsts --enable-lookahead-fsts --enable-pdt \
Jerry James 21dcb1f
  LIBS="-ldl"
5a6b4fa
28235dd
# Get rid of undesirable hardcoded rpaths; also workaround libtool reordering
28235dd
# -Wl,--as-needed after all the libraries.
ce61fe6
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
ce61fe6
    -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
28235dd
    -e 's|^LTCC="gcc"|LTCC="gcc -Wl,--as-needed"|' \
28235dd
    -e 's|^CC="g++"|CC="g++ -Wl,--as-needed"|' \
ce61fe6
    -i libtool
5a6b4fa
5a6b4fa
make %{?_smp_mflags}
5a6b4fa
5a6b4fa
%install
5a6b4fa
make install DESTDIR=$RPM_BUILD_ROOT
5a6b4fa
5a6b4fa
# Get rid of libtool files
5a6b4fa
find $RPM_BUILD_ROOT%{_libdir} -name '*.la' | xargs rm -f
5a6b4fa
5a6b4fa
# Install the bash completion file
5a6b4fa
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
5a6b4fa
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
5a6b4fa
5a6b4fa
# Install the man pages
5a6b4fa
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
40fda84
cd man
40fda84
for f in *.1; do
28235dd
  sed -e "s/@VERSION@/%{version}/" -e "s/@DATE@/June 2012/" $f > \
40fda84
    $RPM_BUILD_ROOT%{_mandir}/man1/$f
40fda84
  touch -r $f $RPM_BUILD_ROOT%{_mandir}/man1/$f
40fda84
done
40fda84
cd ..
5a6b4fa
5a6b4fa
# Move libraries that are actually used by binaries out of the private dir.
5a6b4fa
# Leave symbolic links behind, since they are dlopen()ed.
5a6b4fa
5a6b4fa
# libfstfar and libfstfarscript
5a6b4fa
mv $RPM_BUILD_ROOT%{_libdir}/fst/libfstfar* $RPM_BUILD_ROOT%{_libdir}
5a6b4fa
ln -s ../libfstfar.so $RPM_BUILD_ROOT%{_libdir}/fst/libfstfar.so
5a6b4fa
ln -s ../libfstfar.so.0 $RPM_BUILD_ROOT%{_libdir}/fst/libfstfar.so.0
5a6b4fa
ln -s ../libfstfarscript.so $RPM_BUILD_ROOT%{_libdir}/fst/libfstfarscript.so
5a6b4fa
ln -s ../libfstfarscript.so.0 $RPM_BUILD_ROOT%{_libdir}/fst/libfstfarscript.so.0
5a6b4fa
5a6b4fa
# libfstpdtscript
5a6b4fa
mv $RPM_BUILD_ROOT%{_libdir}/fst/libfstpdtscript* $RPM_BUILD_ROOT%{_libdir}
5a6b4fa
ln -s ../libfstpdtscript.so $RPM_BUILD_ROOT%{_libdir}/fst/libfstpdtscript.so
5a6b4fa
ln -s ../libfstpdtscript.so.0 $RPM_BUILD_ROOT%{_libdir}/fst/libfstpdtscript.so.0
5a6b4fa
5a6b4fa
%post -p /sbin/ldconfig
5a6b4fa
5a6b4fa
%postun -p /sbin/ldconfig
5a6b4fa
5a6b4fa
%files
5a6b4fa
%doc AUTHORS COPYING NEWS README
5a6b4fa
%dir %{_libdir}/fst
5a6b4fa
%{_libdir}/fst/*.so.*
5a6b4fa
%{_libdir}/*.so.*
5a6b4fa
5a6b4fa
%files devel
5a6b4fa
%{_includedir}/fst
5a6b4fa
%{_libdir}/fst/*.so
5a6b4fa
%{_libdir}/*.so
5a6b4fa
5a6b4fa
%files tools
5a6b4fa
%{_bindir}/*
5a6b4fa
%{_mandir}/man1/*
5a6b4fa
%config(noreplace) %{_sysconfdir}/bash_completion.d
5a6b4fa
5a6b4fa
%changelog
Jerry James 21dcb1f
* Wed Feb  6 2013 Jerry James <loganjerry@gmail.com> - 1.3.3-1
Jerry James 21dcb1f
- New upstream version
Jerry James 21dcb1f
28235dd
* Mon Aug  6 2012 Jerry James <loganjerry@gmail.com> - 1.3.2-1
28235dd
- New upstream version
28235dd
ab6326e
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-3
ab6326e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
ab6326e
a3dda70
* Mon Apr 23 2012 Jerry James <loganjerry@gmail.com> - 1.3.1-2
a3dda70
- Rebuild for new icu
a3dda70
40fda84
* Mon Mar  5 2012 Jerry James <loganjerry@gmail.com> - 1.3.1-1
40fda84
- New upstream version
40fda84
6ecb0b6
* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.10-3
6ecb0b6
- Rebuilt for c++ ABI breakage
6ecb0b6
2242e1e
* Fri Jan  6 2012 Jerry James <loganjerry@gmail.com> - 1.2.10-2
2242e1e
- Rebuild for GCC 4.7
2242e1e
2cbd22f
* Mon Jan  2 2012 Jerry James <loganjerry@gmail.com> - 1.2.10-1
2cbd22f
- New upstream version
2cbd22f
ca0743e
* Tue Dec  6 2011 Jerry James <loganjerry@gmail.com> - 1.2.9-1
ca0743e
- New upstream version
ca0743e
- Drop upstreamed format patch
ca0743e
ce61fe6
* Wed Nov  9 2011 Jerry James <loganjerry@gmail.com> - 1.2.8-1
ce61fe6
- New upstream version
ce61fe6
- Drop unnecessary spec file elements (%%clean, etc.)
ce61fe6
a0af55a
* Thu Sep  8 2011 Jerry James <loganjerry@gmail.com> - 1.2.7-3
a0af55a
- Rebuild for new icu.
a0af55a
b026d97
* Wed May 18 2011 Jerry James <loganjerry@gmail.com> - 1.2.7-2
b026d97
- Fix incorrect target order in far extension Makefile.  Thanks to Dan HorĂ¡k
b026d97
  for the analysis.
b026d97
5a6b4fa
* Wed Mar  2 2011 Jerry James <loganjerry@gmail.com> - 1.2.7-1
5a6b4fa
- Initial RPM