mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
ac19769719
commit
883857d842
5 changed files with 48 additions and 39 deletions
|
@ -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)
|
||||
|
|
|
@ -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}' \
|
||||
|
|
|
@ -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)
|
||||
|
|
70
ext/extmk.rb
70
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:')
|
||||
$mflags = []
|
||||
|
||||
$dryrun = $OPT['n']
|
||||
if $extension = $OPT['extension']
|
||||
if $extension.empty?
|
||||
$extension = nil
|
||||
elsif $extension == "none"
|
||||
$extension = []
|
||||
else
|
||||
$extension = $extension.split(/[\s,]+/)
|
||||
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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue