re2 2.9.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +6 -0
- data/README.md +130 -22
- data/Rakefile +52 -90
- data/dependencies.yml +4 -4
- data/ext/re2/extconf.rb +256 -290
- data/ext/re2/re2.cc +1037 -318
- data/ext/re2/recipes.rb +24 -21
- data/lib/re2/regexp.rb +2 -0
- data/lib/re2/scanner.rb +2 -0
- data/lib/re2/string.rb +8 -6
- data/lib/re2/version.rb +1 -1
- data/lib/re2.rb +2 -0
- data/ports/archives/20260107.1.tar.gz +0 -0
- data/ports/archives/re2-2025-11-05.tar.gz +0 -0
- data/re2.gemspec +6 -4
- data/spec/kernel_spec.rb +2 -0
- data/spec/re2/match_data_spec.rb +520 -5
- data/spec/re2/regexp_spec.rb +342 -0
- data/spec/re2/scanner_spec.rb +185 -15
- data/spec/re2/set_spec.rb +123 -6
- data/spec/re2/string_spec.rb +2 -0
- data/spec/re2_spec.rb +219 -43
- data/spec/spec_helper.rb +2 -0
- metadata +17 -21
- data/ports/archives/20240116.1.tar.gz +0 -0
- data/ports/archives/re2-2024-03-01.tar.gz +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac8a9eeb58a93e3f4241d2677a51a15016d543fd55a003e358f1d8442717c517
|
|
4
|
+
data.tar.gz: d505664cefe09a08d4c14f174791bc3f213cec515897943f12adc2867a91df6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31affec3aeee1a47021d3e96360b52c7dc5065d2abcbd748c35d305e6fffdd3b7a521f92bb6c97aaca67b265bb9df34867f18c5e00edf647bd8e609e093c29aa
|
|
7
|
+
data.tar.gz: 76654d86eea56b7e66102fc6780d16f94eaba95f0d2c605a46a1eece51c2158414d26edfdcfc3732b2301fe35a6fdbe8860336ce8efc1bd416d0830ee0a64e93
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Python".
|
|
|
6
6
|
|
|
7
7
|
[](https://github.com/mudge/re2/actions)
|
|
8
8
|
|
|
9
|
-
**Current version:** 2.
|
|
10
|
-
**Bundled RE2 version:** libre2.11 (
|
|
9
|
+
**Current version:** 2.27.0
|
|
10
|
+
**Bundled RE2 version:** libre2.11 (2025-11-05)
|
|
11
11
|
|
|
12
12
|
```ruby
|
|
13
13
|
RE2('h.*o').full_match?("hello") #=> true
|
|
@@ -27,6 +27,8 @@ RE2('(\w+):(\d+)').full_match("ruby:1234")
|
|
|
27
27
|
* [Submatch extraction](#submatch-extraction)
|
|
28
28
|
* [Scanning text incrementally](#scanning-text-incrementally)
|
|
29
29
|
* [Searching simultaneously](#searching-simultaneously)
|
|
30
|
+
* [Replacing and extracting](#replacing-and-extracting)
|
|
31
|
+
* [Escaping](#escaping)
|
|
30
32
|
* [Encoding](#encoding)
|
|
31
33
|
* [Requirements](#requirements)
|
|
32
34
|
* [Native gems](#native-gems)
|
|
@@ -165,7 +167,72 @@ m["word"] #=> "ruby"
|
|
|
165
167
|
m["number"] #=> "1234"
|
|
166
168
|
```
|
|
167
169
|
|
|
168
|
-
|
|
170
|
+
Multiple submatches can be retrieved at the same time by numeric index or name with [`values_at`](https://mudge.name/re2/RE2/MatchData.html#values_at-instance_method):
|
|
171
|
+
|
|
172
|
+
```ruby
|
|
173
|
+
m = RE2('(?P<word>\w+):(?P<number>\d+):(\d+)').full_match("ruby:1234:5678")
|
|
174
|
+
#=> #<RE2::MatchData "ruby:1234:5678" 1:"ruby" 2:"1234" 3:"5678">
|
|
175
|
+
|
|
176
|
+
m.values_at("word", :number, 3)
|
|
177
|
+
#=> ["ruby", "1234", "5678"]
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
All captures can be returned as an array with [`captures`](https://mudge.name/re2/RE2/MatchData.html#captures-instance_method):
|
|
181
|
+
|
|
182
|
+
```ruby
|
|
183
|
+
m = RE2('(?P<word>\w+):(?P<number>\d+):(\d+)').full_match("ruby:1234:5678")
|
|
184
|
+
#=> #<RE2::MatchData "ruby:1234:5678" 1:"ruby" 2:"1234" 3:"5678">
|
|
185
|
+
|
|
186
|
+
m.captures #=> ["ruby", "1234", "5678"]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Capturing group names are available on both `RE2::Regexp` and `RE2::MatchData`:
|
|
190
|
+
|
|
191
|
+
```ruby
|
|
192
|
+
re = RE2('(?P<word>\w+):(?P<number>\d+):(\d+)')
|
|
193
|
+
re.names #=> ["number", "word"]
|
|
194
|
+
|
|
195
|
+
m = re.full_match("ruby:1234:5678")
|
|
196
|
+
m.names #=> ["number", "word"]
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Named captures can be returned as a hash with [`named_captures`](https://mudge.name/re2/RE2/MatchData.html#named_captures-instance_method):
|
|
200
|
+
|
|
201
|
+
```ruby
|
|
202
|
+
m = RE2('(?P<word>\w+):(?P<number>\d+):(\d+)').full_match("ruby:1234:5678")
|
|
203
|
+
#=> #<RE2::MatchData "ruby:1234:5678" 1:"ruby" 2:"1234" 3:"5678">
|
|
204
|
+
|
|
205
|
+
m.named_captures
|
|
206
|
+
#=> {"number" => "1234", "word" => "ruby"}
|
|
207
|
+
m.named_captures(symbolize_names: true)
|
|
208
|
+
#=> {number: "1234", word: "ruby"}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This is [also available](https://mudge.name/re2/RE2/Regexp.html#named_captures-instance_method) on the original `RE2::Regexp` but will return the corresponding numerical index for each group:
|
|
212
|
+
|
|
213
|
+
```ruby
|
|
214
|
+
re = RE2('(?P<word>\w+):(?P<number>\d+):(\d+)')
|
|
215
|
+
re.named_captures
|
|
216
|
+
#=> {"number" => 2, "word" => 1}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The strings before and after a match can be returned with [`pre_match`](https://mudge.name/re2/RE2/MatchData.html#pre_match-instance_method) and [`post_match`](https://mudge.name/re2/RE2/MatchData.html#post_match-instance_method):
|
|
220
|
+
|
|
221
|
+
```ruby
|
|
222
|
+
m = RE2::Regexp.new('(\d+)').partial_match("bob 123 456")
|
|
223
|
+
m.pre_match #=> "bob "
|
|
224
|
+
m.post_match #=> " 456"
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
The [`offset`](https://mudge.name/re2/RE2/MatchData.html#offset-instance_method) and [`match_length`](https://mudge.name/re2/RE2/MatchData.html#match_length-instance_method) of a match can be retrieved by index or name:
|
|
228
|
+
|
|
229
|
+
```ruby
|
|
230
|
+
m = RE2::Regexp.new('(\d+)').partial_match("bob 123 456")
|
|
231
|
+
m.offset(1) #=> [4, 7]
|
|
232
|
+
m.match_length(1) #=> 3
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`RE2::MatchData` objects can also be used with Ruby's [pattern matching](https://docs.ruby-lang.org/en/3.2/syntax/pattern_matching_rdoc.html):
|
|
169
236
|
|
|
170
237
|
```ruby
|
|
171
238
|
case RE2('(\w+):(\d+)').full_match("ruby:1234")
|
|
@@ -224,17 +291,56 @@ the set. After all patterns have been added, the set can be compiled using
|
|
|
224
291
|
and then
|
|
225
292
|
[`RE2::Set#match`](https://mudge.name/re2/RE2/Set.html#match-instance_method)
|
|
226
293
|
will return an array containing the indices of all the patterns that matched.
|
|
294
|
+
[`RE2::Set#size`](https://mudge.name/re2/RE2/Set.html#size-instance_method)
|
|
295
|
+
will return the number of patterns in the set.
|
|
227
296
|
|
|
228
297
|
```ruby
|
|
229
298
|
set = RE2::Set.new
|
|
230
299
|
set.add("abc") #=> 0
|
|
231
300
|
set.add("def") #=> 1
|
|
232
301
|
set.add("ghi") #=> 2
|
|
302
|
+
set.size #=> 3
|
|
233
303
|
set.compile #=> true
|
|
234
304
|
set.match("abcdefghi") #=> [0, 1, 2]
|
|
235
305
|
set.match("ghidefabc") #=> [2, 1, 0]
|
|
236
306
|
```
|
|
237
307
|
|
|
308
|
+
### Replacing and extracting
|
|
309
|
+
|
|
310
|
+
[`RE2.replace`](https://mudge.name/re2/RE2.html#replace-class_method) returns a copy of a given string with the first occurrence of a pattern replaced with a given rewrite string:
|
|
311
|
+
|
|
312
|
+
```ruby
|
|
313
|
+
RE2.replace("hello there", "hello", "howdy") #=> "howdy there"
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
The pattern can be given as either a string or an `RE2::Regexp`:
|
|
317
|
+
|
|
318
|
+
```ruby
|
|
319
|
+
re = RE2('hel+o')
|
|
320
|
+
RE2.replace("hello there", re, "yo") #=> "yo there"
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
To replace _all_ matches and not just the first, use [`RE2.global_replace`](https://mudge.name/re2/RE2.html#global_replace-class_method):
|
|
324
|
+
|
|
325
|
+
```ruby
|
|
326
|
+
RE2.global_replace("hallo thare", "a", "e") #=> "hello there"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
To extract matches with a given rewrite string including substitutions, use [`RE2.extract`](https://mudge.name/re2/RE2.html#extract-class_method):
|
|
330
|
+
|
|
331
|
+
```ruby
|
|
332
|
+
RE2.extract("alice@example.com", '(\w+)@(\w+)', '\2-\1')
|
|
333
|
+
#=> "example-alice"
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Escaping
|
|
337
|
+
|
|
338
|
+
To escape all potentially meaningful regexp characters in a string, use [`RE2.escape`](https://mudge.name/re2/RE2.html#escape-class_method):
|
|
339
|
+
|
|
340
|
+
```ruby
|
|
341
|
+
RE2.escape("1.5-2.0?") #=> "1\\.5\\-2\\.0\\?"
|
|
342
|
+
```
|
|
343
|
+
|
|
238
344
|
### Encoding
|
|
239
345
|
|
|
240
346
|
> [!WARNING]
|
|
@@ -247,50 +353,49 @@ the right encoding so this is the responsibility of the caller, e.g.
|
|
|
247
353
|
|
|
248
354
|
```ruby
|
|
249
355
|
# By default, RE2 will process patterns and text as UTF-8
|
|
250
|
-
RE2(non_utf8_pattern.encode("UTF-8")).
|
|
356
|
+
RE2(non_utf8_pattern.encode("UTF-8")).partial_match(non_utf8_text.encode("UTF-8"))
|
|
251
357
|
|
|
252
358
|
# If the :utf8 option is false, RE2 will process patterns and text as ISO-8859-1
|
|
253
|
-
RE2(non_latin1_pattern.encode("ISO-8859-1"), utf8: false).
|
|
359
|
+
RE2(non_latin1_pattern.encode("ISO-8859-1"), utf8: false).partial_match(non_latin1_text.encode("ISO-8859-1"))
|
|
254
360
|
```
|
|
255
361
|
|
|
256
362
|
## Requirements
|
|
257
363
|
|
|
258
364
|
This gem requires the following to run:
|
|
259
365
|
|
|
260
|
-
* [Ruby](https://www.ruby-lang.org/en/)
|
|
366
|
+
* [Ruby](https://www.ruby-lang.org/en/) 3.1 to 4.0
|
|
261
367
|
|
|
262
368
|
It supports the following RE2 ABI versions:
|
|
263
369
|
|
|
264
|
-
* libre2.0 (prior to release 2020-03-02) to libre2.11 (2023-07-01 to
|
|
370
|
+
* libre2.0 (prior to release 2020-03-02) to libre2.11 (2023-07-01 to 2025-11-05)
|
|
265
371
|
|
|
266
372
|
### Native gems
|
|
267
373
|
|
|
268
374
|
Where possible, a pre-compiled native gem will be provided for the following platforms:
|
|
269
375
|
|
|
270
376
|
* Linux
|
|
271
|
-
* `aarch64-linux` and `
|
|
272
|
-
*
|
|
273
|
-
|
|
274
|
-
*
|
|
275
|
-
* Windows `x64-mingw32` and `x64-mingw-ucrt`
|
|
377
|
+
* `aarch64-linux`, `arm-linux`, and `x86_64-linux` (requires [glibc](https://www.gnu.org/software/libc/) 2.29+, RubyGems 3.3.22+ and Bundler 2.3.21+)
|
|
378
|
+
* [musl](https://musl.libc.org/)-based systems such as [Alpine](https://alpinelinux.org) are supported with Bundler 2.5.6+
|
|
379
|
+
* macOS 10.14+ `x86_64-darwin` and `arm64-darwin`
|
|
380
|
+
* Windows 2022+ `x64-mingw-ucrt`
|
|
276
381
|
|
|
277
382
|
### Verifying the gems
|
|
278
383
|
|
|
279
384
|
SHA256 checksums are included in the [release notes](https://github.com/mudge/re2/releases) for each version and can be checked with `sha256sum`, e.g.
|
|
280
385
|
|
|
281
386
|
```console
|
|
282
|
-
$ gem fetch re2 -v 2.
|
|
283
|
-
Fetching re2-2.
|
|
284
|
-
Downloaded re2-2.
|
|
285
|
-
$ sha256sum re2-2.
|
|
286
|
-
|
|
387
|
+
$ gem fetch re2 -v 2.18.0
|
|
388
|
+
Fetching re2-2.18.0-arm64-darwin.gem
|
|
389
|
+
Downloaded re2-2.18.0-arm64-darwin
|
|
390
|
+
$ sha256sum re2-2.18.0-arm64-darwin.gem
|
|
391
|
+
953063f0491420163d3484ed256fe2ff616c777ec66ee20aa5ec1a1a1fc39ff5 re2-2.18.0-arm64-darwin.gem
|
|
287
392
|
```
|
|
288
393
|
|
|
289
394
|
[GPG](https://www.gnupg.org/) signatures are attached to each release (the assets ending in `.sig`) and can be verified if you import [our signing key `0x39AC3530070E0F75`](https://mudge.name/39AC3530070E0F75.asc) (or fetch it from a public keyserver, e.g. `gpg --keyserver keyserver.ubuntu.com --recv-key 0x39AC3530070E0F75`):
|
|
290
395
|
|
|
291
396
|
```console
|
|
292
|
-
$ gpg --verify re2-2.
|
|
293
|
-
gpg: Signature made
|
|
397
|
+
$ gpg --verify re2-2.18.0-arm64-darwin.gem.sig re2-2.18.0-arm64-darwin.gem
|
|
398
|
+
gpg: Signature made Sun 3 Aug 11:02:26 2025 BST
|
|
294
399
|
gpg: using RSA key 702609D9C790F45B577D7BEC39AC3530070E0F75
|
|
295
400
|
gpg: Good signature from "Paul Mucur <mudge@mudge.name>" [unknown]
|
|
296
401
|
gpg: aka "Paul Mucur <paul@ghostcassette.com>" [unknown]
|
|
@@ -328,9 +433,10 @@ You will need a full compiler toolchain for compiling Ruby C extensions (see
|
|
|
328
433
|
[Nokogiri's "The Compiler
|
|
329
434
|
Toolchain"](https://nokogiri.org/tutorials/installing_nokogiri.html#appendix-a-the-compiler-toolchain))
|
|
330
435
|
plus the toolchain required for compiling the vendored version of RE2 and its
|
|
331
|
-
dependency [Abseil][] which includes
|
|
332
|
-
|
|
333
|
-
[
|
|
436
|
+
dependency [Abseil][] which includes [CMake](https://cmake.org), a compiler
|
|
437
|
+
with C++17 support such as [clang](http://clang.llvm.org/) 5 or
|
|
438
|
+
[gcc](https://gcc.gnu.org/) 8 and a recent version of
|
|
439
|
+
[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). On
|
|
334
440
|
Windows, you'll also need pkgconf 2.1.0+ to avoid [`undefined reference`
|
|
335
441
|
errors](https://github.com/pkgconf/pkgconf/issues/322) when attempting to
|
|
336
442
|
compile Abseil.
|
|
@@ -375,6 +481,8 @@ Alternatively, you can set the `RE2_USE_SYSTEM_LIBRARIES` environment variable i
|
|
|
375
481
|
improvements in 2.4.0.
|
|
376
482
|
* Thanks to [Manuel Jacob](https://github.com/manueljacob) for reporting a bug
|
|
377
483
|
when passing strings with null bytes.
|
|
484
|
+
* Thanks to [Maciej Gajewski](https://github.com/konieczkow) for helping
|
|
485
|
+
confirm issues with GC compaction and mutable strings.
|
|
378
486
|
|
|
379
487
|
## Contact
|
|
380
488
|
|
data/Rakefile
CHANGED
|
@@ -1,58 +1,43 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'rake/extensiontask'
|
|
4
|
-
require 'rspec/core/rake_task'
|
|
5
4
|
require 'rake_compiler_dock'
|
|
6
|
-
require '
|
|
5
|
+
require 'rspec/core/rake_task'
|
|
7
6
|
|
|
8
7
|
require_relative 'ext/re2/recipes'
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
FileList['**/Makefile'],
|
|
13
|
-
FileList['pkg/']
|
|
14
|
-
|
|
15
|
-
CLOBBER.include FileList['**/tmp'],
|
|
16
|
-
FileList['**/*.log'],
|
|
17
|
-
FileList['doc/**'],
|
|
18
|
-
FileList['tmp/']
|
|
19
|
-
CLOBBER.add("ports/*").exclude(%r{ports/archives$})
|
|
20
|
-
|
|
21
|
-
RE2_GEM_SPEC = Gem::Specification.load('re2.gemspec')
|
|
22
|
-
|
|
23
|
-
task :prepare do
|
|
24
|
-
puts "Preparing project for gem building..."
|
|
25
|
-
recipes = load_recipes
|
|
26
|
-
recipes.each { |recipe| recipe.download }
|
|
27
|
-
end
|
|
9
|
+
re2_gemspec = Gem::Specification.load('re2.gemspec')
|
|
10
|
+
abseil_recipe, re2_recipe = load_recipes
|
|
28
11
|
|
|
29
|
-
|
|
12
|
+
# Add Abseil and RE2's latest archives to the gem files. (Note these will be
|
|
13
|
+
# removed from the precompiled native gems.)
|
|
14
|
+
abseil_archive = File.join("ports/archives", File.basename(abseil_recipe.files[0][:url]))
|
|
15
|
+
re2_archive = File.join("ports/archives", File.basename(re2_recipe.files[0][:url]))
|
|
30
16
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
p.need_tar = false
|
|
34
|
-
end
|
|
17
|
+
re2_gemspec.files << abseil_archive
|
|
18
|
+
re2_gemspec.files << re2_archive
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
aarch64-linux
|
|
39
|
-
arm-linux
|
|
20
|
+
cross_platforms = %w[
|
|
21
|
+
aarch64-linux-gnu
|
|
22
|
+
aarch64-linux-musl
|
|
23
|
+
arm-linux-gnu
|
|
24
|
+
arm-linux-musl
|
|
40
25
|
arm64-darwin
|
|
41
26
|
x64-mingw-ucrt
|
|
42
|
-
x64-mingw32
|
|
43
|
-
x86-linux
|
|
44
|
-
x86-mingw32
|
|
45
27
|
x86_64-darwin
|
|
46
|
-
x86_64-linux
|
|
28
|
+
x86_64-linux-gnu
|
|
29
|
+
x86_64-linux-musl
|
|
47
30
|
].freeze
|
|
48
31
|
|
|
49
|
-
|
|
32
|
+
RakeCompilerDock.set_ruby_cc_version("~> 3.1", "~> 4.0")
|
|
33
|
+
|
|
34
|
+
Gem::PackageTask.new(re2_gemspec).define
|
|
50
35
|
|
|
51
|
-
Rake::ExtensionTask.new('re2',
|
|
36
|
+
Rake::ExtensionTask.new('re2', re2_gemspec) do |e|
|
|
52
37
|
e.cross_compile = true
|
|
53
38
|
e.cross_config_options << '--enable-cross-build'
|
|
54
39
|
e.config_options << '--disable-system-libraries'
|
|
55
|
-
e.cross_platform =
|
|
40
|
+
e.cross_platform = cross_platforms
|
|
56
41
|
e.cross_compiling do |spec|
|
|
57
42
|
spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
|
|
58
43
|
spec.dependencies.reject! { |dep| dep.name == 'mini_portile2' }
|
|
@@ -61,72 +46,49 @@ end
|
|
|
61
46
|
|
|
62
47
|
RSpec::Core::RakeTask.new(:spec)
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
begin
|
|
50
|
+
require 'ruby_memcheck'
|
|
51
|
+
require 'ruby_memcheck/rspec/rake_task'
|
|
52
|
+
|
|
53
|
+
namespace :spec do
|
|
54
|
+
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
|
|
69
55
|
end
|
|
56
|
+
rescue LoadError
|
|
57
|
+
# Only define the spec:valgrind task if ruby_memcheck is installed
|
|
58
|
+
end
|
|
70
59
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
#
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'/usr/local/bin/cmake'
|
|
79
|
-
else
|
|
80
|
-
'cmake'
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
desc "build native gem for #{platform} platform"
|
|
60
|
+
namespace :gem do
|
|
61
|
+
cross_platforms.each do |platform|
|
|
62
|
+
|
|
63
|
+
# Compile each platform's native gem, packaging up the result. Note we add
|
|
64
|
+
# /usr/local/bin to the PATH as it contains the newest version of CMake in
|
|
65
|
+
# the rake-compiler-dock images.
|
|
66
|
+
desc "Compile and build native gem for #{platform} platform"
|
|
84
67
|
task platform do
|
|
85
68
|
RakeCompilerDock.sh <<~SCRIPT, platform: platform, verbose: true
|
|
69
|
+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null &&
|
|
70
|
+
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null &&
|
|
71
|
+
sudo apt-get update &&
|
|
72
|
+
sudo apt-get install -y cmake=3.22.2-0kitware1ubuntu20.04.1 cmake-data=3.22.2-0kitware1ubuntu20.04.1 &&
|
|
86
73
|
gem install bundler --no-document &&
|
|
87
|
-
bundle &&
|
|
88
|
-
bundle exec rake
|
|
74
|
+
bundle install &&
|
|
75
|
+
bundle exec rake native:#{platform} pkg/#{re2_gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
|
|
89
76
|
SCRIPT
|
|
90
77
|
end
|
|
91
|
-
|
|
92
|
-
namespace platform do
|
|
93
|
-
desc "build native gem for #{platform} platform (guest container)"
|
|
94
|
-
task 'builder' do
|
|
95
|
-
gem_builder(platform)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
78
|
end
|
|
99
|
-
|
|
100
|
-
desc 'build all native gems'
|
|
101
|
-
multitask 'native' => CROSS_RUBY_PLATFORMS
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def add_file_to_gem(relative_source_path)
|
|
105
|
-
dest_path = File.join(gem_build_path, relative_source_path)
|
|
106
|
-
dest_dir = File.dirname(dest_path)
|
|
107
|
-
|
|
108
|
-
mkdir_p dest_dir unless Dir.exist?(dest_dir)
|
|
109
|
-
rm_f dest_path if File.exist?(dest_path)
|
|
110
|
-
safe_ln relative_source_path, dest_path
|
|
111
|
-
|
|
112
|
-
RE2_GEM_SPEC.files << relative_source_path
|
|
113
79
|
end
|
|
114
80
|
|
|
115
|
-
|
|
116
|
-
|
|
81
|
+
# Set up file tasks for Abseil and RE2's archives so they are automatically
|
|
82
|
+
# downloaded when required by the gem task.
|
|
83
|
+
file abseil_archive do
|
|
84
|
+
abseil_recipe.download
|
|
117
85
|
end
|
|
118
86
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
abseil_archive = File.join('ports', 'archives', "#{dependencies['abseil']['version']}.tar.gz")
|
|
122
|
-
libre2_archive = File.join('ports', 'archives', "re2-#{dependencies['libre2']['version']}.tar.gz")
|
|
123
|
-
|
|
124
|
-
add_file_to_gem(abseil_archive)
|
|
125
|
-
add_file_to_gem(libre2_archive)
|
|
87
|
+
file re2_archive do
|
|
88
|
+
re2_recipe.download
|
|
126
89
|
end
|
|
127
90
|
|
|
128
|
-
task
|
|
129
|
-
add_vendored_libraries
|
|
130
|
-
end
|
|
91
|
+
task default: :spec
|
|
131
92
|
|
|
132
|
-
|
|
93
|
+
CLEAN.add("lib/**/*.{o,so,bundle}", "pkg")
|
|
94
|
+
CLOBBER.add("ports")
|
data/dependencies.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
libre2:
|
|
3
|
-
version: '
|
|
4
|
-
sha256:
|
|
3
|
+
version: '2025-11-05'
|
|
4
|
+
sha256: 87f6029d2f6de8aa023654240a03ada90e876ce9a4676e258dd01ea4c26ffd67
|
|
5
5
|
abseil:
|
|
6
|
-
version: '
|
|
7
|
-
sha256:
|
|
6
|
+
version: '20260107.1'
|
|
7
|
+
sha256: 4314e2a7cbac89cac25a2f2322870f343d81579756ceff7f431803c2c9090195
|