extmk.rb: hacks for bundled gems
* ext/extmk.rb (gems): move dirty hacks for bundled gems from mkmf.rb. * lib/mkmf.rb (create_makefile): yield all configuration strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d8f4c6a5ff
commit
68d5d0f372
@ -1,3 +1,10 @@
|
|||||||
|
Thu Sep 1 14:24:16 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/extmk.rb (gems): move dirty hacks for bundled gems from
|
||||||
|
mkmf.rb.
|
||||||
|
|
||||||
|
* lib/mkmf.rb (create_makefile): yield all configuration strings.
|
||||||
|
|
||||||
Wed Aug 31 17:39:19 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Aug 31 17:39:19 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/extmk.rb (create_makefile): make gem.build_complete file
|
* ext/extmk.rb (create_makefile): make gem.build_complete file
|
||||||
|
22
ext/extmk.rb
22
ext/extmk.rb
@ -569,10 +569,22 @@ FileUtils::makedirs('gems')
|
|||||||
Dir.chdir('gems')
|
Dir.chdir('gems')
|
||||||
extout = $extout
|
extout = $extout
|
||||||
unless gems.empty?
|
unless gems.empty?
|
||||||
|
def self.timestamp_file(name, target_prefix = nil)
|
||||||
|
name = @sodir if name == '$(TARGET_SO_DIR)'
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.create_makefile(*args, &block)
|
def self.create_makefile(*args, &block)
|
||||||
if super(*args, &block)
|
super(*args) do |conf|
|
||||||
open("Makefile", "a") do |mf|
|
conf.find do |s|
|
||||||
mf << %{
|
s.sub!(/^(TARGET_SO_DIR *= *)\$\(RUBYARCHDIR\)/) {
|
||||||
|
$1 + @sodir
|
||||||
|
}
|
||||||
|
end
|
||||||
|
conf << %{
|
||||||
|
|
||||||
|
# default target
|
||||||
|
all:
|
||||||
|
|
||||||
build_complete = $(TARGET_SO_DIR)gem.build_complete
|
build_complete = $(TARGET_SO_DIR)gem.build_complete
|
||||||
install-so: build_complete
|
install-so: build_complete
|
||||||
@ -581,14 +593,12 @@ $(build_complete): $(TARGET_SO)
|
|||||||
$(Q) $(TOUCH) $@
|
$(Q) $(TOUCH) $@
|
||||||
|
|
||||||
}
|
}
|
||||||
end
|
|
||||||
true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
gems.each do |d|
|
gems.each do |d|
|
||||||
$extout = extout.dup
|
$extout = extout.dup
|
||||||
$sodir = "$(extout)/gems/$(arch)/#{d[%r{\A[^/]+}]}"
|
@sodir = "$(extout)/gems/$(arch)/#{d[%r{\A[^/]+}]}"
|
||||||
extmake(d, 'gems')
|
extmake(d, 'gems')
|
||||||
end
|
end
|
||||||
$extout = extout
|
$extout = extout
|
||||||
|
22
lib/mkmf.rb
22
lib/mkmf.rb
@ -2260,11 +2260,8 @@ RULES
|
|||||||
|
|
||||||
dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
|
dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
|
||||||
staticlib = target ? "$(TARGET).#$LIBEXT" : ""
|
staticlib = target ? "$(TARGET).#$LIBEXT" : ""
|
||||||
mfile = open("Makefile", "wb")
|
|
||||||
conf = configuration(srcprefix)
|
conf = configuration(srcprefix)
|
||||||
conf = yield(conf) if block_given?
|
conf << "\
|
||||||
mfile.puts(conf)
|
|
||||||
mfile.print "
|
|
||||||
libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
|
libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
|
||||||
LIBPATH = #{libpath}
|
LIBPATH = #{libpath}
|
||||||
DEFFILE = #{deffile}
|
DEFFILE = #{deffile}
|
||||||
@ -2293,17 +2290,20 @@ STATIC_LIB = #{staticlib unless $static.nil?}
|
|||||||
TIMESTAMP_DIR = #{$extout ? '$(extout)/.timestamp' : '.'}
|
TIMESTAMP_DIR = #{$extout ? '$(extout)/.timestamp' : '.'}
|
||||||
" #"
|
" #"
|
||||||
# TODO: fixme
|
# TODO: fixme
|
||||||
install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
|
install_dirs.each {|d| conf << ("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
|
||||||
sodir = !$extout ? '' :
|
sodir = $extout ? '$(TARGET_SO_DIR)' : '$(RUBYARCHDIR)'
|
||||||
$sodir ? $sodir+target_prefix :
|
|
||||||
'$(RUBYARCHDIR)'
|
|
||||||
n = '$(TARGET_SO_DIR)$(TARGET)'
|
n = '$(TARGET_SO_DIR)$(TARGET)'
|
||||||
mfile.print "
|
conf << "\
|
||||||
TARGET_SO_DIR =#{(sodir && !sodir.empty? ? " #{sodir}/" : '')}
|
TARGET_SO_DIR =#{$extout ? " $(RUBYARCHDIR)/" : ''}
|
||||||
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
||||||
CLEANLIBS = $(TARGET_SO) #{config_string('cleanlibs') {|t| t.gsub(/\$\*/) {n}}}
|
CLEANLIBS = $(TARGET_SO) #{config_string('cleanlibs') {|t| t.gsub(/\$\*/) {n}}}
|
||||||
CLEANOBJS = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, "$(TARGET)#{deffile ? '-$(arch)': ''}")} if target} *.bak
|
CLEANOBJS = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, "$(TARGET)#{deffile ? '-$(arch)': ''}")} if target} *.bak
|
||||||
|
" #"
|
||||||
|
|
||||||
|
conf = yield(conf) if block_given?
|
||||||
|
mfile = open("Makefile", "wb")
|
||||||
|
mfile.puts(conf)
|
||||||
|
mfile.print "
|
||||||
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
|
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
|
||||||
static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{!$extmk ? " install-rb" : ""}"}
|
static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{!$extmk ? " install-rb" : ""}"}
|
||||||
.PHONY: all install static install-so install-rb
|
.PHONY: all install static install-so install-rb
|
||||||
@ -2339,7 +2339,7 @@ static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{!$extmk ? " install-rb" :
|
|||||||
mfile.print "\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n"
|
mfile.print "\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n"
|
||||||
else
|
else
|
||||||
mfile.print "#{f} #{stamp}\n"
|
mfile.print "#{f} #{stamp}\n"
|
||||||
mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} $(RUBYARCHDIR)\n"
|
mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} #{dir}\n"
|
||||||
if defined?($installed_list)
|
if defined?($installed_list)
|
||||||
mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
|
mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user