diff --git a/ext/extmk.rb b/ext/extmk.rb index 939eb735659bee..81ab9ce8a51eb4 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -136,6 +136,14 @@ def extract_makefile(makefile, keep = true) true end +def create_makefile(target, srcprefix = nil) + if $static and target.include?("/") + base = File.basename(target) + $defs << "-DInit_#{base}=Init_#{target.tr('/', '_')}" + end + super +end + def extmake(target, basedir = 'ext', maybestatic = true) FileUtils.mkpath target unless File.directory?(target) begin @@ -546,7 +554,13 @@ def configuration(srcdir) end def create_makefile(*args, &block) - return super unless @gemname + unless @gemname + if $static and (target = args.first).include?("/") + base = File.basename(target) + $defs << "-DInit_#{base}=Init_#{target.tr('/', '_')}" + end + return super + end super(*args) do |conf| conf.find do |s| s.sub!(%r(^(srcdir *= *)\$\(top_srcdir\)/\.bundle/gems/[^/]+(?=/))) { diff --git a/template/extinit.c.tmpl b/template/extinit.c.tmpl index 7a9c910633bae3..e0b076b03c8c9b 100644 --- a/template/extinit.c.tmpl +++ b/template/extinit.c.tmpl @@ -1,5 +1,5 @@ %# -*- C -*- -% extinits = ARGV.map {|n| [n[%r[[^/.]+(?=\.[^/]*)?\z]], n]} +% extinits = ARGV.map {|n| [n.tr('/', '_'), n]} #include "ruby/ruby.h" #define init(func, name) { \ diff --git a/version.h b/version.h index a0460419fd146c..9a904de7b3ea08 100644 --- a/version.h +++ b/version.h @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 5 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 258 +#define RUBY_PATCHLEVEL 259 #define RUBY_RELEASE_YEAR 2024 #define RUBY_RELEASE_MONTH 5