From 385321e52f2a4ad894ee09ebce6f41773f045d89 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Sun, 30 Oct 2022 01:21:16 +0900 Subject: [PATCH] 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. --- ext/libv8-node/paths.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/libv8-node/paths.rb b/ext/libv8-node/paths.rb index 79abbc0..522c0a1 100644 --- a/ext/libv8-node/paths.rb +++ b/ext/libv8-node/paths.rb @@ -20,7 +20,7 @@ def object_paths end def platform - Gem::Platform.local.to_s.gsub(/-darwin-?\d+/, '-darwin') + Gem::Platform.local.to_s.sub(/-darwin\K-?\d+|-linux\K-gnu\z/, '') end def config