summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile.in4
-rw-r--r--bcc32/Makefile.sub6
-rw-r--r--ext/extmk.rb29
-rw-r--r--lib/mkmf.rb12
-rw-r--r--mkconfig.rb1
-rw-r--r--process.c73
-rw-r--r--win32/Makefile.sub4
8 files changed, 92 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 0716c90901..f6d12154f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Tue Dec 31 21:13:51 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * Makefile.in, {win32,bcc32}/Makefile.sub: add new target:
+ what-where, no-install.
+
+ * mkconfig.rb: add const: CROSS_COMPILING.
+
+ * ext/extmk.rb: no-install support. add MAKEDIRS macro.
+
+ * lib/mkmf.rb: add !ifdef .. !endif for Borland make.
+
+ * process.c: improve DJGPP support. system "ls", "-l".
+
Tue Dec 31 20:16:37 2002 Akinori MUSHA <knu@iDaemons.org>
* ext/socket/addrinfo.h (NI_MAXHOST): Define NI_MAXHOST and
diff --git a/Makefile.in b/Makefile.in
index d36f649f95..df6d52bc17 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -129,6 +129,10 @@ install: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS)" $(DESTDIR)
$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR)" install
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) -n" $(DESTDIR)
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) -n DESTDIR=$(DESTDIR)" install
+
clean-ext:
@-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS)" clean 2> /dev/null || true
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index b7ffb11502..3023a77537 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -184,7 +184,7 @@ OBJS = array.obj \
all: miniruby$(EXEEXT) rbconfig.rb \
$(LIBRUBY) $(MISCLIBS)
- @.\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb --extstatic=$(EXTSTATIC) --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS)"
+ .\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb --extstatic=$(EXTSTATIC) --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS)"
ruby: $(PROGRAM)
rubyw: $(WPROGRAM)
@@ -410,6 +410,10 @@ install: rbconfig.rb
$(MINIRUBY) $(srcdir)instruby.rb --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS)" $(DESTDIR)
$(MINIRUBY) $(srcdir)ext/extmk.rb --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR)" install
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)instruby.rb --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS) -n" $(DESTDIR)
+ $(MINIRUBY) $(srcdir)ext/extmk.rb --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS) -n DESTDIR=$(DESTDIR)" install
+
clean: clean-ext clean-local
clean-local:
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 0a61b65e84..f4c5d47d20 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -8,6 +8,8 @@ $clean = nil
$nodynamic = nil
$extinit = nil
$extobjs = nil
+$ignore = nil
+$message = nil
$extlist = []
@@ -26,6 +28,13 @@ $topdir = File.expand_path(".")
$top_srcdir = srcdir
$hdrdir = $top_srcdir
+$quote =
+ /mswin|bccwin|mingw|human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
+
+def sysquote(x)
+ $quote ? x.quote : x
+end
+
def extmake(target)
print "#{$message} #{target}\n"
$stdout.flush
@@ -73,7 +82,7 @@ def extmake(target)
if $static
$extlist.push [$static, $target, File.basename($target)]
end
- unless system($make, *$mflags)
+ unless system($make, *sysquote($mflags))
$ignore or $continue or return false
end
else
@@ -105,7 +114,7 @@ getopts('', 'extstatic', 'make:', 'make-flags:')
$force_static = $OPT['extstatic'] == 'static'
$make = $OPT['make'] || $make
$mflags = Shellwords.shellwords($OPT['make-flags'] || "")
-$mflags[0].sub!(/^(?=\w+)$/, "-") unless $mflags.empty?
+$mflags[0].sub!(/^[^-]/, '-\&') unless $mflags.empty?
$make, *$mflags[0, 0] = Shellwords.shellwords($make)
mflags = $mflags.grep(/^-([^-].*)/) {$1}.join
@@ -122,8 +131,9 @@ unless $message
$ignore ||= true
when "install"
$ignore ||= true
- $mflags.unshift("INSTALL_PROG=install -m 0755",
- "INSTALL_DATA=install -m 0644") if $dryrun
+ $mflags.unshift("INSTALL_PROG=install -c -m 0755",
+ "INSTALL_DATA=install -c -m 0644",
+ "MAKEDIRS=mkdir -p") if $dryrun
end
$message.sub!(/e?$/, "ing")
else
@@ -132,7 +142,7 @@ unless $message
end
EXEEXT = CONFIG['EXEEXT']
-if defined? CROSS_COMPILING
+if CROSS_COMPILING
$ruby = CONFIG['MINIRUBY']
elsif $nmake
$ruby = '$(topdir:/=\\)\\miniruby' + EXEEXT
@@ -226,9 +236,12 @@ Dir.chdir ".."
puts "making #{rubies.join(', ')}"
$stdout.flush
$mflags.concat(rubies)
-host = (defined?(CROSS_COMPILING) ? CROSS_COMPILING : RUBY_PLATFORM)
-/mswin|bccwin|mingw|djgpp|human|os2|macos/ =~ host or exec($make, *$mflags)
-system($make, *$mflags.quote) or exit($?.exitstatus)
+
+if $quote
+ system($make, *$mflags.quote) or exit($?.exitstatus)
+else
+ exec($make, *$mflags)
+end
#Local variables:
# mode: ruby
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 3ac84ff56b..0be7b73279 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -585,6 +585,16 @@ INSTALL_DATA = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0644, true)
#### End of system configuration section. ####
}
+ if $nmake == ?b
+ mk.each do |x|
+ x.gsub!(/^(MAKEDIRS|INSTALL_(?:PROG|DATA))+\s*=.*\n/) do
+ "!ifndef " + $1 + "\n" +
+ $& +
+ "!endif\n"
+ end
+ end
+ end
+ mk
end
def dummy_makefile(srcdir)
@@ -792,7 +802,7 @@ def init_mkmf(config = CONFIG)
$objs = nil
$libs = ""
if $enable_shared or Config.expand(config["LIBRUBY"].dup) != Config.expand(config["LIBRUBY_A"].dup)
- $LIBPATH.unshift("$(libdir)") unless $extmk or defined? CROSS_COMPILING
+ $LIBPATH.unshift("$(libdir)") unless $extmk or CROSS_COMPILING
$LIBRUBYARG = config['LIBRUBYARG']
end
diff --git a/mkconfig.rb b/mkconfig.rb
index 9ee960ed34..f90363b94a 100644
--- a/mkconfig.rb
+++ b/mkconfig.rb
@@ -127,6 +127,7 @@ print <<EOS
Config::expand(val)
end
end
+CROSS_COMPILING = nil unless defined? CROSS_COMPILING
EOS
$stdout.flush
$stdout.reopen($orgout)
diff --git a/process.c b/process.c
index 0052846ca6..38592794cb 100644
--- a/process.c
+++ b/process.c
@@ -20,6 +20,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef __DJGPP__
+#include <process.h>
+#endif
#include <time.h>
#include <ctype.h>
@@ -574,7 +577,7 @@ rb_proc_exec(str)
return -1;
}
-#if defined(__human68k__)
+#if defined(__human68k__) || defined(__DJGPP__)
static int
proc_spawn_v(argv, prog)
char **argv;
@@ -583,16 +586,14 @@ proc_spawn_v(argv, prog)
char *extension;
int status;
- if (prog) {
- security(prog);
- }
- else {
- security(argv[0]);
- prog = dln_find_exe(argv[0], 0);
- if (!prog)
- return -1;
- }
+ if (!prog)
+ prog = argv[0];
+ security(prog);
+ prog = dln_find_exe(prog, 0);
+ if (!prog)
+ return -1;
+#if defined(__human68k__)
if ((extension = strrchr(prog, '.')) != NULL && strcasecmp(extension, ".bat") == 0) {
char **new_argv;
char *p;
@@ -615,8 +616,13 @@ proc_spawn_v(argv, prog)
return -1;
}
}
+#endif
before_exec();
+#if defined(_WIN32)
+ status = do_aspawn(prog, argv);
+#else
status = spawnv(P_WAIT, prog, argv);
+#endif
after_exec();
return status;
}
@@ -632,16 +638,18 @@ proc_spawn_n(argc, argv, prog)
args = ALLOCA_N(char*, argc + 1);
for (i = 0; i < argc; i++) {
- SafeStr(argv[i]);
+ SafeStringValue(argv[i]);
args[i] = RSTRING(argv[i])->ptr;
}
- SafeStringValue(prog);
+ if (prog)
+ SafeStringValue(prog);
args[i] = (char*) 0;
if (args[0])
- return proc_spawn_v(args, RSTRING(prog)->ptr);
+ return proc_spawn_v(args, prog ? RSTRING(prog)->ptr : 0);
return -1;
}
+#if !defined(_WIN32)
static int
proc_spawn(sv)
VALUE sv;
@@ -672,7 +680,8 @@ proc_spawn(sv)
}
return argv[0] ? proc_spawn_v(argv, 0) : -1;
}
-#endif /* __human68k__ */
+#endif
+#endif
VALUE
rb_f_exec(argc, argv)
@@ -830,34 +839,10 @@ rb_f_system(argc, argv)
if (status == 0) return Qtrue;
return Qfalse;
-#elif defined(DJGPP)
- VALUE cmd;
- int status;
-
- if (argc == 0) {
- rb_last_status = Qnil;
- rb_raise(rb_eArgError, "wrong number of arguments");
- }
-
- if (TYPE(argv[0]) == T_ARRAY) {
- if (RARRAY(argv[0])->len != 2) {
- rb_raise(rb_eArgError, "wrong first argument");
- }
- argv[0] = RARRAY(argv[0])->ptr[0];
- }
- cmd = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
-
- SafeStringValue(cmd);
- status = system(RSTRING(cmd)->ptr);
- last_status_set((status & 0xff) << 8, 0);
-
- if (status == 0) return Qtrue;
- return Qfalse;
-#elif defined(__human68k__)
- VALUE prog = 0;
+#elif defined(__human68k__) || defined(__DJGPP__)
+ volatile VALUE prog = 0;
int status;
- fflush(stdin);
fflush(stdout);
fflush(stderr);
if (argc == 0) {
@@ -874,12 +859,20 @@ rb_f_system(argc, argv)
}
if (argc == 1 && prog == 0) {
+#if defined(_WIN32)
+ status = do_spawn(RSTRING(argv[0])->ptr);
+#else
status = proc_spawn(argv[0]);
+#endif
}
else {
status = proc_spawn_n(argc, argv, prog);
}
+#if defined(_WIN32)
+ last_status_set(status, 0);
+#else
last_status_set(status == -1 ? 127 : status, 0);
+#endif
return status == 0 ? Qtrue : Qfalse;
#elif defined(__VMS)
VALUE cmd;
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 4503070f50..8ecfdb8393 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -410,6 +410,10 @@ install: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb --make-flags "$(MFLAGS)$(MAKEFLAGS)" $(DESTDIR)
$(MINIRUBY) $(srcdir)/ext/extmk.rb --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR)" install
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/instruby.rb --make-flags "$(MFLAGS)$(MAKEFLAGS) -n" $(DESTDIR)
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb --make "$(MAKE)" --make-flags "$(MFLAGS)$(MAKEFLAGS) -n DESTDIR=$(DESTDIR)" install
+
clean: clean-ext clean-local
clean-local: