2000-08-03 05:55:54 -04:00
|
|
|
#!./miniruby -sI.
|
|
|
|
|
|
|
|
require 'rbconfig'
|
|
|
|
|
* mkconfig.rb: generate RbConfig instead of Config.
* instruby.rb, rubytest.rb, runruby.rb, bcc32/Makefile.sub,
ext/extmk.rb, ext/dl/extconf.rb, ext/iconv/charset_alias.rb,
lib/mkmf.rb, lib/rdoc/ri/ri_paths.rb,
lib/webrick/httpservlet/cgihandler.rb,
test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb,
test/ruby/envutil.rb, test/soap/calc/test_calc_cgi.rb,
test/soap/header/test_authheader_cgi.rb, test/soap/ssl/test_ssl.rb,
win32/mkexports.rb, win32/resource.rb: Use RbConfig instead of
Config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 03:34:53 -05:00
|
|
|
CONFIG = RbConfig::MAKEFILE_CONFIG
|
2000-08-03 05:55:54 -04:00
|
|
|
|
|
|
|
fversion = "#{CONFIG['MAJOR']},#{CONFIG['MINOR']},#{CONFIG['TEENY']},0"
|
|
|
|
|
|
|
|
$ruby_name ||= CONFIG["RUBY_INSTALL_NAME"]
|
|
|
|
$rubyw_name ||= CONFIG["RUBYW_INSTALL_NAME"] || $ruby_name.sub(/ruby/, '\&w')
|
2002-09-10 22:38:51 -04:00
|
|
|
$so_name ||= CONFIG["RUBY_SO_NAME"]
|
2000-08-03 05:55:54 -04:00
|
|
|
|
|
|
|
icons = {}
|
|
|
|
def icons.find(path)
|
|
|
|
if File.directory?(path)
|
|
|
|
Dir.open(File.expand_path(path)) do |d|
|
|
|
|
d.grep(/\.ico$/i) {|i| self[$`] = i}
|
|
|
|
end
|
|
|
|
else
|
|
|
|
self[File.basename(path, '.ico')] = path
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
if ARGV.empty?
|
|
|
|
icons.find('.')
|
|
|
|
else
|
|
|
|
ARGV.each {|i| icons.find(i)}
|
|
|
|
end
|
|
|
|
|
|
|
|
ruby_icon = rubyw_icon = nil
|
2006-09-08 15:48:22 -04:00
|
|
|
[$ruby_name, 'ruby'].find do |i|
|
2004-03-25 05:37:39 -05:00
|
|
|
if i = icons[i]
|
2000-08-03 05:55:54 -04:00
|
|
|
ruby_icon = "1 ICON DISCARDABLE "+i.dump+"\n"
|
|
|
|
end
|
|
|
|
end
|
2006-09-08 15:48:22 -04:00
|
|
|
[$rubyw_name, 'rubyw'].find do |i|
|
2004-03-25 05:37:39 -05:00
|
|
|
if i = icons[i]
|
2000-08-03 05:55:54 -04:00
|
|
|
rubyw_icon = "1 ICON DISCARDABLE "+i.dump+"\n"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
dll_icons = []
|
|
|
|
icons.keys.sort.each do |i|
|
|
|
|
dll_icons << "#{dll_icons.size + 1} ICON DISCARDABLE "+icons[i].dump+"\n"
|
|
|
|
end
|
|
|
|
|
2005-03-03 04:38:40 -05:00
|
|
|
[ # base name extension file type desc, icons
|
|
|
|
[$ruby_name, CONFIG["EXEEXT"], 'VFT_APP', 'CUI', ruby_icon],
|
|
|
|
[$rubyw_name, CONFIG["EXEEXT"], 'VFT_APP', 'GUI', rubyw_icon || ruby_icon],
|
2006-09-08 15:48:22 -04:00
|
|
|
[$so_name, '.dll', 'VFT_DLL', 'DLL', dll_icons.join],
|
2006-10-24 11:58:51 -04:00
|
|
|
].each do |base, ext, type, desc, icon|
|
2000-08-03 05:55:54 -04:00
|
|
|
open(base + '.rc', "w") { |f|
|
|
|
|
f.binmode if /mingw/ =~ RUBY_PLATFORM
|
|
|
|
|
|
|
|
f.print <<EOF
|
2002-06-10 21:27:48 -04:00
|
|
|
#ifndef __BORLANDC__
|
2000-08-03 05:55:54 -04:00
|
|
|
#include <windows.h>
|
2004-03-25 05:37:39 -05:00
|
|
|
#include <winver.h>
|
2002-06-10 21:27:48 -04:00
|
|
|
#endif
|
2000-08-03 05:55:54 -04:00
|
|
|
|
2006-10-24 11:58:51 -04:00
|
|
|
#{icon || ''}
|
2000-08-03 05:55:54 -04:00
|
|
|
VS_VERSION_INFO VERSIONINFO
|
|
|
|
FILEVERSION #{fversion}
|
|
|
|
PRODUCTVERSION #{fversion}
|
|
|
|
FILEFLAGSMASK 0x3fL
|
|
|
|
FILEFLAGS 0x0L
|
|
|
|
FILEOS VOS__WINDOWS32
|
|
|
|
FILETYPE #{type}
|
|
|
|
FILESUBTYPE VFT2_UNKNOWN
|
|
|
|
BEGIN
|
|
|
|
BLOCK "StringFileInfo"
|
|
|
|
BEGIN
|
|
|
|
BLOCK "000004b0"
|
|
|
|
BEGIN
|
2005-03-03 04:38:40 -05:00
|
|
|
VALUE "FileDescription", "Ruby interpreter (#{desc}) #{RUBY_VERSION} [#{RUBY_PLATFORM}]\\0"
|
2000-08-03 05:55:54 -04:00
|
|
|
VALUE "FileVersion", "#{fversion}\\0"
|
|
|
|
VALUE "Home Page", "http://www.ruby-lang.org/\\0"
|
|
|
|
VALUE "InternalName", "#{base + ext}\\0"
|
2004-03-25 07:01:41 -05:00
|
|
|
VALUE "LegalCopyright", "Copyright (C) 1993-#{RUBY_RELEASE_DATE[/\d+/]} Yukihiro Matsumoto\\0"
|
2000-08-03 05:55:54 -04:00
|
|
|
VALUE "OriginalFilename", "#{base + ext}\\0"
|
|
|
|
VALUE "Platform", "#{RUBY_PLATFORM}\\0"
|
|
|
|
VALUE "ProductVersion", "#{fversion}\\0"
|
|
|
|
VALUE "Release Date", "#{RUBY_RELEASE_DATE}\\0"
|
|
|
|
VALUE "Version", "#{RUBY_VERSION}\\0"
|
|
|
|
END
|
|
|
|
END
|
|
|
|
BLOCK "VarFileInfo"
|
|
|
|
BEGIN
|
|
|
|
VALUE "Translation", 0x0, 0x4b0
|
|
|
|
END
|
|
|
|
END
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|