Skip to content

Commit 9718d93

Browse files
committed
Use perl in Git installation for openssl
1 parent a77ae83 commit 9718d93

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ext/tiny_tds/extconf.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,24 @@ def extract_file(file, target)
151151
end
152152
end
153153

154+
def setup_path
155+
@prev_path = ENV['PATH']
156+
git_perl = 'C:/Program Files/Git/usr/bin'
157+
if File.directory?(git_perl)
158+
ENV['PATH'] = git_perl + ';' + ENV['PATH']
159+
ENV['PERL'] = 'perl'
160+
end
161+
end
162+
163+
def restore_path
164+
ENV['PATH'] = @prev_path
165+
end
166+
154167
def configure
155168
config = if host=~/mingw/
156169
host=~/x86_64/ ? 'mingw64' : 'mingw'
157170
end
171+
setup_path
158172
args = [ "CFLAGS=-DDSO_WIN32",
159173
"./Configure",
160174
"no-shared",
@@ -164,6 +178,7 @@ def configure
164178
args.unshift("CROSS_COMPILE=#{host}-") if enable_config("cross-build")
165179

166180
execute "configure", "sh -c \"#{args.join(" ")}\""
181+
restore_path
167182
end
168183

169184
def dllwrap(dllname, outputlib, deffile, linkto)
@@ -180,6 +195,7 @@ def dllwrap(dllname, outputlib, deffile, linkto)
180195
end
181196

182197
def compile
198+
setup_path
183199
super
184200
# OpenSSL DLLs are called "libcrypto32.dll" and "libssl32.dll" per default,
185201
# regardless to the version. This is best suited to meet the Windows DLL hell.
@@ -189,6 +205,7 @@ def compile
189205
execute "mkdef-ssl32", "(perl util/mkdef.pl ssl 32 >libssl32.def)"
190206
dllwrap("libcrypto32-#{version}-#{host}", "libcrypto.dll.a", "libcrypto32.def", "libcrypto.a -lws2_32 -lgdi32 -lcrypt32")
191207
dllwrap("libssl32-#{version}-#{host}", "libssl.dll.a", "libssl32.def", "libssl.a libcrypto.dll.a")
208+
restore_path
192209
end
193210

194211
def install

0 commit comments

Comments
 (0)