File re2.spec of Package re2
%define realname re2
%define srcext tar.bz2
%define so_ver 0
# Common info
Name: %{realname}
Version: 0
Release: wiz%{?extraver:0.}1%{?dist}
License: BSD-3-Clause
Group: System/Libraries
URL: https://github.com/google/re2
Summary: Fast, safe, thread-friendly regular expression engine
# Build-time parameters
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-root
Source: %{realname}-%{version}.%{srcext}
%description
RE2 is a fast, safe, thread-friendly alternative to backtracking regular
expression engines like those used in PCRE, Perl, and Python.
It is a C++ library.
%package -n libre2-%{so_ver}
Group: System/Libraries
Summary: Fast, safe, thread-friendly regular expression engine
%description -n libre2-%{so_ver}
RE2 is a fast, safe, thread-friendly alternative to backtracking regular
expression engines like those used in PCRE, Perl, and Python.
It is a C++ library.
%package -n libre2-devel
Group: Development/Languages/C and C++
Summary: Development files for libre2-%{so_ver}
Requires: libre2-%{so_ver} = %{version}-%{release}
Provides: re2-devel = %{version}-%{release}
Provides: libre2-%{so_ver}-devel = %{version}-%{release}
%description -n libre2-devel
RE2 is a fast, safe, thread-friendly alternative to backtracking regular
expression engines like those used in PCRE, Perl, and Python.
This package contains headers and libraries required to develop using re2.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%build
%{__make} %{?_smp_mflags} \
CXXFLAGS="%{optflags} %{?gcc_lto}" \
LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%install
%{__make} install DESTDIR=%{buildroot} \
prefix=%{_prefix} \
includedir=%{_includedir} \
libdir=%{_libdir}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files -n libre2-%{so_ver}
%defattr(-,root,root)
%doc AUTHORS CONTRIBUTORS LICENSE README doc/syntax.* doc/*.png
%{_libdir}/libre2.so.%{?so_ver}*
%files -n libre2-devel
%defattr(-,root,root)
%doc AUTHORS CONTRIBUTORS LICENSE README doc/syntax.* doc/*.png
%{_libdir}/pkgconfig/re2.pc
%dir %{_includedir}/re2
%{_includedir}/re2/*.h
%attr(0644,root,root) %{_libdir}/libre2.a
%{_libdir}/libre2.so
%post -n libre2-%{so_ver} -p /sbin/ldconfig
%postun -n libre2-%{so_ver} -p /sbin/ldconfig
%changelog