8000 Backport https://github.com/ruby/ruby/pull/9673 for Ruby 3.3 by hsbt · Pull Request #10350 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Backport https://github.com/ruby/ruby/pull/9673 for Ruby 3.3 #10350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 28, 2024
Prev Previous commit
Next Next commit
Fix gemspec file list for extension gems
So that it also includes requirable features provided by extensions.
  • Loading branch information
deivid-rodriguez authored and hsbt committed Apr 30, 2024
commit 0950d93e774532fb1e28f38363fd3be4fb29687d
28 changes: 23 additions & 5 deletions tool/rbinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -745,26 +745,44 @@ def initialize(gemspec, srcdir, relative_base)
end

def collect
ruby_libraries.sort
libraries.sort
end

class Ext < self
def ruby_libraries
def libraries
# install ext only when it's configured
return [] unless File.exist?("#{makefile_dir}/Makefile")
return [] unless File.exist?(makefile_path)

Dir.glob("lib/**/*.rb", base: makefile_dir)
ruby_libraries + ext_libraries
end

private

def ruby_libraries
Dir.glob("**/*.rb", base: "#{makefile_dir}/lib")
end

def ext_libraries
makefile = File.read(makefile_path)

name = makefile[/^TARGET[ \t]*=[ \t]*((?:.*\\\n)*.*)/, 1]
return [] if name.empty?

feature = makefile[/^DLLIB[ \t]*=[ \t]*((?:.*\\\n)*.*)/, 1]
Array(feature.sub("$(TARGET)", name))
end

def makefile_path
"#{makefile_dir}/Makefile"
end

def makefile_dir
File.expand_path("#{$ext_build_dir}/#{relative_base}", srcdir)
end
end

class Lib < self
def ruby_libraries
def libraries
gemname = File.basename(gemspec, ".gemspec")
base = relative_base || gemname
# for lib/net/net-smtp.gemspec
Expand Down
0