Skip to content

Commit 385321e

Browse files
committed
Fix Libv8::Node::Paths with RubyGems >=3.3.21 on *-linux-gnu platforms
RubyGems 3.3.21 changed the value format of `Gem::Platform.local` for Ruby configured with `*-linux-gnu` as the platform name. ```console $ ruby -ve 'p Gem::VERSION; p Gem::Platform.local.to_s' ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux-gnu] "3.3.20" "x86_64-linux" $ ruby -ve 'p Gem::VERSION; p Gem::Platform.local.to_s' ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux-gnu] "3.3.21" "x86_64-linux-gnu" $ ruby -ve 'p Gem::VERSION; p Gem::Platform.local.to_s' ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux-gnu] "3.3.24" "x86_64-linux-gnu" ``` As you can see, it now has the `-gnu` prefix and `Libv8::Node::Paths.object_paths` thus has it when the built binary actually lives in the directory `x86_64-linux`, breaking the build of the gems like mini_racer on those platforms. [`RUBY_TARGET_PLATFORM` is set to `*-linux`](https://github.com/knu/libv8-node/blob/ad9105562185571f7b486f7770986f6a160318b2/libexec/platform#L28-L29), so `Libv8::Node::Paths.platform` needs to align with that.
1 parent ad91055 commit 385321e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/libv8-node/paths.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def object_paths
2020
end
2121

2222
def platform
23-
Gem::Platform.local.to_s.gsub(/-darwin-?\d+/, '-darwin')
23+
Gem::Platform.local.to_s.sub(/-darwin\K-?\d+|-linux\K-gnu\z/, '')
2424
end
2525

2626
def config

0 commit comments

Comments
 (0)