Skip to content

Commit

Permalink
Fix Libv8::Node::Paths with RubyGems >=3.3.21 on *-linux-gnu platforms
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
knu committed Oct 29, 2022
1 parent ad91055 commit 385321e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/libv8-node/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 385321e

Please sign in to comment.