-
Notifications
You must be signed in to change notification settings - Fork 35
/
README
267 lines (184 loc) · 8.08 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
-*- coding: utf-8-unix -*-
C wrapper for re2
=================
Topics
------
1. Introduction
2. License
3. Install
4. Usage
A. Credits
B. Bugs, vulnerabilities and contributions
C. Resources
D. Installing re2 and its dependencies
1. Introduction
---------------
The CRE2 distribution is a C language wrapper for the RE2 library, which
is implemented in C++. RE2 is a fast, safe, thread-friendly alternative
to backtracking regular expression engines like those used in PCRE,
Perl, and Python.
This distribution makes use of the GNU Autotools; it relies on
pkg-config to find the installed re2 library. The last time the
maintainer updated this paragraph, he had tested this package with a
release of RE2 2024-07-02.
2. License
----------
Copyright (c) 2012, 2013, 2015, 2016, 2017, 2019, 2024 Marco Maggi <[email protected]>
Copyright (c) 2011 Keegan McAllister
All rights reserved.
This license is meant to be the "BSD-3-Clause".
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of his contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3. Install
----------
To install RE2 follow the instructions in the README file in RE2's. To
install from a proper release tarball, do this:
$ cd cre2-0.1.0
$ mkdir build
$ cd build
$ ../configure
$ make
$ make check
$ make install
to inspect the available configuration options:
$ ../configure --help
The Makefile is designed to allow parallel builds, so we can do:
$ make -j4 all && make -j4 check
which, on a 4-core CPU, should speed up building and checking
significantly.
The Makefile supports the DESTDIR environment variable to install
files in a temporary location, example: to see what will happen:
$ make -n install DESTDIR=/tmp/cre2
to really do it:
$ make install DESTDIR=/tmp/cre2
After the installation it is possible to verify the installed library
against the test suite with:
$ make installcheck
From a repository checkout or snapshot (the ones from the Github
site): we must install the GNU Autotools (GNU Automake, GNU Autoconf,
GNU Libtool), then we must first run the script "autogen.sh" from the
top source directory, to generate the needed files:
$ cd cre2
$ sh autogen.sh
notice that "autogen.sh" will run the programs "autoreconf" and
"libtoolize"; the latter is selected through the environment variable
"LIBTOOLIZE", whose value can be customised; for example to run
"glibtoolize" rather than "libtoolize" we do:
$ LIBTOOLIZE=glibtoolize sh autogen.sh
After this the procedure is the same as the one for building from a
proper release tarball, but we have to enable maintainer mode:
$ ../configure --enable-maintainer-mode [options]
$ make
$ make check
$ make install
4. Usage
--------
Read the documentation.
A. Credits
----------
RE2 is a Google project. CRE2 is based on code by Keegan McAllister.
This distribution was assembled by Marco Maggi.
Matthew Hall (https://github.com/megahall) contributed miscellaneous
fixes.
Maksym Melnychok (https://github.com/keymone) contributed a fix for
wrong usage of variable-length arrays.
afiaux (https://github.com/afiaux) contributed the RE2:Set()
interface.
Guillaume Massé (https://github.com/MasseGuillaume) contributed fixes
and the implementation of "cre2_find_named_capturing_groups()".
Will Speak (https://github.com/iwillspeak) contributed the
implementation of the named capturing --> groups iterator.
B. Bugs, vulnerabilities and contributions
------------------------------------------
Bug and vulnerability reports are appreciated, all the vulnerability
reports are public; register them at the Issue Tracker at the project's
Github site. For contributions and patches please use the Pull Requests
feature at the project's Github site.
C. Resources
------------
RE2 is available at:
<https://github.com/google/re2>
and there exists a repackaging under the GNU Autotools in the
repository:
<http://github.com/marcomaggi/re2/>
in the branch "autotools.marcomaggi-2016-02-15".
The latest release of this package can be downloaded from:
<https://bitbucket.org/marcomaggi/cre2/downloads>
development takes place at:
<http://github.com/marcomaggi/cre2/>
and as backup at:
<https://bitbucket.org/marcomaggi/cre2/>
the documentation is available online:
<http://marcomaggi.github.io/docs/cre2.html>
the GNU Project software can be found here:
<http://www.gnu.org/>
D. Installing re2 and its dependencies
--------------------------------------
This may be a challenge, depending on how much of a cmake connoisseur we
are.
In general, we have to remember that: if we install both the shared
and the static libraries: when compiling with common command line
options, the static libraries will take precedence. This package is
meant to be used with shared libraries, but it should work fine with
static libraries, too.
Let's suppose we want to install all the packages under the directory
"/opt/re2/2024-07-02"; on a Unix system, we will need to put in some
profile configuration file something like:
RE2_PREFIX=/opt/re2/2024-07-02
RE2_LIBDIR=${RE2_PREFIX}/lib64
export LD_LIBRARY_PATH=${RE2_LIBDIR}:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=${RE2_LIBDIR}/pkgconfig:$PKG_CONFIG_PATH
as a first attempt: no other search path should be upgraded, let's leave
to the packages to find include files and everything else.
When configuring, building and installing the prerequisite package
"abseil" we should follow the instructions in its README file; but here
is a hint to configure the package to build shared libraries:
$ cmake . \
--install-prefix "$RE2_PREFIX" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS:STRING="-fPIC" \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_PROPAGATE_CXX_STD=ON
When configuring, building and installing the prerequisite package
"googletest" we should follow the instructions in its README file; but
here is a hint to configure the package to build shared libraries:
$ cmake . \
--install-prefix "$RE2_PREFIX" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_FLAGS:STRING="-fPIC"
When configuring, building and installing the package "re2" itself we
should follow the instructions in its README file; but here is a hint to
configure the package to build shared libraries:
$ cmake . \
--install-prefix "$RE2_PREFIX" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_FLAGS:STRING="-fPIC" \
-DCMAKE_BUILD_TYPE=Release
### end of file
# Local Variables:
# mode: text
# fill-column: 72
# paragraph-start: "*"
# End: