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

« back to all changes in this revision

Viewing changes to bcc32/mkexports.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:
1
1
#!./miniruby -s
2
2
 
3
 
SYM = {}
4
 
STDIN.reopen(open("nul"))
5
 
ARGV.each do |obj|
6
 
  IO.foreach("|tdump -q -oiPUBDEF -oiPUBD32 #{obj.tr('/', '\\')}") do |l|
7
 
    next unless /(?:PUBDEF|PUBD32)/ =~ l
8
 
    SYM[$1] = true if /'(.*?)'/ =~ l
9
 
  end
10
 
end
11
 
 
12
 
exports = []
13
 
if $name
14
 
  exports << "Name " + $name
15
 
elsif $library
16
 
  exports << "Library " + $library
17
 
end
18
 
exports << "Description " + $description.dump if $description
19
 
exports << "EXPORTS" << SYM.keys.sort
20
 
 
21
 
if $output
22
 
  open($output, 'w') {|f| f.puts exports.join("\n")}
23
 
else
24
 
  puts exports.join("\n")
 
3
$:.unshift(File.expand_path("../..", __FILE__))
 
4
require 'win32/mkexports'
 
5
 
 
6
class Exports::Bcc < Exports
 
7
  Forwards = /^rb_w32_(\w+)/
 
8
 
 
9
  def forwarding(internal, export)
 
10
    internal[/\A_?/]+export
 
11
  end
 
12
 
 
13
  def each_export(objs)
 
14
    objs.each do |obj|
 
15
    opt = /\.(?:so|dll)\z/i =~ obj ? "-ee" : "-oiPUBDEF -oiPUBD32"
 
16
    IO.foreach("|tdump -q #{opt} #{obj.tr('/', '\\')} < nul") do |l|
 
17
      next unless /(?:PUBDEF|PUBD32|EXPORT)/ =~ l
 
18
        yield $1 if /'(.*?)'/ =~ l
 
19
      end
 
20
    end
 
21
    yield "_strcasecmp", "_stricmp"
 
22
    yield "_strncasecmp", "_strnicmp"
 
23
  end
25
24
end