aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-22 03:58:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-22 03:58:44 +0000
commit883857d8429c9cd94ffa9ff8968ee1afa243a0bf (patch)
tree1cc73867c963b948791560d463d164975262d517
parentac19769719846acc72a0ffe13995e1a8797ae5c0 (diff)
downloadruby-883857d8429c9cd94ffa9ff8968ee1afa243a0bf.tar.gz
* ext/extmk.rb: use optparse instead of getopts.
* Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--Makefile.in7
-rw-r--r--bcc32/Makefile.sub2
-rw-r--r--ext/extmk.rb72
-rw-r--r--win32/Makefile.sub2
5 files changed, 49 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index c8f07f3a42..5fc4e8e7da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Feb 22 12:58:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: use optparse instead of getopts.
+
+ * Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub: ditto.
+
Sat Feb 22 09:51:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* re.c: corrected documentation format (rb_reg_initialize_m)
diff --git a/Makefile.in b/Makefile.in
index 26796342c5..bd626c4f1e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -64,7 +64,8 @@ LIBRUBYARG = @LIBRUBYARG@
LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@
LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
-PREP = @PREP@ @ARCHFILE@
+PREP = @PREP@
+ARCHFILE = @ARCHFILE@
SETUP =
EXTSTATIC = @EXTSTATIC@
@@ -118,7 +119,7 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
--make="$(MAKE)" \
--mflags="$(MFLAGS)" \
--make-flags="$(MAKEFLAGS)"
-EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension="$(EXTS)" --extstatic="$(EXTSTATIC)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC)
all: @MAKEFILES@ miniruby$(EXEEXT) rbconfig.rb $(LIBRUBY)
@$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
@@ -143,7 +144,7 @@ $(LIBRUBY_A): $(OBJS) $(DMYEXT)
@AR@ rcu $@ $(OBJS) $(DMYEXT)
@-@RANLIB@ $@ 2> /dev/null || true
-$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) miniruby$(EXEEXT) $(PREP)
+$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) miniruby$(EXEEXT) $(PREP) $(ARCHFILE)
$(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) -o $@
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
File.symlink "$(LIBRUBY_SO)", link}' \
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index 6de146eb12..b8ff2d4dec 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -214,7 +214,7 @@ SCRIPT_ARGS = "--dest-dir=$(DESTDIR)" \
"--make=$(MAKE)" \
"--mflags=$(MFLAGS)" \
"--make-flags=$(MAKEFLAGS)"
-EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension="$(EXTS)" --extstatic="$(EXTSTATIC)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC)
all: miniruby$(EXEEXT) rbconfig.rb \
$(LIBRUBY) $(MISCLIBS)
diff --git a/ext/extmk.rb b/ext/extmk.rb
index c20cd5a93a..1aefcb8715 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -25,7 +25,7 @@ srcdir = Config::CONFIG["srcdir"]
$:.replace [srcdir, srcdir+"/lib", "."]
require 'mkmf'
-require 'getopts'
+require 'optparse/shellwords'
$topdir = "."
$top_srcdir = srcdir
@@ -137,41 +137,45 @@ def extmake(target)
end
def parse_args()
- getopts('n', 'extstatic:', 'extension:', 'dest-dir:', 'extout:',
- 'make:', 'make-flags:', 'mflags:', 'message:')
-
- $dryrun = $OPT['n']
- if $extension = $OPT['extension']
- if $extension.empty?
- $extension = nil
- elsif $extension == "none"
- $extension = []
- else
- $extension = $extension.split(/[\s,]+/)
+ $mflags = []
+
+ opts = nil
+ ARGV.options do |opts|
+ opts.on('-n') {$dryrun = true}
+ opts.on('--[no-]extension [EXTS]', Array) do |v|
+ $extension = (v == false ? [] : v)
end
- end
- if $extstatic = $OPT['extstatic']
- if $extstatic.empty?
- $extstatic = nil
- elsif $extstatic == "none"
- $extstatic = ""
- else
- $force_static = true
- $extstatic = nil if $extstatic == 'static'
+ opts.on('--[no-]extstatic [STATIC]', Array) do |v|
+ if ($extstatic = v) == false
+ $extstatic = []
+ elsif v
+ $force_static = true
+ $extstatic.delete("static")
+ $extstatic = nil if $extstatic.empty?
+ end
end
- end
- $destdir = $OPT['dest-dir'] || ''
- if opt = $OPT['extout'] and !opt.empty?
- $extout = opt
- end
- $make = $OPT['make'] || $make || 'make'
- mflags = ($OPT['make-flags'] || '').strip
- mflags = ($OPT['mflags'] || '').strip if mflags.empty?
+ opts.on('--dest-dir=DIR') do |v|
+ $destdir = v
+ end
+ opts.on('--extout=DIR') do |v|
+ $extout = (v unless v.empty?)
+ end
+ opts.on('--make=MAKE') do |v|
+ $make = v || 'make'
+ end
+ opts.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
+ if arg = v.first
+ arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
+ end
+ $mflags.concat(v)
+ end
+ opts.on('--message [MESSAGE]', String) do |v|
+ $message = v
+ end
+ opts.parse!
+ end or abort opts.to_s
- $mflags = Shellwords.shellwords(mflags)
- if arg = $mflags.first
- arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
- end
+ $destdir ||= ''
$make, *rest = Shellwords.shellwords($make)
$mflags.unshift(*rest) unless rest.empty?
@@ -200,8 +204,6 @@ def parse_args()
$extout_prefix = $extout ? "$(extout)$(target_prefix)/" : ""
$mflags << "extout=#$extout" << "extout_prefix=#$extout_prefix"
end
-
- $message = $OPT['message']
end
parse_args()
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 4454d5a6dc..73cd67e53f 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -207,7 +207,7 @@ SCRIPT_ARGS = "--dest-dir=$(DESTDIR)" \
"--make=$(MAKE)" \
"--mflags=$(MFLAGS)" \
"--make-flags=$(MAKEFLAGS)"
-EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension="$(EXTS)" --extstatic="$(EXTSTATIC)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC)
all: ext miniruby$(EXEEXT) rbconfig.rb \
$(LIBRUBY) $(MISCLIBS)