summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog20
-rw-r--r--Makefile.in49
-rw-r--r--bcc32/Makefile.sub60
-rw-r--r--bcc32/configure.bat49
-rw-r--r--configure.in11
-rw-r--r--ext/extmk.rb107
-rw-r--r--lib/fileutils.rb2
-rw-r--r--lib/mkmf.rb83
-rw-r--r--lib/rdoc/ri/ri_paths.rb8
-rwxr-xr-xrunruby.rb50
-rw-r--r--win32/Makefile.sub62
-rwxr-xr-xwin32/configure.bat28
-rw-r--r--win32/win32.c18
-rw-r--r--win32/win32.h2
14 files changed, 453 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e590a4cf6..52f1d8bee1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Mon Feb 9 17:46:07 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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]
+
Mon Feb 9 16:30:12 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (detach_process_watcher): return the last status.
diff --git a/Makefile.in b/Makefile.in
index e3257c06d9..93fcdbd4db 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -17,10 +17,17 @@ bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
libexecdir = @libexecdir@
+datadir = @datadir@
arch = @arch@
sitearch = @sitearch@
sitedir = @sitedir@
+TESTUI = console
+TESTS =
+
+EXTOUT = .ext
+RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
+
CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
@@ -40,6 +47,8 @@ EXEEXT = @EXEEXT@
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
RUBY = $(RUBY_INSTALL_NAME)
MINIRUBY = @MINIRUBY@
+RUNRUBY = @RUNRUBY@
+EXTCONF = extconf.rb
#### End of system configuration section. ####
@@ -109,18 +118,23 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
--make="$(MAKE)" \
--mflags="$(MFLAGS)" \
--make-flags="$(MAKEFLAGS)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension="$(EXTS)" --extstatic="$(EXTSTATIC)"
all: @MAKEFILES@ miniruby$(EXEEXT) rbconfig.rb $(LIBRUBY)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic="$(EXTSTATIC)" $(SCRIPT_ARGS)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(DMYEXT)
@rm -f $@
- $(PURIFY) $(CC) $(LDFLAGS) $(MAINLIBS) $(MAINOBJ) $(DMYEXT) $(LIBRUBY_A) $(LIBS) -o $@
+ $(PURIFY) $(CC) $(LDFLAGS) $(MAINLIBS) $(MAINOBJ) $(LIBRUBY_A) $(LIBS) -o $@
$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) $(SETUP) miniruby$(EXEEXT)
@rm -f $@
$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
+static-ruby: $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A)
+ @rm -f $(STATICRUBY)
+ $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A) $(LIBS) -o $(STATICRUBY)
+
# We must `rm' the library each time this rule is invoked because "updating" a
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
# supported.
@@ -140,21 +154,29 @@ ruby.imp: $(LIBRUBY_A)
# $(MINIRUBY) $< $@
install: install-nodoc @RDOCTARGET@
+install-all: install-nodoc install-doc
-install-nodoc: rbconfig.rb
+install-nodoc: install-local install-ext
+install-local: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
- $(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install
+install-ext: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
-what-where no-install: rbconfig.rb
+what-where-all no-install-all: no-install no-install-doc
+what-where no-install: no-install-local no-install-ext
+what-where-local: no-install-local
+no-install-local: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
- $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install
+what-where-ext: no-install-ext
+no-install-ext: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(EXTMK_ARGS) install
-install-doc:
+install-doc: $(PROGRAM)
@echo Generating RDoc documentation
- $(bindir)/$(PROGRAM) $(srcdir)/bin/rdoc --all --ri-system $(srcdir)
+ $(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
clean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) clean 2> /dev/null || true
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) clean 2> /dev/null || true
clean-local:
@rm -f $(OBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY_ALIASES)
@@ -164,7 +186,7 @@ clean-local:
clean: clean-ext clean-local
distclean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) distclean 2> /dev/null || true
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) distclean 2> /dev/null || true
distclean-local: clean-local
@rm -f @MAKEFILES@ config.h rbconfig.rb
@@ -180,6 +202,13 @@ realclean: distclean
test: miniruby$(EXEEXT) rbconfig.rb $(PROGRAM) PHONY
@./miniruby$(EXEEXT) $(srcdir)/rubytest.rb
+test-all:
+ $(RUNRUBY) -C "$(srcdir)/test" runner.rb --runner=$(TESTUI) $(TESTS)
+
+extconf:
+ $(MINIRUBY) -run -e mkdir -- -p "$(EXTCONFDIR)"
+ $(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
+
rbconfig.rb: miniruby$(EXEEXT) $(srcdir)/mkconfig.rb config.status $(PREP)
@$(MINIRUBY) $(srcdir)/mkconfig.rb rbconfig.rb
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index 5c2a744d31..7c748ce478 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -91,9 +91,27 @@ exec_prefix = $(prefix)
!ifndef libdir
libdir = $(exec_prefix)/lib
!endif
+!if !defined(datadir)
+datadir = $(prefix)/share
+!endif
!ifndef DESTDIR
DESTDIR = $(prefix)
!endif
+!ifndef EXTOUT
+EXTOUT = .ext
+!endif
+!ifndef RIDATADIR
+RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
+!endif
+!ifndef TESTUI
+TESTUI = console
+!endif
+!ifndef TESTS
+TESTS =
+!endif
+!ifndef RDOCTARGET
+RDOCTARGET = install-doc
+!endif
!ifndef CFLAGS
CFLAGS = -q $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w-
!endif
@@ -135,6 +153,8 @@ PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_SO_NAME).def
MINIRUBY = .\miniruby$(EXEEXT)
+RUNRUBY = .\ruby$(EXEEXT) "$(srcdir)runruby.rb" --extout="$(EXTOUT)" --
+EXTCONF = extconf.rb
ORGLIBPATH = $(LIB)
@@ -194,10 +214,11 @@ SCRIPT_ARGS = "--dest-dir=$(DESTDIR)" \
"--make=$(MAKE)" \
"--mflags=$(MFLAGS)" \
"--make-flags=$(MAKEFLAGS)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension="$(EXTS)" --extstatic="$(EXTSTATIC)"
all: miniruby$(EXEEXT) rbconfig.rb \
$(LIBRUBY) $(MISCLIBS)
- .\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb --extstatic=$(EXTSTATIC) $(SCRIPT_ARGS)
+ @$(MINIRUBY) $(srcdir)ext/extmk.rb $(EXTMK_ARGS)
ruby: $(PROGRAM)
rubyw: $(WPROGRAM)
@@ -400,9 +421,9 @@ s,@srcdir@,$(srcdir),;t t
s,@top_srcdir@,$(srcdir),;t t
|
-miniruby$(EXEEXT): $(LIBRUBY_A) $(MAINOBJ) dmyext.obj
+miniruby$(EXEEXT): $(LIBRUBY_A) $(MAINOBJ)
@echo $(LIBS)
- $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) dmyext.obj,$@,nul,$(LIBRUBY_A) $(LIBS)
+ $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ),$@,nul,$(LIBRUBY_A) $(LIBS)
$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res
$(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBY_INSTALL_NAME).res
@@ -424,13 +445,27 @@ $(LIBRUBY_SO) $(LIBRUBY): $(LIBRUBY_A) $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
$(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
$(MINIRUBY) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A)
-install: rbconfig.rb
+install: install-nodoc $(RDOCTARGET)
+install-all: install-nodoc install-doc
+
+install-nodoc: install-local install-ext
+install-local: rbconfig.rb
$(MINIRUBY) $(srcdir)instruby.rb $(SCRIPT_ARGS)
- $(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) install
+install-ext: rbconfig.rb
+ $(MINIRUBY) $(srcdir)ext/extmk.rb $(EXTMK_ARGS) install
-what-where no-install: rbconfig.rb
+what-where-all no-install-all: no-install no-install-doc
+what-where no-install: no-install-local no-install-ext
+what-where-local: no-install-local
+no-install-local: rbconfig.rb
$(MINIRUBY) $(srcdir)instruby.rb -n $(SCRIPT_ARGS)
- $(MINIRUBY) $(srcdir)ext/extmk.rb -n $(SCRIPT_ARGS) install
+what-where-ext: no-install-ext
+no-install-ext: rbconfig.rb
+ $(MINIRUBY) $(srcdir)ext/extmk.rb -n $(EXTMK_ARGS) install
+
+install-doc: $(PROGRAM)
+ @echo Generating RDoc documentation
+ $(RUNRUBY) "$(srcdir)bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
clean: clean-ext clean-local
@@ -447,7 +482,7 @@ clean-local:
@if exist *.il? del *.il?
clean-ext:
- @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) clean
+ @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(EXTMK_ARGS) clean
distclean: distclean-ext distclean-local
@@ -481,7 +516,7 @@ distclean-local: clean-local
@if exist miniruby$(EXEEXT) del miniruby$(EXEEXT)
distclean-ext:
- @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) distclean
+ @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(EXTMK_ARGS) distclean
realclean: distclean
@if exist parse.c del parse.c
@@ -490,6 +525,13 @@ realclean: distclean
test: miniruby$(EXEEXT) NUL
@$(MINIRUBY) $(srcdir)rubytest.rb
+test-all:
+ $(RUNRUBY) -C "$(srcdir)test" runner.rb --runner=$(TESTUI) $(TESTS)
+
+extconf:
+ $(MINIRUBY) -run -e mkdir -- -p "$(EXTCONFDIR)"
+ $(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
+
rbconfig.rb: miniruby$(EXEEXT) config.status
@$(MINIRUBY) $(srcdir)mkconfig.rb -srcdir=$(srcdir) \
-install_name=$(RUBY_INSTALL_NAME) \
diff --git a/bcc32/configure.bat b/bcc32/configure.bat
index 449b6e25b5..6ca467d79a 100644
--- a/bcc32/configure.bat
+++ b/bcc32/configure.bat
@@ -15,18 +15,61 @@ if "%1" == "--srcdir" goto :srcdir
if "%1" == "srcdir" goto :srcdir
if "%1" == "--target" goto :target
if "%1" == "target" goto :target
- echo>> ~tmp~.mak "%1"
+if "%1" == "--program-suffix" goto :suffix
+if "%1" == "--program-name" goto :progname
+if "%1" == "--enable-install-doc" goto :enable-rdoc
+if "%1" == "--disable-install-doc" goto :disable-rdoc
+if "%1" == "-h" goto :help
+if "%1" == "--help" goto :help
+ echo>> ~tmp~.mak "%1" \
shift
goto :loop
:srcdir
- echo>> ~tmp~.mak "srcdir=%2"
+ echo>> ~tmp~.mak -D"srcdir=%2" \
+ shift
+ shift
+goto :loop
+:suffix
+ echo>> ~tmp~.mak -D"RUBY_SUFFIX=%2" \
+ shift
+ shift
+goto :loop
+:installname
+ echo>> ~tmp~.mak -D"RUBY_INSTALL_NAME=%2" \
+ shift
+ shift
+goto :loop
+:soname
+ echo>> ~tmp~.mak -D"RUBY_SO_NAME=%2" \
shift
shift
goto :loop
:target
- echo>> ~tmp~.mak %2
+ echo>> ~tmp~.mak %2 \
+ shift
shift
+goto :loop
+:enable-rdoc
+ echo>> ~tmp~.mak -D"RDOCTARGET=install-doc" \
+ shift
+goto :loop
+:disable-rdoc
+ echo>> ~tmp~.mak -D"RDOCTARGET=install-nodoc" \
shift
goto :loop
+:help
+ echo Configuration:
+ echo --help display this help
+ echo --srcdir=DIR find the sources in DIR [configure dir or `..']
+ echo Installation directories:
+ echo --prefix=PREFIX install files in PREFIX [/usr]
+ echo System types:
+ echo --target=TARGET configure for TARGET [i386-mswin32]
+ echo Optional Package:
+ echo --with-static-linked-ext link external modules statically
+ echo --disable-install-doc do not install rdoc indexes during install
+ del ~tmp~.mak
+goto :exit
:end
+echo.>> ~tmp~.mak
make -s -f ~tmp~.mak
diff --git a/configure.in b/configure.in
index e7c1ed153a..5d86ea1fe1 100644
--- a/configure.in
+++ b/configure.in
@@ -191,6 +191,8 @@ AC_PROG_MAKE_SET
AC_AIX
AC_MINIX
+AC_SUBST(RM, ['rm -f'])
+
dnl check for large file stuff
AC_SYS_LARGEFILE
@@ -828,6 +830,7 @@ if test "$with_dln_a_out" != yes; then
hpux*) DLDFLAGS="$DLDFLAGS -E"
: ${LDSHARED='ld -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
+ : ${LIBPATHENV=SHLIB_PATH}
rb_cv_dlopen=yes;;
solaris*) if test "$GCC" = yes; then
: ${LDSHARED='$(CC) -Wl,-G'}
@@ -899,12 +902,14 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes ;;
darwin*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress -flat_namespace'}
: ${LDFLAGS=""}
+ : ${LIBPATHENV=DYLD_LIBRARY_PATH}
rb_cv_dlopen=yes ;;
aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
DLDFLAGS="$DLDFLAGS "'-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
: LDFLAGS="$LDFLAGS -brtl"
: ${ARCHFILE="ruby.imp"}
+ : ${LIBPATHENV=SHLIB_PATH}
rb_cv_dlopen=yes ;;
human*) : ${DLDFLAGS=''}
@@ -922,6 +927,7 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot"
;;
esac
+ : ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes ;;
nto-qnx*) DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
: ${LDSHARED='ld -Bshareable -x'}
@@ -930,6 +936,7 @@ if test "$with_dln_a_out" != yes; then
cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"}
XLDFLAGS="$XLDFLAGS -Wl,--stack,0x02000000"
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-import,--export-all"
+ : ${LIBPATHENV=""}
rb_cv_dlopen=yes ;;
hiuxmpp) : ${LDSHARED='ld -r'} ;;
atheos*) : ${LDSHARED="$CC -shared"}
@@ -943,6 +950,7 @@ fi
AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
AC_SUBST(RPATHFLAG)
+AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
dln_a_out_works=no
if test "$ac_cv_header_a_out_h" = yes; then
@@ -1100,12 +1108,15 @@ fi
if test x"$cross_compiling" = xyes; then
test x"$MINIRUBY" = x && MINIRUBY="${RUBY-ruby} -I`pwd` -rfake"
PREP=fake.rb
+ RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
else
MINIRUBY='./miniruby$(EXEEXT)'
PREP=''
+ RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT) --'
fi
AC_SUBST(MINIRUBY)
AC_SUBST(PREP)
+AC_SUBST(RUNRUBY)
FIRSTMAKEFILE=""
LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a'
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 408f02d72d..dc87b2c237 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -121,12 +121,33 @@ def extmake(target)
end
def parse_args()
- getopts('n', 'extstatic:', 'dest-dir:',
- 'make:', 'make-flags:', 'mflags:')
+ getopts('n', 'extstatic:', 'extension:', 'dest-dir:', 'extout:',
+ 'make:', 'make-flags:', 'mflags:', 'message:')
$dryrun = $OPT['n']
- $force_static = $OPT['extstatic'] == 'static'
+ if $extension = $OPT['extension']
+ if $extension.empty?
+ $extension = nil
+ elsif $extension == "none"
+ $extension = []
+ else
+ $extension = $extension.split(/[\s,]+/)
+ end
+ end
+ if $extstatic = $OPT['extstatic']
+ if $extstatic.empty?
+ $extstatic = nil
+ elsif $extstatic == "none"
+ $extstatic = ""
+ else
+ $force_static = true
+ $extstatic = nil if $extstatic == 'static'
+ end
+ end
$destdir = $OPT['dest-dir'] || ''
+ if opt = $OPT['extout'] and !opt.empty?
+ $outdir = File.expand_path(opt, $topdir)
+ end
$make = $OPT['make'] || $make || 'make'
mflags = ($OPT['make-flags'] || '').strip
mflags = ($OPT['mflags'] || '').strip if mflags.empty?
@@ -143,6 +164,9 @@ def parse_args()
grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
false
end
+ def $mflags.defined?(var)
+ grep(/\A#{var}=(.*)/) {return $1}
+ end
if $mflags.set?(?n)
$dryrun = true
@@ -151,25 +175,37 @@ def parse_args()
end
$continue = $mflags.set?(?k)
- $mflags |= ["DESTDIR=#{$destdir}"] unless $destdir.to_s.empty?
+ if !$destdir.to_s.empty?
+ $destdir = File.expand_path($destdir)
+ $mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
+ end
+ if $outdir
+ $mflags << "outdir=#{$outdir.sub(/#{Regexp.quote($topdir)}/, '$(topdir)')}"
+ $mflags << "outdir_prefix=#{$outdir_prefix}"
+ end
+
+ $message = $OPT['message']
end
parse_args()
+if target = ARGV.shift and /^[a-z-]+$/ =~ target
+ $mflags.push(target)
+ target = target.sub(/^(?:dist|real)(?=(?:clean)?$)/, '\1')
+ case target
+ when /clean/
+ $ignore ||= true
+ when /^install\b/
+ $install = true
+ $ignore ||= true
+ $mflags.unshift("INSTALL_PROG=install -c -p -m 0755",
+ "INSTALL_DATA=install -c -p -m 0644",
+ "MAKEDIRS=mkdir -p") if $dryrun
+ end
+end
unless $message
- if $message = ARGV.shift and /^[a-z]+$/ =~ $message
- $mflags.push($message)
- $message = $message.sub(/^(?:dist|real)(?=(?:clean)?$)/, '\1')
- case $message
- when "clean"
- $ignore ||= true
- when "install"
- $ignore ||= true
- $mflags.unshift("INSTALL_PROG=install -c -p -m 0755",
- "INSTALL_DATA=install -c -p -m 0644",
- "MAKEDIRS=mkdir -p") if $dryrun
- end
- $message.sub!(/e?$/, "ing")
+ if target
+ $message = target.sub(/^(\w+)e?\b/, '\1ing').tr('-', ' ')
else
$message = "compiling"
end
@@ -190,6 +226,12 @@ MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtim
# get static-link modules
$static_ext = {}
+if $extstatic
+ $extstatic.split(/[\s,]+/).each do |target|
+ target = target.downcase if /mswin32|bccwin32/ =~ RUBY_PLATFORM
+ $static_ext[target] = $static_ext.size
+ end
+end
for dir in ["ext", File::join($top_srcdir, "ext")]
setup = File::join(dir, CONFIG['setup'])
if File.file? setup
@@ -214,20 +256,33 @@ for dir in ["ext", File::join($top_srcdir, "ext")]
f.close
break
end
+end unless $extstatic
+
+ext_prefix = "#{$top_srcdir}/ext"
+exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
+exts |= $extension if $extension
+exts.delete_if {|t| !File.exist?("#{ext_prefix}/#{t}/MANIFEST")}
+exts |= Dir.glob("#{ext_prefix}/*/**/MANIFEST").collect {|d|
+ d = File.dirname(d)
+ d.slice!(0, ext_prefix.length + 1)
+ d
+} unless $extension
+
+if $outdir
+ if $install
+ Config.expand(dest = "#{$destdir}#{$rubylibdir}")
+ FileUtils.cp_r($outdir+"/.", dest, :verbose => true, :noop => $dryrun)
+ exit
+ end
+ unless $ignore
+ FileUtils.mkpath($outdir)
+ end
end
FileUtils::makedirs('ext')
Dir::chdir('ext')
-ext_prefix = "#{$top_srcdir}/ext"
-$static_ext.sort_by {|t, i| i}.each do |t, i|
- next unless File.exist?("#{ext_prefix}/#{t}/MANIFEST")
- extmake(t) or abort
-end
-Dir.glob("#{ext_prefix}/*/**/MANIFEST") do |d|
- d = File.dirname(d)
- d.slice!(0, ext_prefix.length + 1)
- next if $static_ext[d]
+exts.each do |d|
extmake(d) or abort
end
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']
diff --git a/runruby.rb b/runruby.rb
new file mode 100755
index 0000000000..4eaa133224
--- /dev/null
+++ b/runruby.rb
@@ -0,0 +1,50 @@
+#!./miniruby
+
+while arg = ARGV[0]
+ break ARGV.shift if arg == '--'
+ /\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
+ arg, value = $1, $2
+ re = Regexp.new('\A'+arg.gsub(/\w+\b/, '\&\\w*')+'\z', "i")
+ case
+ when re =~ "srcdir"
+ srcdir = value
+ when re =~ "archdir"
+ archdir = value
+ when re =~ "extout"
+ extout = value
+ else
+ break
+ end
+ ARGV.shift
+end
+
+require 'rbconfig'
+config = Config::CONFIG
+
+srcdir ||= File.dirname(__FILE__)
+archdir ||= '.'
+
+ruby = File.join(archdir, config["RUBY_INSTALL_NAME"]+config['EXEEXT'])
+unless File.exist?(ruby)
+ abort "#{ruby} is not found.\nTry `make' first, then `make test', please.\n"
+end
+
+abs_archdir = File.expand_path(archdir)
+libs = [abs_archdir, File.expand_path("lib", srcdir)]
+if extout
+ abs_extout = File.expand_path(extout)
+ libs << abs_extout << File.expand_path(RUBY_PLATFORM, abs_extout)
+end
+config["bindir"] = abs_archdir
+
+if e = ENV["RUBYLIB"]
+ libs |= e.split(File::PATH_SEPARATOR)
+end
+ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
+
+if File.file?(File.join(archdir, config['LIBRUBY_SO'])) and
+ e = config['LIBPATHENV'] and !e.empty?
+ ENV[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
+end
+
+exec ruby, *ARGV
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index e69ae82458..253f5f5823 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -84,6 +84,24 @@ exec_prefix = $(prefix)
!if !defined(libdir)
libdir = $(exec_prefix)/lib
!endif
+!if !defined(datadir)
+datadir = $(prefix)/share
+!endif
+!ifndef EXTOUT
+EXTOUT = .ext
+!endif
+!ifndef RIDATADIR
+RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
+!endif
+!ifndef TESTUI
+TESTUI = console
+!endif
+!ifndef TESTS
+TESTS =
+!endif
+!ifndef RDOCTARGET
+RDOCTARGET = install-doc
+!endif
!if !defined(CFLAGS)
CFLAGS = -MD $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG)
!endif
@@ -121,6 +139,8 @@ PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_SO_NAME).def
MINIRUBY = .\miniruby$(EXEEXT)
+RUNRUBY = .\ruby$(EXEEXT) "$(srcdir)/runruby.rb" --extout="$(EXTOUT)" --
+EXTCONF = extconf.rb
!if !defined(STACK)
STACK = 0x2000000
@@ -187,10 +207,11 @@ SCRIPT_ARGS = "--dest-dir=$(DESTDIR)" \
"--make=$(MAKE)" \
"--mflags=$(MFLAGS)" \
"--make-flags=$(MAKEFLAGS)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension="$(EXTS)" --extstatic="$(EXTSTATIC)"
all: ext miniruby$(EXEEXT) rbconfig.rb \
$(LIBRUBY) $(MISCLIBS)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic=$(EXTSTATIC) $(SCRIPT_ARGS)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
ext:
@mkdir $@
@@ -352,7 +373,7 @@ s,@EXEEXT@,.exe,;t t
s,@OBJEXT@,obj,;t t
s,@XCFLAGS@,$(XCFLAGS),;t t
s,@XLDFLAGS@,$(XLDFLAGS),;t t
-s,@DLDFLAGS@,$(DLDFLAGS) $$(LIBPATH) -def:$$(DEFFILE),;t t
+s,@DLDFLAGS@,$(DLDFLAGS) $$(LIBPATH) -def:$$(DEFFILE) -implib:$$(*F:.so=).lib,;t t
s,@ARCH_FLAG@,$(ARCH_FLAG),;t t
s,@STATIC@,$(STATIC),;t t
s,@CCDLFLAGS@,,;t t
@@ -402,9 +423,9 @@ s,@srcdir@,$(srcdir),;t t
s,@top_srcdir@,$(srcdir),;t t
<<KEEP
-miniruby$(EXEEXT): $(OBJS) $(MAINOBJ) $(DMYEXT)
+miniruby$(EXEEXT): $(LIBRUBY_A) $(MAINOBJ)
@echo. $(LIBS)
- $(PURIFY) $(CC) $(MAINOBJ) $(DMYEXT) $(OBJS) $(LIBS) -Fe$@ $(LDFLAGS)
+ $(PURIFY) $(CC) $(MAINOBJ) $(LIBRUBY_A) $(LIBS) -Fe$@ $(LDFLAGS)
$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $*.res
$(PURIFY) $(CC) $(MAINOBJ) $*.res \
@@ -431,13 +452,27 @@ $(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
{$(srcdir)/win32}.def.lib:
$(AR) $(ARFLAGS)$@ -def:$<
-install: rbconfig.rb
+install: install-nodoc $(RDOCTARGET)
+install-all: install-nodoc install-doc
+
+install-nodoc: install-local install-ext
+install-local: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS)
- $(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install
+install-ext: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
-what-where no-install: rbconfig.rb
+what-where-all no-install-all: no-install no-install-doc
+what-where no-install: no-install-local no-install-ext
+what-where-local: no-install-local
+no-install-local: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS)
- $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install
+what-where-ext: no-install-ext
+no-install-ext: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(EXTMK_ARGS) install
+
+install-doc: $(PROGRAM)
+ @echo Generating RDoc documentation
+ $(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
clean: clean-ext clean-local
@@ -452,7 +487,7 @@ clean-local:
@if exist *.res del *.res
clean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) clean
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) clean
distclean: distclean-ext distclean-local
@@ -486,7 +521,7 @@ distclean-local: clean-local
@if exist miniruby$(EXEEXT) del miniruby$(EXEEXT)
distclean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) distclean
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) distclean
realclean: distclean
@if exist parse.c del parse.c
@@ -495,6 +530,13 @@ realclean: distclean
test: miniruby$(EXEEXT) NUL
@miniruby$(EXEEXT) $(srcdir)/rubytest.rb
+test-all:
+ $(RUNRUBY) -C "$(srcdir)/test" runner.rb --runner=$(TESTUI) $(TESTS)
+
+extconf:
+ $(MINIRUBY) -run -e mkdir -- -p "$(EXTCONFDIR)"
+ $(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
+
rbconfig.rb: miniruby$(EXEEXT) config.status
@$(MINIRUBY) $(srcdir)/mkconfig.rb -srcdir=$(srcdir) \
-install_name=$(RUBY_INSTALL_NAME) \
diff --git a/win32/configure.bat b/win32/configure.bat
index 037b656f48..be9cd97297 100755
--- a/win32/configure.bat
+++ b/win32/configure.bat
@@ -16,6 +16,10 @@ if "%1" == "srcdir" goto :srcdir
if "%1" == "--target" goto :target
if "%1" == "target" goto :target
if "%1" == "--with-static-linked-ext" goto :extstatic
+if "%1" == "--program-suffix" goto :suffix
+if "%1" == "--program-name" goto :progname
+if "%1" == "--enable-install-doc" goto :enable-rdoc
+if "%1" == "--disable-install-doc" goto :disable-rdoc
if "%1" == "-h" goto :help
if "%1" == "--help" goto :help
echo>> ~tmp~.mak "%1" \
@@ -31,6 +35,21 @@ goto :loop
shift
shift
goto :loop
+:suffix
+ echo>> ~tmp~.mak "RUBY_SUFFIX=%2" \
+ shift
+ shift
+goto :loop
+:installname
+ echo>> ~tmp~.mak "RUBY_INSTALL_NAME=%2" \
+ shift
+ shift
+goto :loop
+:soname
+ echo>> ~tmp~.mak "RUBY_SO_NAME=%2" \
+ shift
+ shift
+goto :loop
:target
echo>> ~tmp~.mak "%2" \
shift
@@ -40,6 +59,14 @@ goto :loop
echo>> ~tmp~.mak "EXTSTATIC=static" \
shift
goto :loop
+:enable-rdoc
+ echo>> ~tmp~.mak "RDOCTARGET=install-doc" \
+ shift
+goto :loop
+:disable-rdoc
+ echo>> ~tmp~.mak "RDOCTARGET=install-nodoc" \
+ shift
+goto :loop
:help
echo Configuration:
echo --help display this help
@@ -50,6 +77,7 @@ goto :loop
echo --target=TARGET configure for TARGET [i386-mswin32]
echo Optional Package:
echo --with-static-linked-ext link external modules statically
+ echo --disable-install-doc do not install rdoc indexes during install
del ~tmp~.mak
goto :exit
:end
diff --git a/win32/win32.c b/win32/win32.c
index 28fb467768..43c69078d4 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2731,6 +2731,24 @@ isUNCRoot(const char *path)
return 0;
}
+#ifdef __BORLANDC__
+#undef fstat
+int
+rb_w32_fstat(int fd, struct stat *st)
+{
+ BY_HANDLE_FILE_INFORMATION info;
+ int ret = fstat(fd, st);
+
+ if (ret) return ret;
+ st->st_mode &= ~(S_IWGRP | S_IWOTH);
+ if (GetFileInformationByHandle((HANDLE)_get_osfhandle(fd), &info) &&
+ !(info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) {
+ st->st_mode |= S_IWUSR;
+ }
+ return ret;
+}
+#endif
+
int
rb_w32_stat(const char *path, struct stat *st)
{
diff --git a/win32/win32.h b/win32/win32.h
index 7122ec9a20..33aa60619c 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -113,6 +113,8 @@ extern "C++" {
#define write(h, b, l) _write(h, b, l)
#define _open _sopen
#define sopen _sopen
+#undef fstat
+#define fstat(fd,st) rb_w32_fstat(fd,st)
#endif
#define fsync(h) _commit(h)
#undef stat