From af88ca4c076cde9a23ee68281994e1b443cf4e9b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 22 Mar 2024 14:09:12 +0900 Subject: [PATCH] Match `--with/--without` options against gem names The simple names in `default_exclude_exts` do not match extension paths under gems. Extract each gem name from the gemspec file at the top level of each gem directory. For example, if `ext` is `syslog-0.1.2/ext/syslog/`, find out `syslog-0.1.2/syslog.gemspec` and take the base name `syslog` without the suffix `.gemspec`. --- ext/extmk.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/extmk.rb b/ext/extmk.rb index ffd64209ae..6c7c7aeab7 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -517,6 +517,12 @@ cond = proc {|ext, *| incl, excl = Dir.glob("#{e}/**/extconf.rb", base: "#$top_srcdir/#{ext_prefix}").collect {|d| File.dirname(d) }.partition {|ext| + if @gemname + ext = ext[%r[\A[^/]+]] # extract gem name + Dir.glob("*.gemspec", base: "#$top_srcdir/#{ext_prefix}/#{ext}") do |g| + break ext = g if ext.start_with?("#{g.chomp!(".gemspec")}-") + end + end with_config(ext, &cond) } incl.sort!