summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog21
-rw-r--r--bcc32/Makefile.sub22
-rw-r--r--ext/extmk.rb9
-rw-r--r--instruby.rb148
-rw-r--r--lib/mkmf.rb3
-rw-r--r--win32/Makefile.sub8
6 files changed, 130 insertions, 81 deletions
diff --git a/ChangeLog b/ChangeLog
index a50d025278..fa14d763ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+Tue Oct 22 10:13:05 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * instruby.rb: add dryrun mode.
+
+ * ext/extmk.rb (extmake): avoid Borland make's quirk behavior.
+
+ * lib/mkmf.rb (link_command): opt is not a makefile macro.
+
+ * bcc32/Makefile.sub ($(LIBRUBY_SO) $(LIBRUBY)): EXTOBJS were not
+ linked.
+
+ * bcc32/Makefile.sub (ext/extinit.obj): missing.
+
+ * bcc32/Makefile.sub (TRY_LINK): options have to place before any
+ non-option arguments.
+
+ * win32/Makefile.sub (TRY_LINK): need -link and -libpath options.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub (RANLIB): logical
+ operator never work with command.com.
+
Tue Oct 22 00:59:59 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* configure.in (RUBY_CPPOUTFILE): fix cache file bug.
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index bfed3231df..1c6611c382 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -110,7 +110,7 @@ STACK = 0x2000000
XCFLAGS =
-ARFLAGS = /a
+ARFLAGS = /a
LD = ilink32 -q -Gn
LDSHARED = $(LD)
XLDFLAGS = -Tpe c0x32.obj
@@ -137,7 +137,9 @@ LIBRUBY_SO = $(RUBY_SO_NAME).dll
LIBRUBY = $(RUBY_SO_NAME).lib
LIBRUBYARG = $(LIBRUBY)
+!ifndef EXTOBJS
EXTOBJS = dmyext.obj
+!endif
MAINOBJ = main.obj
WINMAINOBJ = winmain.obj
@@ -285,7 +287,7 @@ s,@CFLAGS@,$(CFLAGS),;t t
s,@CPPFLAGS@,$(CPPFLAGS),;t t
s,@CXXFLAGS@,$(CXXFLAGS),;t t
s,@FFLAGS@,$(FFLAGS),;t t
-s,@LDFLAGS@,$(LDFLAGS),;t t
+s,@LDFLAGS@,,;t t
s,@LIBS@,$(LIBS),;t t
s,@exec_prefix@,$${prefix},;t t
s,@prefix@,,;t t
@@ -320,9 +322,9 @@ s,@target_os@,$(OS),;t t
s,@CC@,$(CC),;t t
s,@CPP@,cpp32,;t t
s,@YACC@,$(YACC),;t t
-s,@RANLIB@,rem,;t t
+s,@RANLIB@,,;t t
s,@AR@,$(AR),;t t
-s,@ARFLAGS@,$(ARFLAGS),;t t
+s,@ARFLAGS@,$(ARFLAGS) ,;t t
s,@LN_S@,$(LN_S),;t t
s,@SET_MAKE@,$(SET_MAKE),;t t
s,@LIBOBJS@, acosh.obj crypt.obj win32.obj,;t t
@@ -367,6 +369,7 @@ s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: .%s.%s:,;t t
s,@COMMON_LIBS@,m,;t t
s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN;t t
s,@COMMON_HEADERS@,winsock2.h windows.h,;t t
+s,@TRY_LINK@,$$(CC) -oconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(LIBPATH) $$(LDFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS),;t t
s,@EXPORT_PREFIX@,_,;t t
s,@arch@,$(ARCH)-$(OS),;t t
s,@sitearch@,$(ARCH)-$(OS),;t t
@@ -389,20 +392,20 @@ $(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(RUBYW_INSTALL_NAME).res
$(LIBRUBY_A): $(OBJS)
@-if exist $@ del $@
- $(AR) $(ARFLAGS)$@ $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
# $(LIBRUBY): $(LIBRUBY_SO)
# implib $@ $(LIBRUBY_SO)
-$(LIBRUBY_SO) $(LIBRUBY): $(LIBRUBY_A) dmyext.obj $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
+$(LIBRUBY_SO) $(LIBRUBY): $(LIBRUBY_A) $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
@echo $(EXTOBJS)
- $(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) dmyext.obj,$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res
+ $(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) $(EXTOBJS:/=\),$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res
$(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
$(MINIRUBY) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A)
install: rbconfig.rb
- $(MINIRUBY) $(srcdir)instruby.rb $(DESTDIR)
+ $(MINIRUBY) $(srcdir)instruby.rb -$(MFLAGS)$(MAKEFLAGS) $(DESTDIR)
$(MINIRUBY) $(srcdir)ext/extmk.rb $(MAKE) -$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR) install
clean: clean-ext clean-local
@@ -495,6 +498,9 @@ $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
parse.c: parse.y
+ext/extinit.obj: ext/extinit.c $(SETUP)
+ $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
+
acosh.obj: acosh.c win32.h
alloca.obj: alloca.c win32.h
crypt.obj: crypt.c win32.h
diff --git a/ext/extmk.rb b/ext/extmk.rb
index ebe562c7d4..5bb32f5843 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -200,9 +200,12 @@ if $extlist.size > 0
if RUBY_PLATFORM =~ /m68k-human|beos/
$extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
end
- conf = ['SETUP='+$setup, 'EXTOBJS='+$extobjs.strip]
- conf << 'EXTLIBS='+$extlibs.strip if $extlibs
- conf << 'EXTLDFLAGS='+$extflags.strip if $extflags
+ conf = [
+ ['SETUP', $setup], ['EXTOBJS', $extobjs],
+ ['EXTLIBS', $extlibs], ['EXTLDFLAGS', $extflags]
+ ].map {|n, v|
+ "#{n}=#{v}" if v and !(v = v.strip).empty?
+ }.compact
puts conf
ARGV.concat(conf)
end
diff --git a/instruby.rb b/instruby.rb
index 26f97db0da..557a81b03f 100644
--- a/instruby.rb
+++ b/instruby.rb
@@ -4,96 +4,114 @@ load "./rbconfig.rb"
include Config
File.umask(0)
-destdir = ARGV[0] || ''
+
+while arg = ARGV.shift
+ case arg
+ when /^--/ # ignore
+ when /^-/
+ $dryrun = /n/ =~ arg
+ when /=/ # ignore
+ else
+ destdir ||= arg
+ break
+ end
+end
+destdir ||= ''
$:.unshift CONFIG["srcdir"]+"/lib"
-require "ftools"
-require "find"
+require 'ftools'
-exeext = CONFIG["EXEEXT"]
-if ENV["prefix"]
- prefix = ENV["prefix"]
-else
- prefix = CONFIG["prefix"]
+class Installer < File; end
+class << Installer
+ if $dryrun
+ def makedirs(*dirs)
+ String === dirs.last or dirs.pop
+ for dir in dirs
+ File.directory?(dir) or print "mkdir -p #{dir}\n"
+ end
+ end
+ def install(file, dir, mode = nil, verbose = false)
+ to = catname(file, dir)
+ unless FileTest.exist? to and cmp file, to
+ print "install#{' -m %#o'%mode if mode} #{file} #{dir}\n"
+ end
+ end
+ def makelink(orig, link, verbose = false)
+ unless File.symlink?(link) and File.readlink(link) == orig
+ print "ln -sf #{orig} #{link}\n"
+ end
+ end
+ else
+ require "ftools"
+ def makelink(orig, link, verbose = false)
+ if exist? link
+ delete link
+ end
+ symlink orig, link
+ print "link #{orig} -> #{link}\n"
+ end
+ end
end
+exeext = CONFIG["EXEEXT"]
+
ruby_install_name = CONFIG["ruby_install_name"]
-version = "/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
-arch = "/"+CONFIG["arch"]
-sitearch = "/"+CONFIG["sitearch"]
+rubyw_install_name = CONFIG["rubyw_install_name"]
+version = CONFIG["ruby_version"]
bindir = destdir+CONFIG["bindir"]
libdir = destdir+CONFIG["libdir"]
-rubylibdir = destdir+CONFIG["prefix"]+"/lib/ruby"+version
-archlibdir = rubylibdir+arch
-sitelibdir = destdir+CONFIG["sitedir"]+version
-sitearchlibdir = sitelibdir+sitearch
+rubylibdir = destdir+CONFIG["rubylibdir"]
+archlibdir = destdir+CONFIG["archdir"]
+sitelibdir = destdir+CONFIG["sitelibdir"]
+sitearchlibdir = destdir+CONFIG["sitearchdir"]
mandir = destdir+CONFIG["mandir"] + "/man1"
-wdir = Dir.getwd
-
-File.makedirs bindir, true
-File.install ruby_install_name+exeext,
- "#{bindir}/#{ruby_install_name}#{exeext}", 0755, true
-rubyw = ruby_install_name.sub(/ruby/, '\&w')+exeext
-if File.exist? rubyw
- File.install rubyw, "#{bindir}/#{rubyw}", 0755, true
-end
-for dll in Dir['*.dll']
- File.install dll, "#{bindir}/#{dll}", 0755, true
+dll = CONFIG["LIBRUBY_SO"]
+lib = CONFIG["LIBRUBY"]
+arc = CONFIG["LIBRUBY_A"]
+
+Installer.makedirs bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir, true
+
+Installer.install ruby_install_name+exeext, bindir+"/"+ruby_install_name+exeext, 0755, true
+if rubyw_install_name and !rubyw_install_name.empty?
+ Installer.install rubyw_install_name+exeext, bindir, 0755, true
end
-File.makedirs libdir, true
-if CONFIG["LIBRUBY"] != CONFIG["LIBRUBY_A"]
- for lib in [CONFIG["LIBRUBY"]]
- if File.exist? lib
- File.install lib, libdir, 0555, true
- end
+Installer.install dll, bindir, 0755, true unless dll == lib
+Installer.install lib, libdir, 0555, true unless lib == arc
+Installer.install arc, archlibdir, 0644, true
+Installer.install "config.h", archlibdir, 0644, true
+Installer.install "rbconfig.rb", archlibdir, 0644, true
+if CONFIG["ARCHFILE"]
+ for file in CONFIG["ARCHFILE"].split
+ Installer.install file, archlibdir, 0644, true
end
end
-Dir.chdir libdir
-if File.exist? CONFIG["LIBRUBY_SO"]
+
+if dll == lib and dll != arc
for link in CONFIG["LIBRUBY_ALIASES"].split
- if File.exist? link
- File.delete link
- end
- File.symlink CONFIG["LIBRUBY_SO"], link
- print "link #{CONFIG['LIBRUBY_SO']} -> #{link}\n"
+ Installer.makelink(dll, File.join(libdir, link), true)
end
end
-Dir.chdir wdir
-File.makedirs rubylibdir, true
-File.makedirs archlibdir, true
-File.makedirs sitelibdir, true
-File.makedirs sitearchlibdir, true
-
-if RUBY_PLATFORM =~ /-aix/
- File.install "ruby.imp", archlibdir, 0644, true
-end
-
-system "#{CONFIG['MINIRUBY']} #{CONFIG['srcdir']}/ext/extmk.rb install #{destdir}"
Dir.chdir CONFIG["srcdir"]
-File.install "sample/irb.rb", "#{bindir}/irb", 0755, true
+Installer.install "sample/irb.rb", "#{bindir}/irb", 0755, true
-Find.find("lib") do |f|
- next unless /\.rb$/ =~ f || /help-message$/ =~ f
- dir = rubylibdir+"/"+File.dirname(f[4..-1])
- File.makedirs dir, true unless File.directory? dir
- File.install f, dir, 0644, true
+Dir.glob("lib/*{.rb,help-message}") do |f|
+ dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
+ Installer.makedirs dir, true unless File.directory? dir
+ Installer.install f, dir, 0644, true
end
for f in Dir["*.h"]
- File.install f, archlibdir, 0644, true
+ Installer.install f, archlibdir, 0644, true
end
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
- File.makedirs archlibdir + "/win32", true
- File.install "win32/win32.h", archlibdir + "/win32", 0644, true
+ Installer.makedirs archlibdir + "/win32", true
+ Installer.install "win32/win32.h", archlibdir + "/win32", 0644, true
end
-File.install wdir+'/'+CONFIG['LIBRUBY_A'], archlibdir, 0644, true
-File.makedirs mandir, true
-File.install "ruby.1", mandir+"/"+ruby_install_name+".1", 0644, true
-Dir.chdir wdir
-File.install "config.h", archlibdir, 0644, true
-File.install "rbconfig.rb", archlibdir, 0644, true
+Installer.makedirs mandir, true
+Installer.install "ruby.1", mandir+"/"+ruby_install_name+".1", 0644, true
+
# vi:set sw=2:
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index a4ddda06d2..5616425281 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -206,7 +206,7 @@ def link_command(ldflags, opt="", libpath=$LIBPATH)
'LDFLAGS' => "#$LDFLAGS #{ldflags}",
'LIBPATH' => libpathflag(libpath),
'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
- 'LIBS' => "#$LIBRUBYARG ${opt} #$LIBS")
+ 'LIBS' => "#$LIBRUBYARG #{opt} #$LIBS")
end
def cc_command(opt="")
@@ -750,6 +750,7 @@ DISTCLEANFILES =
end
mfile.print "$(DLLIB): $(OBJS)\n\t"
+ mfile.print "@-$(RM) $@\n\t"
if $static
mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$(DLLIB) $(OBJS)"
if ranlib = config_string('RANLIB')
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 653aad32a8..f3dbe38cf7 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -317,9 +317,9 @@ s,@target_os@,$(OS),;t t
s,@CC@,$(CC),;t t
s,@CPP@,$(CPP),;t t
s,@YACC@,$(YACC),;t t
-s,@RANLIB@,rem,;t t
+s,@RANLIB@,,;t t
s,@AR@,$(AR),;t t
-s,@ARFLAGS@,$(ARFLAGS):,;t t
+s,@ARFLAGS@,$(ARFLAGS),;t t
s,@LN_S@,$(LN_S),;t t
s,@SET_MAKE@,$(SET_MAKE),;t t
s,@LIBOBJS@, acosh.obj crypt.obj win32.obj isinf.obj isnan.obj,;t t
@@ -361,7 +361,7 @@ s,@LINK_SO@,$$(LDSHARED) -Fe$$(@) $$(OBJS) $$(LIBS) $$(LOCAL_LIBS) $$(DLDFLAGS),
s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c -Tc$$(<:\=/),;t t
s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -c -Tp$$(<:\=/),;t t
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: .%s.%s:,;t t
-s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) $$(LDFLAGS) $$(XLDFLAGS),;t t
+s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) -link $$(LDFLAGS) $$(LIBPATH) $$(XLDFLAGS),;t t
s,@COMMON_LIBS@,m,;t t
s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN;t t
s,@COMMON_HEADERS@,winsock2.h windows.h,;t t
@@ -405,7 +405,7 @@ $(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
$(AR) $(ARFLAGS)$@ -def:$<
install: rbconfig.rb
- $(MINIRUBY) $(srcdir)/instruby.rb $(DESTDIR)
+ $(MINIRUBY) $(srcdir)/instruby.rb -$(MFLAGS)$(MAKEFLAGS) $(DESTDIR)
$(MINIRUBY) $(srcdir)/ext/extmk.rb $(MAKE) -$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR) install
clean: clean-ext clean-local