2 # This rbconfig.rb corresponds to a Ruby installation for win32 cross-compiled
3 # with mingw under i686-linux. It can be used to cross-compile extensions for
4 # win32 using said toolchain.
6 # This file assumes that a cross-compiled mingw32 build (compatible with the
7 # mswin32 builds) is installed under $HOME/ruby-mingw32.
10 #RUBY_VERSION == "1.8.5" or
11 # raise "ruby lib version (1.8.5) doesn't match executable version (#{RUBY_VERSION})"
13 mingw32 = ENV['MINGW32_RUBY'] || "#{ENV["HOME"]}/ruby-mingw32"
14 mingwpre = ENV['MINGW32_PREFIX']
15 TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32")
16 DESTDIR = '' unless defined? DESTDIR
18 CONFIG["DESTDIR"] = DESTDIR
19 CONFIG["INSTALL"] = "/usr/bin/install -c"
20 CONFIG["prefix"] = (TOPDIR || DESTDIR + mingw32)
21 CONFIG["EXEEXT"] = ".exe"
22 CONFIG["ruby_install_name"] = "ruby"
23 CONFIG["RUBY_INSTALL_NAME"] = "ruby"
24 CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18"
25 CONFIG["SHELL"] = "/bin/sh"
26 CONFIG["PATH_SEPARATOR"] = ":"
27 CONFIG["PACKAGE_NAME"] = ""
28 CONFIG["PACKAGE_TARNAME"] = ""
29 CONFIG["PACKAGE_VERSION"] = ""
30 CONFIG["PACKAGE_STRING"] = ""
31 CONFIG["PACKAGE_BUGREPORT"] = ""
32 CONFIG["exec_prefix"] = "$(prefix)"
33 CONFIG["bindir"] = "$(exec_prefix)/bin"
34 CONFIG["sbindir"] = "$(exec_prefix)/sbin"
35 CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
36 CONFIG["datadir"] = "$(prefix)/share"
37 CONFIG["sysconfdir"] = "$(prefix)/etc"
38 CONFIG["sharedstatedir"] = "$(prefix)/com"
39 CONFIG["localstatedir"] = "$(prefix)/var"
40 CONFIG["libdir"] = "$(exec_prefix)/lib"
41 CONFIG["includedir"] = "$(prefix)/include"
42 CONFIG["oldincludedir"] = "/usr/include"
43 CONFIG["infodir"] = "$(prefix)/info"
44 CONFIG["mandir"] = "$(prefix)/man"
45 CONFIG["build_alias"] = "i686-linux"
46 CONFIG["host_alias"] = "#{mingwpre}"
47 CONFIG["target_alias"] = "i386-mingw32"
49 CONFIG["ECHO_N"] = "-n"
51 CONFIG["LIBS"] = "-lwsock32 "
55 CONFIG["build"] = "i686-pc-linux"
56 CONFIG["build_cpu"] = "i686"
57 CONFIG["build_vendor"] = "pc"
58 CONFIG["build_os"] = "linux"
59 CONFIG["host"] = "i586-pc-mingw32msvc"
60 CONFIG["host_cpu"] = "i586"
61 CONFIG["host_vendor"] = "pc"
62 CONFIG["host_os"] = "mingw32msvc"
63 CONFIG["target"] = "i386-pc-mingw32"
64 CONFIG["target_cpu"] = "i386"
65 CONFIG["target_vendor"] = "pc"
66 CONFIG["target_os"] = "mingw32"
67 CONFIG["CC"] = "#{mingwpre}-gcc"
68 CONFIG["CFLAGS"] = "-g -O2 "
69 CONFIG["LDFLAGS"] = ""
70 CONFIG["CPPFLAGS"] = ""
71 CONFIG["OBJEXT"] = "o"
72 CONFIG["CPP"] = "#{mingwpre}-gcc -E"
73 CONFIG["EGREP"] = "grep -E"
74 CONFIG["GNU_LD"] = "yes"
75 CONFIG["CPPOUTFILE"] = "-o conftest.i"
76 CONFIG["OUTFLAG"] = "-o "
77 CONFIG["YACC"] = "bison -y"
78 CONFIG["RANLIB"] = "#{mingwpre}-ranlib"
79 CONFIG["AR"] = "#{mingwpre}-ar"
80 CONFIG["NM"] = "#{mingwpre}-nm"
81 CONFIG["WINDRES"] = "#{mingwpre}-windres"
82 CONFIG["DLLWRAP"] = "#{mingwpre}-dllwrap"
83 CONFIG["OBJDUMP"] = "#{mingwpre}-objdump"
84 CONFIG["LN_S"] = "ln -s"
85 CONFIG["SET_MAKE"] = ""
86 CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
87 CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
88 CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
89 CONFIG["RM"] = "rm -f"
91 CONFIG["MAKEDIRS"] = "mkdir -p"
92 CONFIG["LIBOBJS"] = " fileblocks$(U).o crypt$(U).o flock$(U).o acosh$(U).o win32$(U).o"
94 CONFIG["DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all"
95 CONFIG["ARCH_FLAG"] = ""
97 CONFIG["CCDLFLAGS"] = ""
98 CONFIG["LDSHARED"] = "#{mingwpre}-gcc -shared -s"
99 CONFIG["DLEXT"] = "so"
100 CONFIG["DLEXT2"] = "dll"
101 CONFIG["LIBEXT"] = "a"
102 CONFIG["LINK_SO"] = ""
103 CONFIG["LIBPATHFLAG"] = " -L\"%s\""
104 CONFIG["RPATHFLAG"] = ""
105 CONFIG["LIBPATHENV"] = ""
106 CONFIG["TRY_LINK"] = ""
107 CONFIG["STRIP"] = "strip"
108 CONFIG["EXTSTATIC"] = ""
109 CONFIG["setup"] = "Setup"
110 CONFIG["MINIRUBY"] = "ruby -rfake"
111 CONFIG["PREP"] = "fake.rb"
112 CONFIG["RUNRUBY"] = "$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`"
113 CONFIG["EXTOUT"] = ".ext"
114 CONFIG["ARCHFILE"] = ""
115 CONFIG["RDOCTARGET"] = ""
116 CONFIG["XCFLAGS"] = " -DRUBY_EXPORT"
117 CONFIG["XLDFLAGS"] = " -Wl,--stack,0x02000000 -L."
118 CONFIG["LIBRUBY_LDSHARED"] = "#{mingwpre}-gcc -shared -s"
119 CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBRUBY)"
120 CONFIG["rubyw_install_name"] = "rubyw"
121 CONFIG["RUBYW_INSTALL_NAME"] = "rubyw"
122 CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
123 CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll"
124 CONFIG["LIBRUBY_ALIASES"] = ""
125 CONFIG["LIBRUBY"] = "lib$(LIBRUBY_SO).a"
126 CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
127 CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
128 CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
129 CONFIG["SOLIBS"] = "$(LIBS)"
130 CONFIG["DLDLIBS"] = ""
131 CONFIG["ENABLE_SHARED"] = "yes"
132 CONFIG["MAINLIBS"] = ""
133 CONFIG["COMMON_LIBS"] = "m"
134 CONFIG["COMMON_MACROS"] = ""
135 CONFIG["COMMON_HEADERS"] = "windows.h winsock.h"
136 CONFIG["EXPORT_PREFIX"] = ""
137 CONFIG["MINIOBJS"] = "dmydln.o"
138 CONFIG["MAKEFILES"] = "Makefile GNUmakefile"
139 CONFIG["arch"] = "i386-mingw32"
140 CONFIG["sitearch"] = "i386-msvcrt"
141 CONFIG["sitedir"] = "$(prefix)/lib/ruby/site_ruby"
142 CONFIG["configure_args"] = "'--host=#{mingwpre}' '--target=i386-mingw32' '--build=i686-linux' '--prefix=#{mingw32}' 'build_alias=i686-linux' 'host_alias=#{mingwpre}' 'target_alias=i386-mingw32'"
143 CONFIG["NROFF"] = "/usr/bin/nroff"
144 CONFIG["MANTYPE"] = "doc"
145 CONFIG["LTLIBOBJS"] = " fileblocks$(U).lo crypt$(U).lo flock$(U).lo acosh$(U).lo win32$(U).lo"
146 CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
147 CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
148 CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
149 CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
150 CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
151 CONFIG["topdir"] = File.dirname(__FILE__)
153 CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
154 def Config::expand(val, config = CONFIG)
155 val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
158 elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
161 Config::expand(key, config)
163 key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
171 CONFIG.each_value do |val|
175 RbConfig = Config # compatibility for ruby-1.9
176 CROSS_COMPILING = nil unless defined? CROSS_COMPILING