Skip to content

Commit a5998ba

Browse files
Merge pull request #477 from ruby/mvh-fix-shipit
Fix sassc: copy libsass into ext dir when Ruby >= 4.1
2 parents f05aa62 + 9aa80cf commit a5998ba

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

benchmarks/shipit/benchmark.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,25 @@
55
ENV['SHIPIT_DISABLE_AUTH'] = '1' # Saves us lots of trouble
66

77
Dir.chdir __dir__
8+
89
use_gemfile
910

11+
# sassc uses FFI with hardcoded paths to find its compiled libsass shared object.
12+
# RubyGems 4.x (Ruby 4.1+) no longer copies extensions into the gem's lib/ tree,
13+
# so sassc can't find it. Copy it into place.
14+
if RUBY_VERSION >= "4.1"
15+
spec = Gem::Specification.find_by_name("sassc") rescue nil
16+
if spec
17+
dl_ext = RbConfig::MAKEFILE_CONFIG['DLEXT']
18+
target = File.join(spec.gem_dir, "ext", "libsass.#{dl_ext}")
19+
source = File.join(spec.extension_dir, "sassc", "libsass.#{dl_ext}")
20+
if !File.exist?(target) && File.exist?(source)
21+
require 'fileutils'
22+
FileUtils.cp(source, target)
23+
end
24+
end
25+
end
26+
1027
require 'securerandom'
1128
ENV['SECRET_KEY_BASE'] = SecureRandom.hex(128)
1229

0 commit comments

Comments
 (0)