summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-09 08:48:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-09 08:48:55 +0000
commitff9c34b3f410bb41c78d9220c738be86fe8474a7 (patch)
tree10f195e2dd3061fbbf71adde43cd34b934e0d2e6 /lib
parent77c6657723608f373247eff78e04f36b2b4ed59b (diff)
* Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub, configure.in,
runruby.rb: run rdoc, test and so on with compiled extension libraries. [ruby-dev:22688] * ext/extmk.rb, lib/mkmf.rb: make extension libraries in separated directory, similar to the actual directory structure. * lib/fileutils.rb (FileUtils.copy_file): use the mode of the original file to create new file. * lib/rdoc/ri/ri_paths.rb (RI::Paths::SYSDIR): get rid of unexpected influence by envirionment variable. * bcc32/configure.bat, win32/configure.bat: add install-doc options. * win32/win32.c, win32/win32.h (rb_w32_fstat): fix Borland C runtime bug which returns wrong mode. [ruby-dev:22846] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/fileutils.rb2
-rw-r--r--lib/mkmf.rb83
-rw-r--r--lib/rdoc/ri/ri_paths.rb8
3 files changed, 55 insertions, 38 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index d34e6fec4b..f888681685 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -406,7 +406,7 @@ module FileUtils
#
def copy_file(src, dest)
File.open(src, 'rb') {|r|
- File.open(dest, 'wb') {|w|
+ File.open(dest, 'wb', r.stat.mode) {|w|
copy_stream r, w
}
}
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index d3076f40d3..99f8307aef 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -82,10 +82,15 @@ if not $extmk and File.exist? Config::CONFIG["archdir"] + "/ruby.h"
elsif File.exist? $srcdir + "/ruby.h"
$hdrdir = $srcdir
else
- warn "can't find header files for ruby."
- exit 1
+ abort "can't find header files for ruby."
+end
+if File.exist?($hdrdir + "/config.h")
+ $topdir = $hdrdir
+elsif File.exist?((compile_dir = Config::CONFIG['compile_dir']) + "/config.h")
+ $topdir = compile_dir
+else
+ abort "can't find header files for ruby."
end
-$topdir = $hdrdir
OUTFLAG = CONFIG['OUTFLAG']
CPPOUTFILE = CONFIG['CPPOUTFILE']
@@ -414,7 +419,7 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
ifiles.each do |files, dir, prefix|
dir = map_dir(dir, map)
prefix = %r|\A#{Regexp.quote(prefix)}/?| if prefix
- if( files[0,2] == "./" )
+ if /\A\.\// =~ files
# install files which are in current working directory.
files = files[2..-1]
len = nil
@@ -751,7 +756,7 @@ arch = #{CONFIG['arch']}
sitearch = #{CONFIG['sitearch']}
ruby_version = #{Config::CONFIG['ruby_version']}
RUBY = #{$ruby}
-RM = $(RUBY) -run -e rm -- -f
+RM = #{config_string('RM') || '$(RUBY) -run -e rm -- -f'}
MAKEDIRS = $(RUBY) -run -e mkdir -- -p
INSTALL_PROG = $(RUBY) -run -e install -- -vpm 0755
INSTALL_DATA = $(RUBY) -run -e install -- -vpm 0644
@@ -772,7 +777,7 @@ INSTALL_DATA = $(RUBY) -run -e install -- -vpm 0644
end
def dummy_makefile(srcdir)
- configuration(srcdir) << "all install: Makefile\n" << CLEANINGS
+ configuration(srcdir) << "all install install-so install-rb: Makefile\n" << CLEANINGS
end
def create_makefile(target, srcprefix = nil)
@@ -794,6 +799,8 @@ def create_makefile(target, srcprefix = nil)
target_prefix = ""
end
+ $outdir_prefix = $outdir ? "$(outdir)$(target_prefix)/" : ""
+
srcprefix ||= '$(srcdir)'
Config::expand(srcdir = srcprefix.dup)
@@ -841,6 +848,8 @@ DEFFILE = #{deffile}
CLEANFILES = #{$cleanfiles.join(' ')}
DISTCLEANFILES = #{$distcleanfiles.join(' ')}
+outdir = #{$outdir.sub(/#{Regexp.quote($topdir)}/, '$(topdir)') if $outdir}
+outdir_prefix = #{$outdir_prefix}
target_prefix = #{target_prefix}
LOCAL_LIBS = #{$LOCAL_LIBS}
LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
@@ -849,7 +858,13 @@ TARGET = #{target}
DLLIB = #{dllib}
STATIC_LIB = #{staticlib}
}
- if $extmk
+ if $outdir
+ mfile.print %{
+RUBYCOMMONDIR = $(outdir)
+RUBYLIBDIR = $(outdir)$(target_prefix)
+RUBYARCHDIR = $(outdir)/$(arch)$(target_prefix)
+}
+ elsif $extmk
mfile.print %{
RUBYCOMMONDIR = $(rubylibdir)
RUBYLIBDIR = $(rubylibdir)$(target_prefix)
@@ -863,43 +878,51 @@ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
}
end
mfile.print %{
-CLEANLIBS = "$(TARGET).{lib,exp,il?,tds,map}" $(DLLIB)
-CLEANOBJS = "*.{#{$OBJEXT},#{$LIBEXT},s[ol],pdb,bak}"
+CLEANLIBS = #{$outdir_prefix}$(TARGET).*
+CLEANOBJS = *.#{$OBJEXT} *.#{$LIBEXT} *.s[ol] *.pdb *.bak
-all: #{target ? "$(DLLIB)" : "Makefile"}
+all: #{target ? $outdir ? "install" : "$(DLLIB)" : "Makefile"}
static: $(STATIC_LIB)
+
}
mfile.print CLEANINGS
dirs = []
+ mfile.print "install: install-so install-rb\n\n"
if not $static and target
dirs << (dir = "$(RUBYARCHDIR)")
- mfile.print("install: #{dir}\n")
+ mfile.print("install-so: #{dir}\n")
f = "$(DLLIB)"
dest = "#{dir}/#{f}"
- mfile.print "install: #{dest}\n"
- mfile.print "#{dest}: #{f} #{dir}\n\t@$(INSTALL_PROG) #{f} #{dir}\n"
+ mfile.print "install-so: #{dest}\n"
+ unless $outdir
+ mfile.print "#{dest}: #{f}\n\t@$(INSTALL_PROG) #{f} #{dir}\n"
+ end
end
+ dirs << (dir = "$(RUBYLIBDIR)")
+ mfile.print("install-rb: #{dir}\n")
for i in [[["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]], $INSTALLFILES]
files = install_files(mfile, i, nil, srcprefix) or next
for dir, *files in files
unless dirs.include?(dir)
dirs << dir
- mfile.print("install: #{dir}\n")
+ mfile.print "install-rb: #{dir}\n"
end
files.each do |f|
dest = "#{dir}/#{File.basename(f)}"
- mfile.print("install: #{dest}\n")
- mfile.print("#{dest}: #{f} #{dir}\n\t@$(INSTALL_DATA) #{f} #{dir}\n")
+ mfile.print("install-rb: #{dest}\n")
+ mfile.print("#{dest}: #{f}\n\t@$(INSTALL_DATA) #{f} #{dir}\n")
end
end
end
- if dirs.empty?
- mfile.print("install:\n")
- else
- dirs.each {|dir| mfile.print "#{dir}:\n\t@$(MAKEDIRS) #{dir}\n"}
- end
+ dirs.each {|dir| mfile.print "#{dir}:\n\t@$(MAKEDIRS) $@\n"}
+
+ mfile.print <<-SITEINSTALL
- mfile.print "\nsite-install: install\n\n"
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+ SITEINSTALL
return unless target
@@ -919,13 +942,11 @@ static: $(STATIC_LIB)
end
end
- if makedef
- mfile.print "$(DLLIB): $(OBJS) $(DEFFILE)\n\t"
- else
- mfile.print "$(DLLIB): $(OBJS)\n\t"
- end
+ mfile.print "$(RUBYARCHDIR)/" if $outdir
+ mfile.print "$(DLLIB): ", (makedef ? "$(DEFFILE) " : ""), "$(OBJS)\n\t"
mfile.print "@-$(RM) $@\n\t"
mfile.print "@-$(RM) $(TARGET).lib\n\t" if $mswin
+ mfile.print "@-$(MAKEDIRS) $(@D)\n\t"
mfile.print LINK_SO, "\n\n"
mfile.print "$(STATIC_LIB): $(OBJS)\n\t"
mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)"
@@ -970,7 +991,7 @@ def init_mkmf(config = CONFIG)
$LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
$LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']
$LIBPATH = CROSS_COMPILING ? [] : ["$(libdir)"]
- $LIBPATH.unshift("$(topdir)") if $extmk
+ $LIBPATH.unshift("$(topdir)") if $extmk or CROSS_COMPILING
$INSTALLFILES = nil
$objs = nil
@@ -984,6 +1005,8 @@ def init_mkmf(config = CONFIG)
$cleanfiles = []
$distcleanfiles = []
+ $outdir ||= nil
+
dir_config("opt")
end
@@ -1032,9 +1055,9 @@ TRY_LINK = config_string('TRY_LINK') ||
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
LINK_SO = config_string('LINK_SO') ||
if CONFIG["DLEXT"] == $OBJEXT
- "ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)\n"
+ "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
else
- "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB) " \
+ "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$@ " \
"$(OBJS) $(LOCAL_LIBS) $(LIBS)"
end
LIBPATHFLAG = config_string('LIBPATHFLAG') || " -L'%s'"
diff --git a/lib/rdoc/ri/ri_paths.rb b/lib/rdoc/ri/ri_paths.rb
index 32c2542c04..ff8257a546 100644
--- a/lib/rdoc/ri/ri_paths.rb
+++ b/lib/rdoc/ri/ri_paths.rb
@@ -29,13 +29,7 @@ module RI
version = Config::CONFIG['ruby_version']
base = File.join(Config::CONFIG['datadir'], "ri", version)
-
- if ENV["DESTDIR"]
- SYSDIR = File.join(ENV["DESTDIR"], base, "system")
- else
- SYSDIR = File.join(base, "system")
- end
-
+ SYSDIR = File.join(base, "system")
SITEDIR = File.join(base, "site")
homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH']