re2 1.7.0 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Gemfile +13 -0
- data/Rakefile +148 -3
- data/dependencies.yml +9 -0
- data/ext/re2/extconf.rb +318 -57
- data/ext/re2/recipes.rb +43 -0
- data/lib/re2/version.rb +5 -0
- data/lib/re2.rb +8 -1
- data/ports/archives/20230125.3.tar.gz +0 -0
- data/ports/archives/re2-2023-07-01.tar.gz +0 -0
- data/re2.gemspec +43 -0
- metadata +47 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6e122dcf14c604d1cea516e7c6839bddc2144ff2a9ea96f90d4dc874e8f9056
|
4
|
+
data.tar.gz: 1a8e2b6444b9b3702c6e995a59069a681a615242fce804e824c9cd009d515745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8f4ffca57e02a52830c67a2177d509575d435ad1006e2fd5d3b435efecb7412d5507872fde660fb602d1c5cc8416a436719fac31b8d985a263f36e53626955
|
7
|
+
data.tar.gz: 6bc970e290326fb83473e3954e74d4de47a6d23a8200be6eae3a90e6df4a6b671d33cba1be74c456288274a178fa9deebb1aa6de205866bacf4a9ee5436ba5bb
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -1,10 +1,155 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake/extensiontask'
|
2
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'rake_compiler_dock'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
require_relative 'ext/re2/recipes'
|
9
|
+
|
10
|
+
CLEAN.include FileList['**/*{.o,.so,.dylib,.bundle}'],
|
11
|
+
FileList['**/extconf.h'],
|
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
|
28
|
+
|
29
|
+
task gem: :prepare
|
3
30
|
|
4
|
-
|
31
|
+
Gem::PackageTask.new(RE2_GEM_SPEC) do |p|
|
32
|
+
p.need_zip = false
|
33
|
+
p.need_tar = false
|
34
|
+
end
|
35
|
+
|
36
|
+
CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0].join(':')
|
37
|
+
CROSS_RUBY_PLATFORMS = %w[
|
38
|
+
aarch64-linux
|
39
|
+
arm-linux
|
40
|
+
arm64-darwin
|
41
|
+
x64-mingw-ucrt
|
42
|
+
x64-mingw32
|
43
|
+
x86-linux
|
44
|
+
x86-mingw32
|
45
|
+
x86_64-darwin
|
46
|
+
x86_64-linux
|
47
|
+
].freeze
|
48
|
+
|
49
|
+
ENV['RUBY_CC_VERSION'] = CROSS_RUBY_VERSIONS
|
50
|
+
|
51
|
+
Rake::ExtensionTask.new('re2', RE2_GEM_SPEC) do |e|
|
52
|
+
e.cross_compile = true
|
53
|
+
e.cross_config_options << '--enable-cross-build'
|
54
|
+
e.config_options << '--disable-system-libraries'
|
55
|
+
e.cross_platform = CROSS_RUBY_PLATFORMS
|
56
|
+
e.cross_compiling do |spec|
|
57
|
+
spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
|
58
|
+
spec.dependencies.reject! { |dep| dep.name == 'mini_portile2' }
|
59
|
+
end
|
60
|
+
end
|
5
61
|
|
6
62
|
RSpec::Core::RakeTask.new(:spec)
|
7
63
|
|
8
|
-
|
9
|
-
|
64
|
+
namespace 'gem' do
|
65
|
+
def gem_builder(platform)
|
66
|
+
# use Task#invoke because the pkg/*gem task is defined at runtime
|
67
|
+
Rake::Task["native:#{platform}"].invoke
|
68
|
+
Rake::Task["pkg/#{RE2_GEM_SPEC.full_name}-#{Gem::Platform.new(platform)}.gem"].invoke
|
69
|
+
end
|
70
|
+
|
71
|
+
CROSS_RUBY_PLATFORMS.each do |platform|
|
72
|
+
# The Linux x86 image (ghcr.io/rake-compiler/rake-compiler-dock-image:1.3.0-mri-x86_64-linux)
|
73
|
+
# is based on CentOS 7 and has two versions of cmake installed:
|
74
|
+
# a 2.8 version in /usr/bin and a 3.25 in /usr/local/bin. The latter is needed by abseil.
|
75
|
+
cmake =
|
76
|
+
case platform
|
77
|
+
when 'x86_64-linux', 'x86-linux'
|
78
|
+
'/usr/local/bin/cmake'
|
79
|
+
else
|
80
|
+
'cmake'
|
81
|
+
end
|
82
|
+
|
83
|
+
desc "build native gem for #{platform} platform"
|
84
|
+
task platform do
|
85
|
+
RakeCompilerDock.sh <<~SCRIPT, platform: platform, verbose: true
|
86
|
+
gem install bundler --no-document &&
|
87
|
+
bundle &&
|
88
|
+
bundle exec rake gem:#{platform}:builder CMAKE=#{cmake}
|
89
|
+
SCRIPT
|
90
|
+
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
|
+
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
|
+
end
|
114
|
+
|
115
|
+
def gem_build_path
|
116
|
+
File.join 'pkg', RE2_GEM_SPEC.full_name
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_vendored_libraries
|
120
|
+
dependencies = YAML.load_file(File.join(File.dirname(__FILE__), 'dependencies.yml'))
|
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)
|
126
|
+
end
|
127
|
+
|
128
|
+
task gem_build_path do
|
129
|
+
add_vendored_libraries
|
130
|
+
end
|
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
|
10
154
|
|
155
|
+
task default: [:compile, :spec]
|
data/dependencies.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
libre2:
|
2
|
+
version: "2023-07-01"
|
3
|
+
sha256: "18cf85922e27fad3ed9c96a27733037da445f35eb1a2744c306a37c6d11e95c4"
|
4
|
+
# sha-256 hash provided in https://github.com/google/re2/releases/download/2023-07-01/re2-2023-07-01.tar.gz
|
5
|
+
|
6
|
+
abseil:
|
7
|
+
version: "20230125.3"
|
8
|
+
sha256: 5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36
|
9
|
+
# sha-256 hash provided in https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.tar.gz
|
data/ext/re2/extconf.rb
CHANGED
@@ -5,6 +5,107 @@
|
|
5
5
|
# Released under the BSD Licence, please see LICENSE.txt
|
6
6
|
|
7
7
|
require 'mkmf'
|
8
|
+
require_relative 'recipes'
|
9
|
+
|
10
|
+
RE2_HELP_MESSAGE = <<~HELP
|
11
|
+
USAGE: ruby #{$0} [options]
|
12
|
+
|
13
|
+
Flags that are always valid:
|
14
|
+
|
15
|
+
--enable-system-libraries
|
16
|
+
Use system libraries instead of building and using the packaged libraries.
|
17
|
+
|
18
|
+
--disable-system-libraries
|
19
|
+
Use the packaged libraries, and ignore the system libraries. This is the default.
|
20
|
+
|
21
|
+
|
22
|
+
Flags only used when using system libraries:
|
23
|
+
|
24
|
+
Related to re2 library:
|
25
|
+
|
26
|
+
--with-re2-dir=DIRECTORY
|
27
|
+
Look for re2 headers and library in DIRECTORY.
|
28
|
+
|
29
|
+
|
30
|
+
Flags only used when building and using the packaged libraries:
|
31
|
+
|
32
|
+
--enable-cross-build
|
33
|
+
Enable cross-build mode. (You probably do not want to set this manually.)
|
34
|
+
|
35
|
+
|
36
|
+
Environment variables used:
|
37
|
+
|
38
|
+
CC
|
39
|
+
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
|
40
|
+
|
41
|
+
CPPFLAGS
|
42
|
+
If this string is accepted by the C preprocessor, add it to the flags passed to the C preprocessor
|
43
|
+
|
44
|
+
CFLAGS
|
45
|
+
If this string is accepted by the compiler, add it to the flags passed to the compiler
|
46
|
+
|
47
|
+
LDFLAGS
|
48
|
+
If this string is accepted by the linker, add it to the flags passed to the linker
|
49
|
+
|
50
|
+
LIBS
|
51
|
+
Add this string to the flags passed to the linker
|
52
|
+
HELP
|
53
|
+
|
54
|
+
#
|
55
|
+
# utility functions
|
56
|
+
#
|
57
|
+
def config_system_libraries?
|
58
|
+
enable_config("system-libraries", ENV.key?('RE2_USE_SYSTEM_LIBRARIES'))
|
59
|
+
end
|
60
|
+
|
61
|
+
def config_cross_build?
|
62
|
+
enable_config("cross-build")
|
63
|
+
end
|
64
|
+
|
65
|
+
def concat_flags(*args)
|
66
|
+
args.compact.join(" ")
|
67
|
+
end
|
68
|
+
|
69
|
+
def do_help
|
70
|
+
print(RE2_HELP_MESSAGE)
|
71
|
+
exit!(0)
|
72
|
+
end
|
73
|
+
|
74
|
+
def darwin?
|
75
|
+
RbConfig::CONFIG["target_os"].include?("darwin")
|
76
|
+
end
|
77
|
+
|
78
|
+
def windows?
|
79
|
+
RbConfig::CONFIG["target_os"].match?(/mingw|mswin/)
|
80
|
+
end
|
81
|
+
|
82
|
+
def freebsd?
|
83
|
+
RbConfig::CONFIG["target_os"].include?("freebsd")
|
84
|
+
end
|
85
|
+
|
86
|
+
def target_host
|
87
|
+
# We use 'host' to set compiler prefix for cross-compiling. Prefer host_alias over host. And
|
88
|
+
# prefer i686 (what external dev tools use) to i386 (what ruby's configure.ac emits).
|
89
|
+
host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
90
|
+
host.gsub(/i386/, "i686")
|
91
|
+
end
|
92
|
+
|
93
|
+
def target_arch
|
94
|
+
RbConfig::CONFIG['arch']
|
95
|
+
end
|
96
|
+
|
97
|
+
def with_temp_dir
|
98
|
+
Dir.mktmpdir do |temp_dir|
|
99
|
+
Dir.chdir(temp_dir) do
|
100
|
+
yield
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# main
|
107
|
+
#
|
108
|
+
do_help if arg_config('--help')
|
8
109
|
|
9
110
|
if ENV["CC"]
|
10
111
|
RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"]
|
@@ -16,70 +117,57 @@ if ENV["CXX"]
|
|
16
117
|
RbConfig::CONFIG["CXX"] = ENV["CXX"]
|
17
118
|
end
|
18
119
|
|
19
|
-
|
20
|
-
"
|
21
|
-
"/opt/homebrew/include",
|
22
|
-
"/usr/include"
|
23
|
-
]
|
24
|
-
|
25
|
-
lib_dirs = [
|
26
|
-
"/usr/local/lib",
|
27
|
-
"/opt/homebrew/lib",
|
28
|
-
"/usr/lib"
|
29
|
-
]
|
30
|
-
|
31
|
-
dir_config("re2", header_dirs, lib_dirs)
|
120
|
+
def build_extension
|
121
|
+
$CFLAGS << " -Wall -Wextra -funroll-loops"
|
32
122
|
|
33
|
-
|
123
|
+
# Pass -x c++ to force gcc to compile the test program
|
124
|
+
# as C++ (as it will end in .c by default).
|
125
|
+
compile_options = "-x c++"
|
34
126
|
|
35
|
-
|
36
|
-
|
37
|
-
|
127
|
+
have_library("stdc++")
|
128
|
+
have_header("stdint.h")
|
129
|
+
have_func("rb_str_sublen")
|
38
130
|
|
39
|
-
have_library("
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
unless have_library("re2")
|
44
|
-
abort "You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install"
|
45
|
-
end
|
131
|
+
unless have_library("re2")
|
132
|
+
abort "You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install"
|
133
|
+
end
|
46
134
|
|
47
|
-
minimal_program = <<SRC
|
135
|
+
minimal_program = <<SRC
|
48
136
|
#include <re2/re2.h>
|
49
137
|
int main() { return 0; }
|
50
138
|
SRC
|
51
139
|
|
52
|
-
re2_requires_version_flag = checking_for("re2 that requires explicit C++ version flag") do
|
53
|
-
|
54
|
-
end
|
140
|
+
re2_requires_version_flag = checking_for("re2 that requires explicit C++ version flag") do
|
141
|
+
!try_compile(minimal_program, compile_options)
|
142
|
+
end
|
55
143
|
|
56
|
-
if re2_requires_version_flag
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
144
|
+
if re2_requires_version_flag
|
145
|
+
# Recent versions of re2 depend directly on abseil, which requires a
|
146
|
+
# compiler with C++14 support (see
|
147
|
+
# https://github.com/abseil/abseil-cpp/issues/1127 and
|
148
|
+
# https://github.com/abseil/abseil-cpp/issues/1431). However, the
|
149
|
+
# `std=c++14` flag doesn't appear to suffice; we need at least
|
150
|
+
# `std=c++17`.
|
151
|
+
abort "Cannot compile re2 with your compiler: recent versions require C++14 support." unless %w[c++20 c++17 c++11 c++0x].any? do |std|
|
152
|
+
checking_for("re2 that compiles with #{std} standard") do
|
153
|
+
if try_compile(minimal_program, compile_options + " -std=#{std}")
|
154
|
+
compile_options << " -std=#{std}"
|
155
|
+
$CPPFLAGS << " -std=#{std}"
|
68
156
|
|
69
|
-
|
157
|
+
true
|
158
|
+
end
|
70
159
|
end
|
71
160
|
end
|
72
161
|
end
|
73
|
-
end
|
74
162
|
|
75
|
-
# Determine which version of re2 the user has installed.
|
76
|
-
# Revision d9f8806c004d added an `endpos` argument to the
|
77
|
-
# generic Match() function.
|
78
|
-
#
|
79
|
-
# To test for this, try to compile a simple program that uses
|
80
|
-
# the newer form of Match() and set a flag if it is successful.
|
81
|
-
checking_for("RE2::Match() with endpos argument") do
|
82
|
-
|
163
|
+
# Determine which version of re2 the user has installed.
|
164
|
+
# Revision d9f8806c004d added an `endpos` argument to the
|
165
|
+
# generic Match() function.
|
166
|
+
#
|
167
|
+
# To test for this, try to compile a simple program that uses
|
168
|
+
# the newer form of Match() and set a flag if it is successful.
|
169
|
+
checking_for("RE2::Match() with endpos argument") do
|
170
|
+
test_re2_match_signature = <<SRC
|
83
171
|
#include <re2/re2.h>
|
84
172
|
|
85
173
|
int main() {
|
@@ -91,13 +179,13 @@ int main() {
|
|
91
179
|
}
|
92
180
|
SRC
|
93
181
|
|
94
|
-
|
95
|
-
|
182
|
+
if try_compile(test_re2_match_signature, compile_options)
|
183
|
+
$defs.push("-DHAVE_ENDPOS_ARGUMENT")
|
184
|
+
end
|
96
185
|
end
|
97
|
-
end
|
98
186
|
|
99
|
-
checking_for("RE2::Set::Match() with error information") do
|
100
|
-
|
187
|
+
checking_for("RE2::Set::Match() with error information") do
|
188
|
+
test_re2_set_match_signature = <<SRC
|
101
189
|
#include <vector>
|
102
190
|
#include <re2/re2.h>
|
103
191
|
#include <re2/set.h>
|
@@ -115,9 +203,182 @@ int main() {
|
|
115
203
|
}
|
116
204
|
SRC
|
117
205
|
|
118
|
-
|
119
|
-
|
206
|
+
if try_compile(test_re2_set_match_signature, compile_options)
|
207
|
+
$defs.push("-DHAVE_ERROR_INFO_ARGUMENT")
|
208
|
+
end
|
120
209
|
end
|
121
210
|
end
|
122
211
|
|
212
|
+
def process_recipe(recipe)
|
213
|
+
cross_build_p = config_cross_build?
|
214
|
+
message "Cross build is #{cross_build_p ? "enabled" : "disabled"}.\n"
|
215
|
+
|
216
|
+
recipe.host = target_host
|
217
|
+
# Ensure x64-mingw-ucrt and x64-mingw32 use different library paths since the host
|
218
|
+
# is the same (x86_64-w64-mingw32).
|
219
|
+
recipe.target = File.join(recipe.target, target_arch) if cross_build_p
|
220
|
+
|
221
|
+
yield recipe
|
222
|
+
|
223
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
224
|
+
name = recipe.name
|
225
|
+
version = recipe.version
|
226
|
+
|
227
|
+
if File.exist?(checkpoint)
|
228
|
+
message("Building re2 with a packaged version of #{name}-#{version}.\n")
|
229
|
+
else
|
230
|
+
message(<<~EOM)
|
231
|
+
---------- IMPORTANT NOTICE ----------
|
232
|
+
Building re2 with a packaged version of #{name}-#{version}.
|
233
|
+
Configuration options: #{recipe.configure_options.shelljoin}
|
234
|
+
EOM
|
235
|
+
|
236
|
+
unless recipe.patch_files.empty?
|
237
|
+
message("The following patches are being applied:\n")
|
238
|
+
|
239
|
+
recipe.patch_files.each do |patch|
|
240
|
+
message(" - %s\n" % File.basename(patch))
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# Use a temporary base directory to reduce filename lengths since
|
245
|
+
# Windows can hit a limit of 250 characters (CMAKE_OBJECT_PATH_MAX).
|
246
|
+
with_temp_dir { recipe.cook }
|
247
|
+
|
248
|
+
FileUtils.touch(checkpoint)
|
249
|
+
end
|
250
|
+
|
251
|
+
recipe.activate
|
252
|
+
end
|
253
|
+
|
254
|
+
def build_with_system_libraries
|
255
|
+
header_dirs = [
|
256
|
+
"/usr/local/include",
|
257
|
+
"/opt/homebrew/include",
|
258
|
+
"/usr/include"
|
259
|
+
]
|
260
|
+
|
261
|
+
lib_dirs = [
|
262
|
+
"/usr/local/lib",
|
263
|
+
"/opt/homebrew/lib",
|
264
|
+
"/usr/lib"
|
265
|
+
]
|
266
|
+
|
267
|
+
dir_config("re2", header_dirs, lib_dirs)
|
268
|
+
|
269
|
+
build_extension
|
270
|
+
end
|
271
|
+
|
272
|
+
# pkgconf v1.9.3 on Windows incorrectly sorts the output of `pkg-config
|
273
|
+
# --libs --static`, resulting in build failures: https://github.com/pkgconf/pkgconf/issues/268.
|
274
|
+
# To work around the issue, store the correct order of abseil flags here and add them manually
|
275
|
+
# for Windows.
|
276
|
+
#
|
277
|
+
# Note that `-ldbghelp` is incorrectly added before `-labsl_symbolize` in abseil:
|
278
|
+
# https://github.com/abseil/abseil-cpp/issues/1497
|
279
|
+
ABSL_LDFLAGS = %w[
|
280
|
+
-labsl_flags
|
281
|
+
-labsl_flags_internal
|
282
|
+
-labsl_flags_marshalling
|
283
|
+
-labsl_flags_reflection
|
284
|
+
-labsl_flags_private_handle_accessor
|
285
|
+
-labsl_flags_commandlineflag
|
286
|
+
-labsl_flags_commandlineflag_internal
|
287
|
+
-labsl_flags_config
|
288
|
+
-labsl_flags_program_name
|
289
|
+
-labsl_cord
|
290
|
+
-labsl_cordz_info
|
291
|
+
-labsl_cord_internal
|
292
|
+
-labsl_cordz_functions
|
293
|
+
-labsl_cordz_handle
|
294
|
+
-labsl_crc_cord_state
|
295
|
+
-labsl_crc32c
|
296
|
+
-labsl_crc_internal
|
297
|
+
-labsl_crc_cpu_detect
|
298
|
+
-labsl_hash
|
299
|
+
-labsl_city
|
300
|
+
-labsl_bad_variant_access
|
301
|
+
-labsl_low_level_hash
|
302
|
+
-labsl_raw_hash_set
|
303
|
+
-labsl_hashtablez_sampler
|
304
|
+
-labsl_exponential_biased
|
305
|
+
-labsl_bad_optional_access
|
306
|
+
-labsl_str_format_internal
|
307
|
+
-labsl_synchronization
|
308
|
+
-labsl_graphcycles_internal
|
309
|
+
-labsl_stacktrace
|
310
|
+
-labsl_symbolize
|
311
|
+
-ldbghelp
|
312
|
+
-labsl_debugging_internal
|
313
|
+
-labsl_demangle_internal
|
314
|
+
-labsl_malloc_internal
|
315
|
+
-labsl_time
|
316
|
+
-labsl_civil_time
|
317
|
+
-labsl_strings
|
318
|
+
-labsl_strings_internal
|
319
|
+
-ladvapi32
|
320
|
+
-labsl_base
|
321
|
+
-labsl_spinlock_wait
|
322
|
+
-labsl_int128
|
323
|
+
-labsl_throw_delegate
|
324
|
+
-labsl_raw_logging_internal
|
325
|
+
-labsl_log_severity
|
326
|
+
-labsl_time_zone
|
327
|
+
].freeze
|
328
|
+
|
329
|
+
def add_static_ldflags(flags)
|
330
|
+
static_flags = flags.split
|
331
|
+
|
332
|
+
if MiniPortile.windows?
|
333
|
+
static_flags.each { |flag| append_ldflags(flag) unless ABSL_LDFLAGS.include?(flag) }
|
334
|
+
ABSL_LDFLAGS.each { |flag| append_ldflags(flag) }
|
335
|
+
else
|
336
|
+
static_flags.each { |flag| append_ldflags(flag) }
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
def build_with_vendored_libraries
|
341
|
+
message "Building re2 using packaged libraries.\n"
|
342
|
+
|
343
|
+
abseil_recipe, re2_recipe = load_recipes
|
344
|
+
|
345
|
+
process_recipe(abseil_recipe) do |recipe|
|
346
|
+
recipe.configure_options += ['-DABSL_PROPAGATE_CXX_STD=ON', '-DCMAKE_CXX_VISIBILITY_PRESET=hidden']
|
347
|
+
end
|
348
|
+
|
349
|
+
process_recipe(re2_recipe) do |recipe|
|
350
|
+
recipe.configure_options += ["-DCMAKE_PREFIX_PATH=#{abseil_recipe.path}", '-DCMAKE_CXX_FLAGS=-DNDEBUG',
|
351
|
+
'-DCMAKE_CXX_VISIBILITY_PRESET=hidden']
|
352
|
+
end
|
353
|
+
|
354
|
+
dir_config("re2", File.join(re2_recipe.path, 'include'), File.join(re2_recipe.path, 'lib'))
|
355
|
+
dir_config("abseil", File.join(abseil_recipe.path, 'include'), File.join(abseil_recipe.path, 'lib'))
|
356
|
+
|
357
|
+
pkg_config_paths = [
|
358
|
+
"#{abseil_recipe.path}/lib/pkgconfig",
|
359
|
+
"#{re2_recipe.path}/lib/pkgconfig"
|
360
|
+
].join(File::PATH_SEPARATOR)
|
361
|
+
|
362
|
+
pkg_config_paths = "#{ENV['PKG_CONFIG_PATH']}#{File::PATH_SEPARATOR}#{pkg_config_paths}" if ENV['PKG_CONFIG_PATH']
|
363
|
+
|
364
|
+
ENV['PKG_CONFIG_PATH'] = pkg_config_paths
|
365
|
+
pc_file = File.join(re2_recipe.path, 'lib', 'pkgconfig', 're2.pc')
|
366
|
+
|
367
|
+
raise 'Please install the `pkg-config` utility!' unless find_executable('pkg-config')
|
368
|
+
|
369
|
+
# See https://bugs.ruby-lang.org/issues/18490, broken in Ruby 3.1 but fixed in Ruby 3.2.
|
370
|
+
flags = xpopen(['pkg-config', '--libs', '--static', pc_file], err: %i[child out], &:read)
|
371
|
+
|
372
|
+
raise 'Unable to run pkg-config --libs --static' unless $?.success?
|
373
|
+
|
374
|
+
add_static_ldflags(flags)
|
375
|
+
build_extension
|
376
|
+
end
|
377
|
+
|
378
|
+
if config_system_libraries?
|
379
|
+
build_with_system_libraries
|
380
|
+
else
|
381
|
+
build_with_vendored_libraries
|
382
|
+
end
|
383
|
+
|
123
384
|
create_makefile("re2")
|
data/ext/re2/recipes.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PACKAGE_ROOT_DIR = File.expand_path('../..', __dir__)
|
2
|
+
REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.4' # keep this version in sync with the one in the gemspec
|
3
|
+
|
4
|
+
def build_recipe(name, version)
|
5
|
+
require 'rubygems'
|
6
|
+
gem('mini_portile2', REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
|
7
|
+
require 'mini_portile2'
|
8
|
+
|
9
|
+
MiniPortileCMake.new(name, version).tap do |recipe|
|
10
|
+
recipe.target = File.join(PACKAGE_ROOT_DIR, 'ports')
|
11
|
+
recipe.configure_options += [
|
12
|
+
# abseil needs a C++14 compiler
|
13
|
+
'-DCMAKE_CXX_STANDARD=17',
|
14
|
+
# needed for building the C extension shared library with -fPIC
|
15
|
+
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
|
16
|
+
# ensures pkg-config and installed libraries will be in lib, not lib64
|
17
|
+
'-DCMAKE_INSTALL_LIBDIR=lib'
|
18
|
+
]
|
19
|
+
|
20
|
+
yield recipe
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def load_recipes
|
25
|
+
require 'yaml'
|
26
|
+
dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, 'dependencies.yml'))
|
27
|
+
|
28
|
+
abseil_recipe = build_recipe('abseil', dependencies['abseil']['version']) do |recipe|
|
29
|
+
recipe.files = [{
|
30
|
+
url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/#{recipe.version}.tar.gz",
|
31
|
+
sha256: dependencies['abseil']['sha256']
|
32
|
+
}]
|
33
|
+
end
|
34
|
+
|
35
|
+
re2_recipe = build_recipe('libre2', dependencies['libre2']['version']) do |recipe|
|
36
|
+
recipe.files = [{
|
37
|
+
url: "https://github.com/google/re2/releases/download/#{recipe.version}/re2-#{recipe.version}.tar.gz",
|
38
|
+
sha256: dependencies['libre2']['sha256']
|
39
|
+
}]
|
40
|
+
end
|
41
|
+
|
42
|
+
[abseil_recipe, re2_recipe]
|
43
|
+
end
|
data/lib/re2/version.rb
ADDED
data/lib/re2.rb
CHANGED
@@ -3,5 +3,12 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2010-2014, Paul Mucur (http://mudge.name)
|
5
5
|
# Released under the BSD Licence, please see LICENSE.txt
|
6
|
-
|
6
|
+
begin
|
7
|
+
::RUBY_VERSION =~ /(\d+\.\d+)/
|
8
|
+
require_relative "#{Regexp.last_match(1)}/re2.so"
|
9
|
+
rescue LoadError
|
10
|
+
require 're2.so'
|
11
|
+
end
|
12
|
+
|
7
13
|
require "re2/scanner"
|
14
|
+
require "re2/version"
|
Binary file
|
Binary file
|
data/re2.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'lib/re2/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "re2"
|
5
|
+
s.summary = "Ruby bindings to re2."
|
6
|
+
s.description = 'Ruby bindings to re2, "an efficient, principled regular expression library".'
|
7
|
+
s.version = RE2::VERSION
|
8
|
+
s.authors = ["Paul Mucur"]
|
9
|
+
s.homepage = "https://github.com/mudge/re2"
|
10
|
+
s.extensions = ["ext/re2/extconf.rb"]
|
11
|
+
s.license = "BSD-3-Clause"
|
12
|
+
s.required_ruby_version = ">= 2.7.0"
|
13
|
+
s.files = [
|
14
|
+
".rspec",
|
15
|
+
"dependencies.yml",
|
16
|
+
"ext/re2/extconf.rb",
|
17
|
+
"ext/re2/re2.cc",
|
18
|
+
"ext/re2/recipes.rb",
|
19
|
+
"Gemfile",
|
20
|
+
"lib/re2.rb",
|
21
|
+
"lib/re2/scanner.rb",
|
22
|
+
"lib/re2/string.rb",
|
23
|
+
"lib/re2/version.rb",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"re2.gemspec"
|
28
|
+
]
|
29
|
+
s.test_files = [
|
30
|
+
"spec/spec_helper.rb",
|
31
|
+
"spec/re2_spec.rb",
|
32
|
+
"spec/kernel_spec.rb",
|
33
|
+
"spec/re2/regexp_spec.rb",
|
34
|
+
"spec/re2/match_data_spec.rb",
|
35
|
+
"spec/re2/string_spec.rb",
|
36
|
+
"spec/re2/set_spec.rb",
|
37
|
+
"spec/re2/scanner_spec.rb"
|
38
|
+
]
|
39
|
+
s.add_development_dependency "rake-compiler", "~> 1.2.1"
|
40
|
+
s.add_development_dependency "rake-compiler-dock", "~> 1.3.0"
|
41
|
+
s.add_development_dependency("rspec", "~> 3.2")
|
42
|
+
s.add_runtime_dependency("mini_portile2", "~> 2.8.4") # keep version in sync with extconf.rb
|
43
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: re2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.2.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake-compiler-dock
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,21 +52,43 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mini_portile2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.8.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.8.4
|
41
69
|
description: Ruby bindings to re2, "an efficient, principled regular expression library".
|
42
|
-
email:
|
70
|
+
email:
|
43
71
|
executables: []
|
44
72
|
extensions:
|
45
73
|
- ext/re2/extconf.rb
|
46
74
|
extra_rdoc_files: []
|
47
75
|
files:
|
76
|
+
- ".rspec"
|
77
|
+
- Gemfile
|
48
78
|
- LICENSE.txt
|
49
79
|
- README.md
|
50
80
|
- Rakefile
|
81
|
+
- dependencies.yml
|
51
82
|
- ext/re2/extconf.rb
|
52
83
|
- ext/re2/re2.cc
|
84
|
+
- ext/re2/recipes.rb
|
53
85
|
- lib/re2.rb
|
54
86
|
- lib/re2/scanner.rb
|
55
87
|
- lib/re2/string.rb
|
88
|
+
- lib/re2/version.rb
|
89
|
+
- ports/archives/20230125.3.tar.gz
|
90
|
+
- ports/archives/re2-2023-07-01.tar.gz
|
91
|
+
- re2.gemspec
|
56
92
|
- spec/kernel_spec.rb
|
57
93
|
- spec/re2/match_data_spec.rb
|
58
94
|
- spec/re2/regexp_spec.rb
|
@@ -65,7 +101,7 @@ homepage: https://github.com/mudge/re2
|
|
65
101
|
licenses:
|
66
102
|
- BSD-3-Clause
|
67
103
|
metadata: {}
|
68
|
-
post_install_message:
|
104
|
+
post_install_message:
|
69
105
|
rdoc_options: []
|
70
106
|
require_paths:
|
71
107
|
- lib
|
@@ -73,15 +109,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
109
|
requirements:
|
74
110
|
- - ">="
|
75
111
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
112
|
+
version: 2.7.0
|
77
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
114
|
requirements:
|
79
|
-
- - "
|
115
|
+
- - ">"
|
80
116
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
117
|
+
version: 1.3.1
|
82
118
|
requirements: []
|
83
119
|
rubygems_version: 3.4.10
|
84
|
-
signing_key:
|
120
|
+
signing_key:
|
85
121
|
specification_version: 4
|
86
122
|
summary: Ruby bindings to re2.
|
87
123
|
test_files:
|