re2 2.0.0.beta1-aarch64-linux → 2.0.0.beta2-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6066f6fa54c37c502d32dd991c46940f4a3644421a96815126afa586091d12ca
4
- data.tar.gz: d212a28622556f1d27dec9ba0cad97b131748db450aa708dd2b46e343737ad4b
3
+ metadata.gz: c2edf7938d05f8ec4dc255c31d9bf3ed126783d6395b970eab6cd4245e79f00e
4
+ data.tar.gz: b9348aa1b76138030ea2da10de1cfa268c98ceaa629d8b9202a782589d55dbb4
5
5
  SHA512:
6
- metadata.gz: '0644603528ffb29f8fd33947f7eda18ddc010a8d4436097f49fda18c10ea8633deeda4f47f049d9dc675facd7d90dc524f0b5487085536b36b1bd1dbc83aa356'
7
- data.tar.gz: 4be164edf49d5adb4e47dd375fece16846af72cacd934319dd2261751040d1b2f4791e02052e386e73eeb4218c95dbda7dcfaa2c4c3e725ce0c99ea71dfba13a
6
+ metadata.gz: ba9c81773fcb4a7dca3efa5ad850509b8354f00386788395855f3cb56548f4efa116a26ea66013b8862112ca652503c16bd3751ae7261d01e68a796d06543d78
7
+ data.tar.gz: 06a6e14c8866fa7da53d7da89e6190e936af5488393b5a934a6ab5f627cdcff1def57fbdd3deccca164f9ae5fdba8e5ddc526323c7a987fc3136117f160ee36d
data/Gemfile CHANGED
@@ -2,12 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- rake_constraint = if RUBY_VERSION < "1.9.3"
6
- "< 11.0.0"
7
- elsif RUBY_VERSION < "2.0.0"
8
- "< 12.0.0"
9
- else
10
- "> 12.3.2"
11
- end
12
-
13
- gem "rake", rake_constraint
5
+ gem "rake", "> 12.3.2"
data/README.md CHANGED
@@ -4,17 +4,33 @@ re2 [![Build Status](https://github.com/mudge/re2/actions/workflows/tests.yml/ba
4
4
  A Ruby binding to [re2][], an "efficient, principled regular expression
5
5
  library".
6
6
 
7
- **Current version:** 1.7.0
8
- **Supported Ruby versions:** 1.8.7, 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2
7
+ **Current version:** 2.0.0.beta1
8
+ **Supported Ruby versions:** 2.7, 3.0, 3.1, 3.2
9
+ **Bundled re2 version:** libre2.11 (2023-09-01)
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
- You will need [re2][] installed as well as a C++ compiler such as [gcc][] (on
15
- Debian and Ubuntu, this is provided by the [build-essential][] package). If
16
- you are using Mac OS X, I recommend installing re2 with [Homebrew][] by
17
- running the following:
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 [clang](http://clang.llvm.org/) 3.4 or [gcc](https://gcc.gnu.org/) 5.
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` or `gem
32
- install re2 -- --with-re2-dir=/path/to/re2/prefix` if re2 is not installed in
33
- any of the following default locations:
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` and for contributing support for libre2.11 (2023-07-01);
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-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
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
- unless have_library("re2")
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 add_static_ldflags(flags)
330
- static_flags = flags.split
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| append_ldflags(flag) unless ABSL_LDFLAGS.include?(flag) }
334
- ABSL_LDFLAGS.each { |flag| append_ldflags(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| append_ldflags(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
- add_static_ldflags(flags)
375
- build_extension
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.so ADDED
Binary file
data/lib/2.7/re2.so CHANGED
Binary file
data/lib/3.0/re2.so CHANGED
Binary file
data/lib/3.1/re2.so CHANGED
Binary file
data/lib/3.2/re2.so CHANGED
Binary file
data/lib/re2/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RE2
4
- VERSION = "2.0.0.beta1"
4
+ VERSION = "2.0.0.beta2"
5
5
  end
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.7.0"
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.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: aarch64-linux
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-07 00:00:00.000000000 Z
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.so
70
72
  - lib/2.7/re2.so
71
73
  - lib/3.0/re2.so
72
74
  - lib/3.1/re2.so
@@ -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.7'
101
+ version: '2.6'
100
102
  - - "<"
101
103
  - !ruby/object:Gem::Version
102
104
  version: 3.3.dev