@@ -23,6 +23,37 @@ class << self
2323
2424 OPENSSL_PKG = 'packages/openssl_x64-windows'
2525
26+ def copy_ssl_files
27+ # Locations for vcpkg OpenSSL build
28+ # X509::DEFAULT_CERT_FILE C:\vcpkg\packages\openssl_x64-windows/cert.pem
29+ # X509::DEFAULT_CERT_DIR C:\vcpkg\packages\openssl_x64-windows/certs
30+ # Config::DEFAULT_CONFIG_FILE C:\vcpkg\packages\openssl_x64-windows/openssl.cnf
31+
32+ vcpkg_u = VCPKG . gsub "\\ " , '/'
33+
34+ # make certs dir
35+ export_ssl_path = "#{ EXPORT_DIR } /#{ PKG_NAME } /#{ OPENSSL_PKG } "
36+ FileUtils . mkdir_p "#{ export_ssl_path } /certs"
37+
38+ # updating OpenSSL package may overwrite cert.pem
39+ cert_path = "#{ RbConfig ::TOPDIR } /ssl/cert.pem"
40+
41+ if File . readable? cert_path
42+ vcpkg_ssl_path = "#{ vcpkg_u } /#{ OPENSSL_PKG } "
43+ unless Dir . exist? vcpkg_ssl_path
44+ FileUtils . mkdir_p vcpkg_ssl_path
45+ end
46+ IO . copy_stream cert_path , "#{ vcpkg_ssl_path } /cert.pem"
47+ IO . copy_stream cert_path , "#{ export_ssl_path } /cert.pem"
48+ end
49+
50+ # copy openssl.cnf file
51+ conf_path = "#{ vcpkg_u } /installed/x64-windows/tools/openssl/openssl.cnf"
52+ if File . readable? conf_path
53+ IO . copy_stream conf_path , "#{ export_ssl_path } /openssl.cnf"
54+ end
55+ end
56+
2657 def generate_package_files
2758 ENV [ 'VCPKG_ROOT' ] = VCPKG
2859
@@ -45,29 +76,17 @@ def generate_package_files
4576 "./vcpkg export --triplet=x64-windows #{ PACKAGES } --raw --output=#{ PKG_NAME } --output-dir=#{ EXPORT_DIR } "
4677 end
4778
48- # Locations for vcpkg OpenSSL build
49- # X509::DEFAULT_CERT_FILE C:\vcpkg\packages\openssl_x64-windows/cert.pem
50- # X509::DEFAULT_CERT_DIR C:\vcpkg\packages\openssl_x64-windows/certs
51- # Config::DEFAULT_CONFIG_FILE C:\vcpkg\packages\openssl_x64-windows/openssl.cnf
52-
53- # make certs dir and copy openssl.cnf file
54- ssl_path = "#{ EXPORT_DIR } /#{ PKG_NAME } /#{ OPENSSL_PKG } "
55- FileUtils . mkdir_p "#{ ssl_path } /certs"
56-
5779 vcpkg_u = VCPKG . gsub "\\ " , '/'
5880
59- cnf_path = "#{ vcpkg_u } /installed/x64-windows/tools/openssl/openssl.cnf"
60- if File . readable? cnf_path
61- IO . copy_stream cnf_path , "#{ ssl_path } /openssl.cnf"
62- end
63-
6481 # vcpkg/installed/status contains a list of installed packages
6582 status_path = 'installed/vcpkg/status'
6683 IO . copy_stream "#{ vcpkg_u } /#{ status_path } " , "#{ EXPORT_DIR } /#{ PKG_NAME } /#{ status_path } "
6784 end
6885
6986 def run
7087 generate_package_files
88+
89+ copy_ssl_files
7190
7291 # create 7z archive file
7392 tar_path = "#{ __dir__ } \\ #{ PKG_NAME } .7z" . gsub '/' , '\\'
0 commit comments