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