re2 2.4.3 → 2.12.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.
data/Rakefile CHANGED
@@ -1,40 +1,23 @@
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 'yaml'
5
+ require 'rspec/core/rake_task'
7
6
 
8
7
  require_relative 'ext/re2/recipes'
9
8
 
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
9
+ re2_gemspec = Gem::Specification.load('re2.gemspec')
10
+ abseil_recipe, re2_recipe = load_recipes
28
11
 
29
- task gem: :prepare
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
- Gem::PackageTask.new(RE2_GEM_SPEC) do |p|
32
- p.need_zip = false
33
- p.need_tar = false
34
- end
17
+ re2_gemspec.files << abseil_archive
18
+ re2_gemspec.files << re2_archive
35
19
 
36
- CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':')
37
- CROSS_RUBY_PLATFORMS = %w[
20
+ cross_platforms = %w[
38
21
  aarch64-linux
39
22
  arm-linux
40
23
  arm64-darwin
@@ -46,13 +29,15 @@ CROSS_RUBY_PLATFORMS = %w[
46
29
  x86_64-linux
47
30
  ].freeze
48
31
 
49
- ENV['RUBY_CC_VERSION'] = CROSS_RUBY_VERSIONS
32
+ ENV['RUBY_CC_VERSION'] = %w[3.3.0 3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':')
33
+
34
+ Gem::PackageTask.new(re2_gemspec).define
50
35
 
51
- Rake::ExtensionTask.new('re2', RE2_GEM_SPEC) do |e|
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 = CROSS_RUBY_PLATFORMS
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,45 @@ end
61
46
 
62
47
  RSpec::Core::RakeTask.new(:spec)
63
48
 
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
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
- 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"
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
86
69
  gem install bundler --no-document &&
87
70
  bundle &&
88
- bundle exec rake gem:#{platform}:builder CMAKE=#{cmake}
71
+ bundle exec rake native:#{platform} pkg/#{re2_gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
89
72
  SCRIPT
90
73
  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
74
  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
75
  end
114
76
 
115
- def gem_build_path
116
- File.join 'pkg', RE2_GEM_SPEC.full_name
77
+ # Set up file tasks for Abseil and RE2's archives so they are automatically
78
+ # downloaded when required by the gem task.
79
+ file abseil_archive do
80
+ abseil_recipe.download
117
81
  end
118
82
 
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)
83
+ file re2_archive do
84
+ re2_recipe.download
126
85
  end
127
86
 
128
- task gem_build_path do
129
- add_vendored_libraries
130
- end
87
+ task default: :spec
131
88
 
132
- task default: [:compile, :spec]
89
+ CLEAN.add("lib/**/*.{o,so,bundle}", "pkg")
90
+ CLOBBER.add("ports")
data/dependencies.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  libre2:
3
- version: '2023-11-01'
4
- sha256: 4e6593ac3c71de1c0f322735bc8b0492a72f66ffccfad76e259fa21c41d27d8a
3
+ version: '2024-06-01'
4
+ sha256: 7326c74cddaa90b12090fcfc915fe7b4655723893c960ee3c2c66e85c5504b6c
5
5
  abseil:
6
- version: '20230802.1'
7
- sha256: 987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed
6
+ version: '20240116.2'
7
+ sha256: 733726b8c3a6d39a4120d7e45ea8b41a434cdacde401cba500f14236c49b39dc