5 CONFIG = RbConfig::MAKEFILE_CONFIG
7 version = %w'MAJOR MINOR TEENY PATCHLEVEL'.map{|v| CONFIG[v] || '0'}
8 nversion = version.join(',')
9 sversion = version.join('.')
11 $ruby_name ||= CONFIG["RUBY_INSTALL_NAME"]
12 $rubyw_name ||= CONFIG["RUBYW_INSTALL_NAME"] || $ruby_name.sub(/ruby/, '\&w')
13 $so_name ||= CONFIG["RUBY_SO_NAME"]
17 if File.directory?(path)
18 Dir.open(File.expand_path(path)) do |d|
19 d.grep(/\.ico$/i) {|i| self[$`] = i}
22 self[File.basename(path, '.ico')] = path
30 ARGV.each {|i| icons.find(i)}
33 ruby_icon = rubyw_icon = nil
34 [$ruby_name, 'ruby'].find do |i|
36 ruby_icon = "1 ICON DISCARDABLE "+i.dump+"\n"
39 [$rubyw_name, 'rubyw'].find do |i|
41 rubyw_icon = "1 ICON DISCARDABLE "+i.dump+"\n"
45 icons.keys.sort.each do |i|
46 dll_icons << "#{dll_icons.size + 1} ICON DISCARDABLE "+icons[i].dump+"\n"
49 [ # base name extension file type desc, icons
50 [$ruby_name, CONFIG["EXEEXT"], 'VFT_APP', 'CUI', ruby_icon],
51 [$rubyw_name, CONFIG["EXEEXT"], 'VFT_APP', 'GUI', rubyw_icon || ruby_icon],
52 [$so_name, '.dll', 'VFT_DLL', 'DLL', dll_icons.join],
53 ].each do |base, ext, type, desc, icon|
54 open(base + '.rc', "w") { |f|
55 f.binmode if /mingw/ =~ RUBY_PLATFORM
64 VS_VERSION_INFO VERSIONINFO
65 FILEVERSION #{nversion}
66 PRODUCTVERSION #{nversion}
71 FILESUBTYPE VFT2_UNKNOWN
73 BLOCK "StringFileInfo"
77 VALUE "Comments", "#{RUBY_RELEASE_DATE}\\0"
78 VALUE "CompanyName", "http://www.ruby-lang.org/\\0"
79 VALUE "FileDescription", "Ruby interpreter (#{desc}) #{sversion} [#{RUBY_PLATFORM}]\\0"
80 VALUE "FileVersion", "#{sversion}\\0"
81 VALUE "InternalName", "#{base + ext}\\0"
82 VALUE "LegalCopyright", "Copyright (C) 1993-#{RUBY_RELEASE_DATE[/\d+/]} Yukihiro Matsumoto\\0"
83 VALUE "OriginalFilename", "#{base + ext}\\0"
84 VALUE "ProductName", "Ruby interpreter #{sversion} [#{RUBY_PLATFORM}]\\0"
85 VALUE "ProductVersion", "#{sversion}\\0"
90 VALUE "Translation", 0x0, 0x4b0