Skip to content

Commit

Permalink
Use dir_config to specify re2 and abseil paths
Browse files Browse the repository at this point in the history
This fixes an issue where the re2 headers could not be found when
building the gem locally. It appears `pkg_config` doesn't use
PKG_CONFIG_PATH unless the library has been registered with
`dir_config` in the first place.
  • Loading branch information
stanhu committed Jul 16, 2023
1 parent bfa7ebe commit aa0bdb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/re2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ def build_with_vendored_libraries
recipe.configure_options += ["-DCMAKE_PREFIX_PATH=#{abseil_recipe.path}", '-DCMAKE_CXX_FLAGS=-DNDEBUG']
end

dir_config("re2", File.join(re2_recipe.path, 'include'), File.join(re2_recipe.path, 'lib'))
dir_config("abseil", File.join(abseil_recipe.path, 'include'), File.join(abseil_recipe.path, 'lib'))

pkg_config_paths = [
"#{abseil_recipe.path}/lib/pkgconfig",
"#{re2_recipe.path}/lib/pkgconfig"
Expand All @@ -359,7 +362,7 @@ def build_with_vendored_libraries
ENV['PKG_CONFIG_PATH'] = pkg_config_paths
pc_file = File.join(re2_recipe.path, 'lib', 'pkgconfig', 're2.pc')

raise 'Please install the `pkg-config` utility!' unless pkg_config('re2')
raise 'Please install the `pkg-config` utility!' unless find_executable('pkg-config')

# See https://bugs.ruby-lang.org/issues/18490, broken in Ruby 3.1 but fixed in Ruby 3.2.
flags = xpopen(['pkg-config', '--libs', '--static', pc_file], err: %i[child out], &:read)
Expand Down

0 comments on commit aa0bdb6

Please sign in to comment.