2000-08-03 13:55:54 +04:00
|
|
|
#!./miniruby -sI.
|
|
|
|
|
2010-02-08 10:23:13 +03:00
|
|
|
require './rbconfig'
|
2000-08-03 13:55:54 +04:00
|
|
|
|
* 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 11:34:53 +03:00
|
|
|
CONFIG = RbConfig::MAKEFILE_CONFIG
|
2000-08-03 13:55:54 +04:00
|
|
|
|
2009-06-24 11:09:40 +04:00
|
|
|
version = RUBY_VERSION.split(/\./)
|
2009-02-02 11:14:06 +03:00
|
|
|
patch = CONFIG['PATCHLEVEL']
|
|
|
|
nversion = (version + [patch.to_i < 0 ? '0' : patch]).join(',')
|
|
|
|
sversion = version.join('.') + (patch.to_i < 0 ? 'dev' : "p#{patch}")
|
2000-08-03 13:55:54 +04:00
|
|
|
|
|
|
|
$ruby_name ||= CONFIG["RUBY_INSTALL_NAME"]
|
|
|
|
$rubyw_name ||= CONFIG["RUBYW_INSTALL_NAME"] || $ruby_name.sub(/ruby/, '\&w')
|
2002-09-11 06:38:51 +04:00
|
|
|
$so_name ||= CONFIG["RUBY_SO_NAME"]
|
2000-08-03 13: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 23:48:22 +04:00
|
|
|
[$ruby_name, 'ruby'].find do |i|
|
2004-03-25 13:37:39 +03:00
|
|
|
if i = icons[i]
|
2000-08-03 13:55:54 +04:00
|
|
|
ruby_icon = "1 ICON DISCARDABLE "+i.dump+"\n"
|
|
|
|
end
|
|
|
|
end
|
2006-09-08 23:48:22 +04:00
|
|
|
[$rubyw_name, 'rubyw'].find do |i|
|
2004-03-25 13:37:39 +03:00
|
|
|
if i = icons[i]
|
2000-08-03 13: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 12:38:40 +03: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 23:48:22 +04:00
|
|
|
[$so_name, '.dll', 'VFT_DLL', 'DLL', dll_icons.join],
|
2006-10-24 19:58:51 +04:00
|
|
|
].each do |base, ext, type, desc, icon|
|
2000-08-03 13:55:54 +04:00
|
|
|
open(base + '.rc', "w") { |f|
|
|
|
|
f.binmode if /mingw/ =~ RUBY_PLATFORM
|
|
|
|
|
|
|
|
f.print <<EOF
|
2002-06-11 05:27:48 +04:00
|
|
|
#ifndef __BORLANDC__
|
2000-08-03 13:55:54 +04:00
|
|
|
#include <windows.h>
|
2004-03-25 13:37:39 +03:00
|
|
|
#include <winver.h>
|
2002-06-11 05:27:48 +04:00
|
|
|
#endif
|
2000-08-03 13:55:54 +04:00
|
|
|
|
2006-10-24 19:58:51 +04:00
|
|
|
#{icon || ''}
|
2000-08-03 13:55:54 +04:00
|
|
|
VS_VERSION_INFO VERSIONINFO
|
2008-02-16 21:16:21 +03:00
|
|
|
FILEVERSION #{nversion}
|
|
|
|
PRODUCTVERSION #{nversion}
|
2000-08-03 13:55:54 +04:00
|
|
|
FILEFLAGSMASK 0x3fL
|
|
|
|
FILEFLAGS 0x0L
|
|
|
|
FILEOS VOS__WINDOWS32
|
|
|
|
FILETYPE #{type}
|
|
|
|
FILESUBTYPE VFT2_UNKNOWN
|
|
|
|
BEGIN
|
|
|
|
BLOCK "StringFileInfo"
|
|
|
|
BEGIN
|
|
|
|
BLOCK "000004b0"
|
|
|
|
BEGIN
|
2008-02-16 21:16:21 +03:00
|
|
|
VALUE "Comments", "#{RUBY_RELEASE_DATE}\\0"
|
|
|
|
VALUE "CompanyName", "http://www.ruby-lang.org/\\0"
|
|
|
|
VALUE "FileDescription", "Ruby interpreter (#{desc}) #{sversion} [#{RUBY_PLATFORM}]\\0"
|
|
|
|
VALUE "FileVersion", "#{sversion}\\0"
|
2000-08-03 13:55:54 +04:00
|
|
|
VALUE "InternalName", "#{base + ext}\\0"
|
2004-03-25 15:01:41 +03:00
|
|
|
VALUE "LegalCopyright", "Copyright (C) 1993-#{RUBY_RELEASE_DATE[/\d+/]} Yukihiro Matsumoto\\0"
|
2000-08-03 13:55:54 +04:00
|
|
|
VALUE "OriginalFilename", "#{base + ext}\\0"
|
2008-02-16 21:16:21 +03:00
|
|
|
VALUE "ProductName", "Ruby interpreter #{sversion} [#{RUBY_PLATFORM}]\\0"
|
|
|
|
VALUE "ProductVersion", "#{sversion}\\0"
|
2000-08-03 13:55:54 +04:00
|
|
|
END
|
|
|
|
END
|
|
|
|
BLOCK "VarFileInfo"
|
|
|
|
BEGIN
|
|
|
|
VALUE "Translation", 0x0, 0x4b0
|
|
|
|
END
|
|
|
|
END
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|