@@ -166,6 +166,19 @@ def configure
166166 execute "configure" , "sh -c \" #{ args . join ( " " ) } \" "
167167 end
168168
169+ def dllwrap ( dllname , outputlib , deffile , linkto )
170+ gcc = consolidated_host ( RbConfig ::CONFIG [ "CC" ] )
171+
172+ #RbConfig does not provide dlltool, but it should exist where dllwrap lives
173+ dlltool = consolidated_host ( RbConfig ::CONFIG [ "DLLWRAP" ] ) . sub ( 'dllwrap' , 'dlltool' )
174+
175+ execute "gcc-#{ dllname } -compile" , "#{ gcc } -Wl,--base-file,#{ dllname } .base -mdll -o #{ dllname } .dll --leading-underscore #{ linkto } "
176+ execute "dlltool-#{ dllname } -exp" , "#{ dlltool } --base-file #{ dllname } .base --output-exp #{ dllname } .exp --dllname #{ dllname } .dll --def #{ deffile } "
177+ execute "gcc-#{ dllname } -dll" , "#{ gcc } -Wl,--base-file,#{ dllname } .base #{ dllname } .exp -mdll -o #{ dllname } .dll --leading-underscore #{ linkto } "
178+ execute "dlltool-#{ dllname } -outputlib" , "#{ dlltool } --base-file #{ dllname } .base --output-exp #{ dllname } .exp --dllname #{ dllname } .dll --def #{ deffile } --output-lib #{ outputlib } "
179+ execute "gcc-#{ dllname } -link" , "#{ gcc } #{ dllname } .exp -mdll -o #{ dllname } .dll --leading-underscore #{ linkto } "
180+ end
181+
169182 def compile
170183 super
171184 # OpenSSL DLLs are called "libeay32.dll" and "ssleay32.dll" per default,
@@ -174,9 +187,8 @@ def compile
174187 # with our own naming scheme.
175188 execute "mkdef-libeay32" , "(perl util/mkdef.pl 32 libeay >libeay32.def)"
176189 execute "mkdef-ssleay32" , "(perl util/mkdef.pl 32 ssleay >ssleay32.def)"
177- dllwrap = consolidated_host ( RbConfig ::CONFIG [ "DLLWRAP" ] )
178- execute "dllwrap-libeay32" , "#{ dllwrap } --dllname libeay32-#{ version } -#{ host } .dll --output-lib libcrypto.dll.a --def libeay32.def libcrypto.a -lwsock32 -lgdi32 -lcrypt32"
179- execute "dllwrap-ssleay32" , "#{ dllwrap } --dllname ssleay32-#{ version } -#{ host } .dll --output-lib libssl.dll.a --def ssleay32.def libssl.a libcrypto.dll.a"
190+ dllwrap ( "libeay32-#{ version } -#{ host } " , "libcrypto.dll.a" , "libeay32.def" , "libcrypto.a -lws2_32 -lgdi32 -lcrypt32" )
191+ dllwrap ( "ssleay32-#{ version } -#{ host } " , "libssl.dll.a" , "ssleay32.def" , "libssl.a libcrypto.dll.a" )
180192 end
181193
182194 def install
0 commit comments