File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1111gem 'libv8-node' , MiniRacer ::LIBV8_NODE_VERSION
1212require 'libv8-node'
1313
14+ # Fix for missing aarch64-linux-musl gem in libv8-node
15+ # On some platforms (like ARM64 Alpine), the musl-specific gem might be missing.
16+ # We fallback to the glibc gem's directory if the musl one isn't found.
17+ if RUBY_PLATFORM . include? ( 'musl' )
18+ module Libv8 ::Node ::Paths
19+ def self . platform
20+ @platform ||= begin
21+ # Replicate libv8-node's platform detection logic without side effects
22+ detected_platform = Gem ::Platform . local . dup
23+ if detected_platform . version . nil?
24+ detected_platform . instance_eval { @version = 'musl' }
25+ end
26+
27+ platform_name = detected_platform . to_s . gsub ( /-darwin-?\d +/ , '-darwin' )
28+
29+ # If the musl-specific directory is missing, try falling back to glibc
30+ unless File . exist? ( File . join ( vendored_source_path , platform_name ) )
31+ fallback = platform_name . gsub ( '-musl' , '' )
32+ if File . exist? ( File . join ( vendored_source_path , fallback ) )
33+ platform_name = fallback
34+ end
35+ end
36+
37+ platform_name
38+ end
39+ end
40+ end
41+ end
42+
1443IS_DARWIN = RUBY_PLATFORM =~ /darwin/
1544
1645have_library ( 'pthread' )
You can’t perform that action at this time.
0 commit comments