Use openssl3 for libcurl on windows

This commit is contained in:
fpinto 2022-12-28 00:04:26 +01:00
parent e542c27771
commit 290a7564d7
No known key found for this signature in database
GPG Key ID: F4F06B068FB00692
7 changed files with 70 additions and 12 deletions

42
Cargo.lock generated
View File

@ -423,6 +423,21 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
"foreign-types-shared",
]
[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.1.0"
@ -518,6 +533,7 @@ dependencies = [
"libflate",
"libxml",
"md5",
"openssl",
"percent-encoding",
"regex",
"serde",
@ -763,6 +779,32 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "openssl"
version = "0.10.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1"
dependencies = [
"bitflags",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
[[package]]
name = "openssl-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"

View File

@ -1,11 +1,11 @@
powershell write-host -foregroundcolor Cyan "----- install system prerequisites -----"
# install libxml and libcurl
# install libxml and libcurl[openssl]
$vcpkg_dir=(Get-command vcpkg).Source
if (Test-Path $vcpkg_dir\installed\x64-windows\lib\libcurl.lib) {echo "curl already installed"} else {vcpkg install curl:x64-windows}
if (Test-Path $vcpkg_dir\installed\x64-windows\lib\libxml2.lib) {echo "libxml2 already installed"} else {vcpkg install libxml2:x64-windows}
if (Test-Path $vcpkg_dir\installed\x64-windows\bin\libssl-3-x64.dll) {echo "curl[openssl] already installed"} else {vcpkg install --recurse curl[openssl]:x64-windows}
if (Test-Path $vcpkg_dir\installed\x64-windows\bin\libxml2.dll) {echo "libxml2 already installed"} else {vcpkg install --recurse libxml2:x64-windows}
vcpkg update
vcpkg upgrade
vcpkg upgrade --no-dry-run
vcpkg integrate install
# update pip

View File

@ -10,8 +10,8 @@ cargo build --release --verbose --locked
$release_dir="$project_root_path\target\release"
$package_dir="$project_root_path\target\win-package"
New-Item -ItemType Directory -Force -Path $package_dir
Get-ChildItem -Path "$release_dir" -Recurse -Include *.dll -File | Copy-Item -Destination "$package_dir"
Get-ChildItem -Path "$release_dir" -Recurse -Include hurl*.exe -File | Copy-Item -Destination "$package_dir"
Get-ChildItem -Path $release_dir\build -Recurse -Include *.dll -File | Copy-Item -Destination "$package_dir"
Get-ChildItem -Path $release_dir -Recurse -Include hurl*.exe -File | Copy-Item -Destination "$package_dir"
((& $package_dir\hurl --version) -Split " ")[1] > $package_dir\version.txt
Get-Content $package_dir\version.txt

View File

@ -8,7 +8,7 @@ $project_root_path=(Resolve-Path -LiteralPath $PSScriptRoot\..\..).path
$release_dir="$project_root_path\target\release"
$package_dir="$project_root_path\target\test-package"
New-Item -ItemType Directory -Force -Path "$package_dir"
Get-ChildItem -Path $release_dir -Recurse -Include *.dll -File | Copy-Item -Destination $package_dir
Get-ChildItem -Path $release_dir\build -Recurse -Include *.dll -File | Copy-Item -Destination $package_dir
Get-ChildItem -Path $release_dir -Recurse -Include hurl*.exe -File | Copy-Item -Destination $package_dir
# add hurl to PATH

View File

@ -119,6 +119,21 @@ SectionGroup "dlls"
SetOutPath $INSTDIR
File "libcurl.dll"
SectionEnd
Section "libssl-3-x64.dll"
SectionIn RO
SetOutPath $INSTDIR
File "libssl-3-x64.dll"
SectionEnd
Section "libcrypto-3-x64.dll"
SectionIn RO
SetOutPath $INSTDIR
File "libcrypto-3-x64.dll"
SectionEnd
Section "legacy.dll"
SectionIn RO
SetOutPath $INSTDIR
File "legacy.dll"
SectionEnd
SectionGroupEnd
SectionGroup "txt"

View File

@ -26,7 +26,7 @@ $oldpath = Get-ItemProperty -Path HKCU:\Environment -Name Path
$newpath = $oldpath.Path += ";c:\vcpkg"
Set-ItemProperty -Path HKCU:\Environment -Name Path -Value $newpath
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
vcpkg install libxml2:x64-windows curl:x64-windows
vcpkg install libxml2:x64-windows curl[openssl]:x64-windows
vcpkg integrate install
Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1"
$env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User")
@ -45,9 +45,9 @@ git.exe clone https://github.com/Orange-OpenSource/hurl
```powershell
cd c:\hurl
cargo build --release --verbose
New-Item -ItemType "Directory" -Path "c:\hurl\target" -Name "win-package"
Get-ChildItem -Path "c:\hurl\target\release" -Recurse -Include *.dll -File | Copy-Item -Destination "c:\hurl\target\win-package"
Get-ChildItem -Path "c:\hurl\target\release" -Recurse -Include hurl*.exe -File | Copy-Item -Destination "c:\hurl\target\win-package"
New-Item -ItemType "Directory" -Path c:\hurl\target -Name "win-package"
Get-ChildItem -Path c:\hurl\target\release\build -Recurse -Include *.dll -File | Copy-Item -Destination "c:\hurl\target\win-package"
Get-ChildItem -Path c:\hurl\target\release -Recurse -Include hurl*.exe -File | Copy-Item -Destination "c:\hurl\target\win-package"
((c:\hurl\target\win-package\hurl.exe --version) -Split " ")[1] > c:\hurl\target\win-package\version.txt
$oldpath = Get-ItemProperty -Path HKCU:\Environment -Name Path
$newpath = $oldpath.Path += ";c:\hurl\target\win-package"
@ -116,7 +116,7 @@ Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md -Exclude
```powershell
cd c:\hurl
Get-Command Expand-Archive
Expand-Archive -Path '.\bin\windows\EnVar_plugin.zip' -DestinationPath 'C:\Program Files (x86)\NSIS' -Verbose
Expand-Archive -Path .\bin\windows\EnVar_plugin.zip -DestinationPath 'C:\Program Files (x86)\NSIS' -Verbose
cd c:\hurl\target\win-package
$oldpath = Get-ItemProperty -Path HKCU:\Environment -Name Path
$newpath = $oldpath.Path += ";C:\Program Files (x86)\NSIS\Bin"

View File

@ -48,6 +48,7 @@ termion = "2.0.1"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"
openssl = "0.10.45"
[build-dependencies]
cc = "1.0.78"