3 %bcond_without tests # build without tests
4 %bcond_without static_libs # don't build static libraries
6 %define tagver 2020-08-01
7 %define ver %(echo %{tagver} | tr -d -)
8 Summary: C++ fast alternative to backtracking RE engines
9 Summary(pl.UTF-8): Szybka alternatywna dla silników RE w C++
15 #Source0Download: https://github.com/google/re2/releases
16 Source0: https://github.com/google/re2/archive/%{tagver}/%{name}-%{tagver}.tar.gz
17 # Source0-md5: 6dbd1d52b21d2d0307495bf075e45d42
18 Source1: re2Config.cmake
19 Source2: re2Config-pld.cmake.in
20 Patch0: test-compile.patch
21 URL: https://github.com/google/re2
22 BuildRequires: libstdc++-devel >= 6:4.7
23 BuildRequires: rpmbuild(macros) >= 1.734
24 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
27 RE2 is a C++ library providing a fast, safe, thread-friendly
28 alternative to backtracking regular expression engines like those used
29 in PCRE, Perl, and Python.
31 Backtracking engines are typically full of features and convenient
32 syntactic sugar but can be forced into taking exponential amounts of
33 time on even small inputs.
35 In contrast, RE2 uses automata theory to guarantee that regular
36 expression searches run in time linear in the size of the input, at
37 the expense of some missing features (e.g back references and
38 generalized assertions).
40 %description -l pl.UTF-8
41 RE2 to biblioteka C++ będąca szybką, bezpieczną, przyjazną dla wątków
42 alternatywą dla silników wyrażeń regularnych ze śledzeniem, takimi jak
43 używane w PCRE, Perlu i Pythonie.
45 Silniki ze śledzeniem mają zwykle dużo możliwości i wygodny lukier
46 składniowy, ale można je zmusić do wykładniczej złożoności czasowej
47 nawet przy niewielkim wejściu.
49 Dla odmiany RE2 używa teorii automatów, aby zagwarantować czas
50 wyszukiwania liniowy względem rozmiaru wejścia kosztem braku
51 niektórych możliwości (np. odwołań wstecznych i uogólnionych
55 Summary: C++ header files and library symbolic link for RE2
56 Summary(pl.UTF-8): Pliki nagłówkowe C++ i dowiązanie do biblioteki RE2
57 Group: Development/Libraries
58 Requires: %{name} = %{version}-%{release}
59 Requires: libstdc++-devel >= 6:4.7
62 This package contains the C++ header files and symbolic link to the
65 %description devel -l pl.UTF-8
66 Ten pakiet zawiera pliki nagłówkowe C++ oraz dowiązanie symboliczne do
67 biblioteki współdzielonej RE2.
70 Summary: Static RE2 library
71 Summary(pl.UTF-8): Statyczna biblioteka RE2
72 Group: Development/Libraries
73 Requires: %{name}-devel = %{version}-%{release}
78 %description static -l pl.UTF-8
79 Statyczna biblioteka RE2.
82 %setup -q -n %{name}-%{tagver}
86 # cmake doesn't set soname, doesn't install .pc file - still use plain makefiles
88 # The -pthread flag issue has been submitted upstream:
89 # http://groups.google.com/forum/?fromgroups=#!topic/re2-dev/bkUDtO5l6Lo
90 %{__make} all %{?with_tests:compile-test} \
92 CXXFLAGS="%{rpmcxxflags}" \
93 LDFLAGS="%{rpmldflags} -pthread" \
94 includedir=%{_includedir} \
100 CXXFLAGS="%{rpmcxxflags}"
104 rm -rf $RPM_BUILD_ROOT
107 INSTALL="install -p" \
108 includedir=%{_includedir} \
110 DESTDIR=$RPM_BUILD_ROOT
112 # ...but some users require cmake config files, so fake them
113 install -d $RPM_BUILD_ROOT%{_libdir}/cmake/re2
114 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_libdir}/cmake/re2
115 sed -e 's,@libdir@,%{_libdir},' %{SOURCE2} >$RPM_BUILD_ROOT%{_libdir}/cmake/re2/re2Config-pld.cmake
118 rm -rf $RPM_BUILD_ROOT
120 %post -p /sbin/ldconfig
121 %postun -p /sbin/ldconfig
124 %defattr(644,root,root,755)
125 %doc AUTHORS CONTRIBUTORS LICENSE README
126 %attr(755,root,root) %{_libdir}/libre2.so.*.*.*
127 %attr(755,root,root) %ghost %{_libdir}/libre2.so.8
130 %defattr(644,root,root,755)
132 %attr(755,root,root) %{_libdir}/libre2.so
134 %{_pkgconfigdir}/re2.pc
137 %if %{with static_libs}
139 %defattr(644,root,root,755)