Pārlūkot izejas kodu

v2.2: ci(windows): use vcpkg to install openssl 3.4.1 (backport of #6824) (#6833)

ci(windows): use vcpkg to install openssl 3.4.1 (#6824)

(cherry picked from commit a164bb6ba33b15971fd7fc02badcbad5f0dc0ecf)

Co-authored-by: Yihau Chen <yihau.chen@icloud.com>
mergify[bot] 4 mēneši atpakaļ
vecāks
revīzija
ba420b928d
1 mainītis faili ar 23 papildinājumiem un 6 dzēšanām
  1. 23 6
      .github/scripts/install-openssl.sh

+ 23 - 6
.github/scripts/install-openssl.sh

@@ -6,12 +6,29 @@ os_name="$1"
 
 
 case "$os_name" in
 case "$os_name" in
 "Windows")
 "Windows")
-  echo "Downloading OpenSSL installer..."
-  curl -L -o "openssl-installer.exe" "https://slproweb.com/download/Win64OpenSSL-3_4_2.exe"
-  echo "Installing OpenSSL..."
-  cmd.exe /c "openssl-installer.exe /verysilent /sp- /suppressmsgboxes /norestart /DIR=C:\OpenSSL"
-  export OPENSSL_LIB_DIR="C:\OpenSSL\lib\VC\x64\MT"
-  export OPENSSL_INCLUDE_DIR="C:\OpenSSL\include"
+  # initialize vcpkg.json. the builtin-baseline is the commit that contains required version.
+  # the commit hash can be found in https://github.com/microsoft/vcpkg with `git log --pretty=format:"%H %s" | grep openssl`
+  # can be verified with:
+  # web:
+  #     https://github.com/microsoft/vcpkg/blob/__COMMIT_HASH__/versions/o-/openssl.json
+  # command:
+  #     git show __COMMIT_HASH__:versions/o-/openssl.json
+  cat > vcpkg.json <<EOL
+{
+  "dependencies": ["openssl"],
+  "overrides": [
+    {
+      "name": "openssl",
+      "version": "3.4.1"
+    }
+  ],
+  "builtin-baseline": "5ee5eee0d3e9c6098b24d263e9099edcdcef6631"
+}
+EOL
+  vcpkg install --triplet x64-windows-static-md
+  rm vcpkg.json
+  export OPENSSL_LIB_DIR="$PWD/vcpkg_installed/x64-windows-static-md/lib"
+  export OPENSSL_INCLUDE_DIR="$PWD/vcpkg_installed/x64-windows-static-md/include"
   ;;
   ;;
 "macOS") ;;
 "macOS") ;;
 "Linux") ;;
 "Linux") ;;