2000-08-03 05:55:54 -04:00
|
|
|
#!./miniruby -sI.
|
|
|
|
|
2010-02-08 02:23:13 -05:00
|
|
|
require './rbconfig'
|
2000-08-03 05: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 03:34:53 -05:00
|
|
|
CONFIG = RbConfig::MAKEFILE_CONFIG
|
2000-08-03 05:55:54 -04:00
|
|
|
|
2009-06-24 03:09:40 -04:00
|
|
|
version = RUBY_VERSION.split(/\./)
|
2009-02-02 03:14:06 -05: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 05:55:54 -04:00
|
|
|
|
|
|
|
$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|
|
2016-01-08 21:46:31 -05:00
|
|
|
next if $output and $output != base
|
2000-08-03 05:55:54 -04:00
|
|
|
open(base + '.rc', "w") { |f|
|
|
|
|
f.binmode if /mingw/ =~ RUBY_PLATFORM
|
|
|
|
|
|
|
|
f.print <<EOF
|
|
|
|
#include <windows.h>
|
2004-03-25 05:37:39 -05:00
|
|
|
#include <winver.h>
|
2000-08-03 05:55:54 -04:00
|
|
|
|
2006-10-24 11:58:51 -04:00
|
|
|
#{icon || ''}
|
2021-05-16 19:33:08 -04:00
|
|
|
#{type == 'VFT_APP' ? "1 RT_MANIFEST ruby.manifest" : ""}
|
2000-08-03 05:55:54 -04:00
|
|
|
VS_VERSION_INFO VERSIONINFO
|
2008-02-16 13:16:21 -05:00
|
|
|
FILEVERSION #{nversion}
|
|
|
|
PRODUCTVERSION #{nversion}
|
2000-08-03 05: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 13:16:21 -05: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 05:55:54 -04:00
|
|
|
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"
|
2008-02-16 13:16:21 -05:00
|
|
|
VALUE "ProductName", "Ruby interpreter #{sversion} [#{RUBY_PLATFORM}]\\0"
|
|
|
|
VALUE "ProductVersion", "#{sversion}\\0"
|
2000-08-03 05:55:54 -04:00
|
|
|
END
|
|
|
|
END
|
|
|
|
BLOCK "VarFileInfo"
|
|
|
|
BEGIN
|
|
|
|
VALUE "Translation", 0x0, 0x4b0
|
|
|
|
END
|
|
|
|
END
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
end
|