mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) ae8990aef0
: [Backport #20183] (#10310)
Alias init functions The extension library has each initialization function named "Init_" + basename. If multiple extensions have the same base name (such as cgi/escape and erb/escape), the same function will be registered for both names. To fix this conflict, rename the initialization functions under sub directories using using parent names, when statically linking.
This commit is contained in:
parent
05787897f6
commit
a406c51668
2 changed files with 16 additions and 2 deletions
16
ext/extmk.rb
16
ext/extmk.rb
|
@ -132,6 +132,14 @@ def extract_makefile(makefile, keep = true)
|
||||||
true
|
true
|
||||||
end
|
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)
|
def extmake(target, basedir = 'ext', maybestatic = true)
|
||||||
FileUtils.mkpath target unless File.directory?(target)
|
FileUtils.mkpath target unless File.directory?(target)
|
||||||
begin
|
begin
|
||||||
|
@ -545,7 +553,13 @@ extend Module.new {
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_makefile(*args, &block)
|
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|
|
super(*args) do |conf|
|
||||||
conf.find do |s|
|
conf.find do |s|
|
||||||
s.sub!(%r(^(srcdir *= *)\$\(top_srcdir\)/\.bundle/gems/[^/]+(?=/))) {
|
s.sub!(%r(^(srcdir *= *)\$\(top_srcdir\)/\.bundle/gems/[^/]+(?=/))) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%# -*- C -*-
|
%# -*- C -*-
|
||||||
% extinits = ARGV.map {|n| [n[%r[[^/.]+(?=\.[^/]*)?\z]], n]}
|
% extinits = ARGV.map {|n| [n.tr('/', '_'), n]}
|
||||||
#include "ruby/ruby.h"
|
#include "ruby/ruby.h"
|
||||||
|
|
||||||
#define init(func, name) { \
|
#define init(func, name) { \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue