Files
opengrm-ngram/opengrm-ngram.spec

112 lines
3.7 KiB
RPMSpec

#
# spec file for package opengrm-ngram
#
# Copyright (c) 2016 SUSE LINUX 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/
#
%define soname 1
Name: opengrm-ngram
Version: 1.2.2
Release: 0
Summary: Library for making and modifying n-gram language models
License: Apache-2.0
Group: Development/Libraries/C and C++
Url: http://www.opengrm.org/
Source0: http://openfst.cs.nyu.edu/twiki/pub/GRM/NGramDownload/%{name}-%{version}.tar.gz
BuildRequires: chrpath
BuildRequires: gcc-c++
BuildRequires: gsl-devel
BuildRequires: libatlas3-devel
BuildRequires: libtool
BuildRequires: openfst-devel >= 1.3.3
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
The OpenGrm NGram library is used for making and modifying n-gram language models
encoded as weighted finite-state transducers (FSTs). It makes use of functionality
in the OpenFst library to create, access and manipulate n-gram models.
%package -n libngram%{soname}
Summary: Library for making and modifying n-gram language models
Group: System/Libraries
%description -n libngram%{soname}
The OpenGrm NGram library is used for making and modifying n-gram language models
encoded as weighted finite-state transducers (FSTs). It makes use of functionality
in the OpenFst library to create, access and manipulate n-gram models.
%package devel
Summary: Library for making and modifying n-gram language models
Group: Development/Libraries/C and C++
Requires: libngram%{soname} = %{version}
%description devel
The OpenGrm NGram library is used for making and modifying n-gram language models
encoded as weighted finite-state transducers (FSTs). It makes use of functionality
in the OpenFst library to create, access and manipulate n-gram models.
%prep
%setup -q
# Allow use of GNU extensions
sed -i 's/-std=c++0x/-std=gnu++11/' configure
%build
%configure CXXFLAGS="%{optflags} -DHAVE_GSL" \
LIBS="-L%{_libdir}/fst -Wl,-rpath=%{_libdir}/fst -lfst -lgsl -L%{_libdir}/atlas -lsatlas"
# 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
%make_install
# Clean up
find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print
# Remove the fst rpath from the library, which doesn't need it
chrpath -d src/lib/.libs/libngram.so.*.*.*
# Let users know that we use GSL
sed '/Faster multinomial sampling/a#define HAVE_GSL' \
%{buildroot}%{_includedir}/ngram/ngram-randgen.h > foo
touch -r %{buildroot}%{_includedir}/ngram/ngram-randgen.h foo
mv -f foo %{buildroot}%{_includedir}/ngram/ngram-randgen.h
%post -n libngram%{soname} -p /sbin/ldconfig
%postun -n libngram%{soname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README
%{_bindir}/*
%files -n libngram%{soname}
%defattr(-,root,root)
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root)
%{_includedir}/ngram/
%{_libdir}/*.so
%changelog