re2 2.0.0.beta1-arm64-darwin → 2.0.0.beta2-arm64-darwin
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 +1 -9
- data/README.md +33 -11
- data/Rakefile +1 -24
- data/dependencies.yml +3 -3
- data/ext/re2/extconf.rb +63 -9
- data/lib/2.6/re2.bundle +0 -0
- data/lib/2.7/re2.bundle +0 -0
- data/lib/3.0/re2.bundle +0 -0
- data/lib/3.1/re2.bundle +0 -0
- data/lib/3.2/re2.bundle +0 -0
- data/lib/re2/version.rb +1 -1
- data/re2.gemspec +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f9c142b03386f91e132cd46473b4093a4d34fbd7101621bdcb95ae2dc66526d
|
4
|
+
data.tar.gz: 4ea5d23077b2a02ce34e9177caefa190514ad5f6f4911181fe25238666599484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63cdf57c594f010add3521cc05234aa65ac54a569d98340713f44925f3874773bbf3d9441d7f8021571adf93da3a0a47d905c1620d5ccb91a3f1c9cdd099fd6b
|
7
|
+
data.tar.gz: eb64842de5b98b30c081c38eb9577a9870a6952bda0ab99f255c06e59b6240795e01ec23c88ad628c4003963655595fa816e64897b3d9cf6e3495dda69d7ab5a
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,17 +4,33 @@ re2 [
|
9
10
|
**Supported re2 versions:** libre2.0 (< 2020-03-02), libre2.1 (2020-03-02), libre2.6 (2020-03-03), libre2.7 (2020-05-01), libre2.8 (2020-07-06), libre2.9 (2020-11-01), libre2.10 (2022-12-01), libre2.11 (2023-07-01)
|
10
11
|
|
11
12
|
Installation
|
12
13
|
------------
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
The gem comes bundled with a version of [re2][] and will compile itself (and
|
16
|
+
any dependencies) on install. As compilation can take a while, precompiled
|
17
|
+
native gems are available for Linux, Windows and macOS.
|
18
|
+
|
19
|
+
In v2.0 and later, precompiled native gems are available for Ruby 2.7 to 3.2
|
20
|
+
on these platforms:
|
21
|
+
|
22
|
+
- `aarch64-linux` (requires: glibc >= 2.29)
|
23
|
+
- `arm-linux` (requires: glibc >= 2.29)
|
24
|
+
- `arm64-darwin`
|
25
|
+
- `x64-mingw32` / `x64-mingw-ucrt`
|
26
|
+
- `x86-linux` (requires: glibc >= 2.17)
|
27
|
+
- `x86_64-darwin`
|
28
|
+
- `x86_64-linux` (requires: glibc >= 2.17)
|
29
|
+
|
30
|
+
If you wish to opt out of using the bundled libraries, you will need re2
|
31
|
+
installed as well as a C++ compiler such as [gcc][] (on Debian and Ubuntu, this
|
32
|
+
is provided by the [build-essential][] package). If you are using Mac OS X, I
|
33
|
+
recommend installing re2 with [Homebrew][] by running the following:
|
18
34
|
|
19
35
|
$ brew install re2
|
20
36
|
|
@@ -22,20 +38,26 @@ If you are using Debian, you can install the [libre2-dev][] package like so:
|
|
22
38
|
|
23
39
|
$ sudo apt-get install libre2-dev
|
24
40
|
|
25
|
-
Recent versions of re2 require a compiler with C++14 support such as
|
41
|
+
Recent versions of re2 require a compiler with C++14 support such as
|
42
|
+
[clang](http://clang.llvm.org/) 3.4 or [gcc](https://gcc.gnu.org/) 5.
|
26
43
|
|
27
44
|
If you are using a packaged Ruby distribution, make sure you also have the
|
28
45
|
Ruby header files installed such as those provided by the [ruby-dev][] package
|
29
46
|
on Debian and Ubuntu.
|
30
47
|
|
31
|
-
You can then install the library via RubyGems with `gem install re2
|
32
|
-
|
33
|
-
any of the
|
48
|
+
You can then install the library via RubyGems with `gem install re2 --platform=ruby --
|
49
|
+
--enable-system-libraries` or `gem install re2 --platform=ruby -- --enable-system-libraries
|
50
|
+
--with-re2-dir=/path/to/re2/prefix` if re2 is not installed in any of the
|
51
|
+
following default locations:
|
34
52
|
|
35
53
|
* `/usr/local`
|
36
54
|
* `/opt/homebrew`
|
37
55
|
* `/usr`
|
38
56
|
|
57
|
+
If you're using Bundler, you can use the
|
58
|
+
[`force_ruby_platform`](https://bundler.io/v2.3/man/gemfile.5.html#FORCE_RUBY_PLATFORM)
|
59
|
+
option in your Gemfile.
|
60
|
+
|
39
61
|
Documentation
|
40
62
|
-------------
|
41
63
|
|
@@ -214,7 +236,7 @@ Contributions
|
|
214
236
|
* Thanks to [Jason Woods](https://github.com/driskell) who contributed the
|
215
237
|
original implementations of `RE2::MatchData#begin` and `RE2::MatchData#end`;
|
216
238
|
* Thanks to [Stefano Rivera](https://github.com/stefanor) who first contributed C++11 support;
|
217
|
-
* Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty patterns and `RE2::Regexp#scan
|
239
|
+
* Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty patterns and `RE2::Regexp#scan`, contributing support for libre2.11 (2023-07-01) and for vendoring re2 and abseil and compiling native gems in 2.0;
|
218
240
|
* Thanks to [Sebastian Reitenbach](https://github.com/buzzdeee) for reporting
|
219
241
|
the deprecation and removal of the `utf8` encoding option in re2;
|
220
242
|
* Thanks to [Sergio Medina](https://github.com/serch) for reporting a bug when
|
data/Rakefile
CHANGED
@@ -33,7 +33,7 @@ Gem::PackageTask.new(RE2_GEM_SPEC) do |p|
|
|
33
33
|
p.need_tar = false
|
34
34
|
end
|
35
35
|
|
36
|
-
CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0].join(':')
|
36
|
+
CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':')
|
37
37
|
CROSS_RUBY_PLATFORMS = %w[
|
38
38
|
aarch64-linux
|
39
39
|
arm-linux
|
@@ -129,27 +129,4 @@ task gem_build_path do
|
|
129
129
|
add_vendored_libraries
|
130
130
|
end
|
131
131
|
|
132
|
-
desc "Temporarily set VERSION to a unique timestamp"
|
133
|
-
task "set-version-to-timestamp" do
|
134
|
-
# this task is used by bin/test-gem-build
|
135
|
-
# to test building, packaging, and installing a precompiled gem
|
136
|
-
version_constant_re = /^\s*VERSION\s*=\s*["'](.*)["']$/
|
137
|
-
|
138
|
-
version_file_path = File.join(__dir__, "lib/re2/version.rb")
|
139
|
-
version_file_contents = File.read(version_file_path)
|
140
|
-
|
141
|
-
current_version_string = version_constant_re.match(version_file_contents)[1]
|
142
|
-
current_version = Gem::Version.new(current_version_string)
|
143
|
-
|
144
|
-
fake_version = Gem::Version.new(format("%s.test.%s", current_version.bump, Time.now.strftime("%Y.%m%d.%H%M")))
|
145
|
-
|
146
|
-
unless version_file_contents.gsub!(version_constant_re, " VERSION = \"#{fake_version}\"")
|
147
|
-
raise("Could not hack the VERSION constant")
|
148
|
-
end
|
149
|
-
|
150
|
-
File.open(version_file_path, "w") { |f| f.write(version_file_contents) }
|
151
|
-
|
152
|
-
puts "NOTE: wrote version as \"#{fake_version}\""
|
153
|
-
end
|
154
|
-
|
155
132
|
task default: [:compile, :spec]
|
data/dependencies.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
libre2:
|
2
|
-
version: "2023-
|
3
|
-
sha256: "
|
4
|
-
# sha-256 hash provided in https://github.com/google/re2/releases/download/2023-
|
2
|
+
version: "2023-09-01"
|
3
|
+
sha256: "5bb6875ae1cd1e9fedde98018c346db7260655f86fdb8837e3075103acd3649b"
|
4
|
+
# sha-256 hash provided in https://github.com/google/re2/releases/download/2023-09-01/re2-2023-09-01.tar.gz
|
5
5
|
|
6
6
|
abseil:
|
7
7
|
version: "20230125.3"
|
data/ext/re2/extconf.rb
CHANGED
@@ -117,8 +117,10 @@ if ENV["CXX"]
|
|
117
117
|
RbConfig::CONFIG["CXX"] = ENV["CXX"]
|
118
118
|
end
|
119
119
|
|
120
|
-
def build_extension
|
120
|
+
def build_extension(static_p = false)
|
121
|
+
# Enable optional warnings but disable deprecated register warning for Ruby 2.6 support
|
121
122
|
$CFLAGS << " -Wall -Wextra -funroll-loops"
|
123
|
+
$CPPFLAGS << " -Wno-register"
|
122
124
|
|
123
125
|
# Pass -x c++ to force gcc to compile the test program
|
124
126
|
# as C++ (as it will end in .c by default).
|
@@ -128,7 +130,7 @@ def build_extension
|
|
128
130
|
have_header("stdint.h")
|
129
131
|
have_func("rb_str_sublen")
|
130
132
|
|
131
|
-
|
133
|
+
if !static_p and !have_library("re2")
|
132
134
|
abort "You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install"
|
133
135
|
end
|
134
136
|
|
@@ -326,14 +328,65 @@ ABSL_LDFLAGS = %w[
|
|
326
328
|
-labsl_time_zone
|
327
329
|
].freeze
|
328
330
|
|
329
|
-
def
|
330
|
-
|
331
|
+
def libflag_to_filename(ldflag)
|
332
|
+
case ldflag
|
333
|
+
when /\A-l(.+)/
|
334
|
+
"lib#{Regexp.last_match(1)}.#{$LIBEXT}"
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
# This method does a number of things to ensure the final shared library
|
339
|
+
# is compiled statically with the vendored libraries:
|
340
|
+
#
|
341
|
+
# 1. For -L<path> flags, ensure that any `ports` paths are prioritized just
|
342
|
+
# in case there are installed libraries that might take precedence.
|
343
|
+
# 2. For -l<lib> flags, convert the library to the static library with a
|
344
|
+
# full path and substitute the absolute static library. For example,
|
345
|
+
# -lre2 maps to /path/to/ports/<arch>/libre2/<version>/lib/libre2.a.
|
346
|
+
#
|
347
|
+
# This is needed because when building the extension, Ruby appears to
|
348
|
+
# insert `-L#{RbConfig::CONFIG['exec_prefix']}/lib` first. If libre2 is
|
349
|
+
# in installed in that location then the extension will link against the
|
350
|
+
# system library instead of the vendored library.
|
351
|
+
def add_flag(arg, lib_paths)
|
352
|
+
case arg
|
353
|
+
when /\A-L(.+)\z/
|
354
|
+
# Prioritize ports' directories
|
355
|
+
lib_dir = Regexp.last_match(1)
|
356
|
+
$LIBPATH =
|
357
|
+
if lib_dir.start_with?(PACKAGE_ROOT_DIR + "/")
|
358
|
+
[lib_dir] | $LIBPATH
|
359
|
+
else
|
360
|
+
$LIBPATH | [lib_dir]
|
361
|
+
end
|
362
|
+
when /\A-l./
|
363
|
+
filename = libflag_to_filename(arg)
|
364
|
+
|
365
|
+
added = false
|
366
|
+
lib_paths.each do |path|
|
367
|
+
static_lib = File.join(path, filename)
|
368
|
+
|
369
|
+
next unless File.exist?(static_lib)
|
370
|
+
|
371
|
+
$LDFLAGS << " " << static_lib
|
372
|
+
added = true
|
373
|
+
break
|
374
|
+
end
|
375
|
+
|
376
|
+
append_ldflags(arg.shellescape) unless added
|
377
|
+
else
|
378
|
+
append_ldflags(arg.shellescape)
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
def add_static_ldflags(flags, lib_paths)
|
383
|
+
static_flags = flags.strip.shellsplit
|
331
384
|
|
332
385
|
if MiniPortile.windows?
|
333
|
-
static_flags.each { |flag|
|
334
|
-
ABSL_LDFLAGS.each { |flag|
|
386
|
+
static_flags.each { |flag| add_flag(flag, lib_paths) unless ABSL_LDFLAGS.include?(flag) }
|
387
|
+
ABSL_LDFLAGS.each { |flag| add_flag(flag, lib_paths) }
|
335
388
|
else
|
336
|
-
static_flags.each { |flag|
|
389
|
+
static_flags.each { |flag| add_flag(flag, lib_paths) }
|
337
390
|
end
|
338
391
|
end
|
339
392
|
|
@@ -371,8 +424,9 @@ def build_with_vendored_libraries
|
|
371
424
|
|
372
425
|
raise 'Unable to run pkg-config --libs --static' unless $?.success?
|
373
426
|
|
374
|
-
|
375
|
-
|
427
|
+
lib_paths = [File.join(abseil_recipe.path, 'lib'), File.join(re2_recipe.path, 'lib')]
|
428
|
+
add_static_ldflags(flags, lib_paths)
|
429
|
+
build_extension(true)
|
376
430
|
end
|
377
431
|
|
378
432
|
if config_system_libraries?
|
data/lib/2.6/re2.bundle
ADDED
Binary file
|
data/lib/2.7/re2.bundle
CHANGED
Binary file
|
data/lib/3.0/re2.bundle
CHANGED
Binary file
|
data/lib/3.1/re2.bundle
CHANGED
Binary file
|
data/lib/3.2/re2.bundle
CHANGED
Binary file
|
data/lib/re2/version.rb
CHANGED
data/re2.gemspec
CHANGED
@@ -5,11 +5,11 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.summary = "Ruby bindings to re2."
|
6
6
|
s.description = 'Ruby bindings to re2, "an efficient, principled regular expression library".'
|
7
7
|
s.version = RE2::VERSION
|
8
|
-
s.authors = ["Paul Mucur"]
|
8
|
+
s.authors = ["Paul Mucur", "Stan Hu"]
|
9
9
|
s.homepage = "https://github.com/mudge/re2"
|
10
10
|
s.extensions = ["ext/re2/extconf.rb"]
|
11
11
|
s.license = "BSD-3-Clause"
|
12
|
-
s.required_ruby_version = ">= 2.
|
12
|
+
s.required_ruby_version = ">= 2.6.0"
|
13
13
|
s.files = [
|
14
14
|
".rspec",
|
15
15
|
"dependencies.yml",
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: re2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta2
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
8
|
+
- Stan Hu
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
12
|
+
date: 2023-09-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake-compiler
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- ext/re2/extconf.rb
|
68
69
|
- ext/re2/re2.cc
|
69
70
|
- ext/re2/recipes.rb
|
71
|
+
- lib/2.6/re2.bundle
|
70
72
|
- lib/2.7/re2.bundle
|
71
73
|
- lib/3.0/re2.bundle
|
72
74
|
- lib/3.1/re2.bundle
|
@@ -96,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
98
|
requirements:
|
97
99
|
- - ">="
|
98
100
|
- !ruby/object:Gem::Version
|
99
|
-
version: '2.
|
101
|
+
version: '2.6'
|
100
102
|
- - "<"
|
101
103
|
- !ruby/object:Gem::Version
|
102
104
|
version: 3.3.dev
|