mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
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:
2 files changed
+16
-2
No files matched your search
+15
-1
@@ -132,6 +132,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
|
||||
@@ -544,7 +552,13 @@ extend Module.new {
|
||||
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/[^/]+(?=/))) {
|
||||
|
||||
@@ -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) { \
|
||||
|
||||
Reference in new issue
Block a user