~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to ext/extmk.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-05-08 22:23:12 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060508222312-w2wqeaz030ifi59j
Tags: 1.9.0+20060423-3ubuntu1
* Resynchronized with Debian.
* Only change from Debian is the addition of
  debian/patches/903_sparc_fix_define.patch to fix illegal instructions
  at runtime on sparc. (change from 1.9.0+20050921-1ubuntu1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
      unless installrb.empty?
65
65
        config = CONFIG.dup
66
66
        install_dirs(target_prefix).each {|var, val| config[var] = val}
67
 
        FileUtils.rm_f(installrb.values.collect {|f| Config.expand(f, config)}, verbose: true)
 
67
        FileUtils.rm_f(installrb.values.collect {|f| RbConfig.expand(f, config)}, verbose: true)
68
68
      end
69
69
    end
70
70
    return false
116
116
    makefile = "./Makefile"
117
117
    ok = File.exist?(makefile)
118
118
    unless $ignore
119
 
      Config::CONFIG["hdrdir"] = $hdrdir
120
 
      Config::CONFIG["srcdir"] = $srcdir
121
 
      Config::CONFIG["topdir"] = $topdir
 
119
      RbConfig::CONFIG["hdrdir"] = $hdrdir
 
120
      RbConfig::CONFIG["srcdir"] = $srcdir
 
121
      RbConfig::CONFIG["topdir"] = $topdir
122
122
      CONFIG["hdrdir"] = ($hdrdir == top_srcdir) ? top_srcdir : "$(topdir)"+top_srcdir[2..-1]
123
123
      CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}"
124
124
      CONFIG["topdir"] = $topdir
129
129
        then
130
130
          ok = false
131
131
          init_mkmf
 
132
          $defs << "-DRUBY_EXPORT" if $static
132
133
          Logging::logfile 'mkmf.log'
133
134
          rm_f makefile
134
135
          if File.exist?($0 = "#{$srcdir}/makefile.rb")
182
183
      $extpath |= $LIBPATH
183
184
    end
184
185
  ensure
185
 
    Config::CONFIG["srcdir"] = $top_srcdir
186
 
    Config::CONFIG["topdir"] = topdir
 
186
    RbConfig::CONFIG["srcdir"] = $top_srcdir
 
187
    RbConfig::CONFIG["topdir"] = topdir
187
188
    CONFIG["srcdir"] = mk_srcdir
188
189
    CONFIG["topdir"] = mk_topdir
189
190
    CONFIG.delete("hdrdir")
217
218
      if ($extstatic = v) == false
218
219
        $extstatic = []
219
220
      elsif v
220
 
        $force_static = true
221
 
        $extstatic.delete("static")
 
221
        $force_static = true if $extstatic.delete("static")
222
222
        $extstatic = nil if $extstatic.empty?
223
223
      end
224
224
    end
232
232
      $make = v || 'make'
233
233
    end
234
234
    opts.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
 
235
      v.grep(/\A([-\w]+)=(.*)/) {$configure_args["--#{$1}"] = $2}
235
236
      if arg = v.first
236
237
        arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
237
238
      end
326
327
for dir in ["ext", File::join($top_srcdir, "ext")]
327
328
  setup = File::join(dir, CONFIG['setup'])
328
329
  if File.file? setup
329
 
    f = open(setup) 
 
330
    f = open(setup)
330
331
    while line = f.gets()
331
332
      line.chomp!
332
333
      line.sub!(/#.*$/, '')
351
352
 
352
353
ext_prefix = "#{$top_srcdir}/ext"
353
354
exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
354
 
exts |= $extension if $extension
355
 
exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
356
 
  d = File.dirname(d)
357
 
  d.slice!(0, ext_prefix.length + 1)
358
 
  d
359
 
}.sort unless $extension
 
355
if $extension
 
356
  exts |= $extension.select {|d| File.directory?("#{ext_prefix}/#{d}")}
 
357
else
 
358
  withes, withouts = %w[--with --without].collect {|w|
 
359
    if not (w = %w[-extensions -ext].collect {|opt|arg_config(w+opt)}).any?
 
360
      proc {false}
 
361
    elsif (w = w.grep(String)).empty?
 
362
      proc {true}
 
363
    else
 
364
      w.collect {|opt| opt.split(/,/)}.flatten.method(:any?)
 
365
    end
 
366
  }
 
367
  cond = proc {|ext|
 
368
    cond1 = proc {|n| File.fnmatch(n, ext, File::FNM_PATHNAME)}
 
369
    withes.call(&cond1) or !withouts.call(&cond1)
 
370
  }
 
371
  exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
 
372
    d = File.dirname(d)
 
373
    d.slice!(0, ext_prefix.length + 1)
 
374
    d
 
375
  }.find_all {|ext|
 
376
    with_config(ext, &cond)
 
377
  }.sort
 
378
end
360
379
 
361
380
if $extout
362
 
  Config.expand(extout = "#$extout", Config::CONFIG.merge("topdir"=>$topdir))
 
381
  RbConfig.expand(extout = "#$extout", RbConfig::CONFIG.merge("topdir"=>$topdir))
363
382
  if $install
364
 
    Config.expand(dest = "#{$destdir}#{$rubylibdir}")
365
 
    FileUtils.cp_r(extout+"/.", dest, :verbose => true, :noop => $dryrun)
 
383
    RbConfig.expand(dest = "#{$destdir}#{$rubylibdir}")
 
384
    FileUtils.cp_r(extout+"/.", dest, :remove_destination => true, :verbose => true, :noop => $dryrun)
366
385
    exit
367
386
  end
368
387
  unless $ignore
440
459
  $mflags.concat(conf)
441
460
end
442
461
rubies = []
443
 
%w[RUBY RUBYW].each {|r|
 
462
%w[RUBY RUBYW STATIC_RUBY].each {|r|
 
463
  n = r
444
464
  if r = arg_config("--"+r.downcase) || config_string(r+"_INSTALL_NAME")
445
465
    rubies << r+EXEEXT
 
466
    $mflags << "#{n}=#{r}"
446
467
  end
447
468
}
448
469
 
451
472
  $mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
452
473
end
453
474
if !$extlist.empty? and $extupdate
454
 
  rm_f(Config::CONFIG["LIBRUBY_SO"])
 
475
  rm_f(RbConfig::CONFIG["LIBRUBY_SO"])
455
476
end
456
477
puts "making #{rubies.join(', ')}"
457
478
$stdout.flush