summaryrefslogtreecommitdiff
path: root/win32
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 /win32
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 'win32')
-rw-r--r--win32/Makefile.sub62
-rwxr-xr-xwin32/configure.bat28
-rw-r--r--win32/win32.c18
-rw-r--r--win32/win32.h2
4 files changed, 100 insertions, 10 deletions
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