From 5d0705bba5c5138f7e1aa245a894696868c0182f Mon Sep 17 00:00:00 2001 From: Filipe PINTO Date: Fri, 20 Oct 2023 10:32:57 +0200 Subject: [PATCH 1/2] Support http2 on windows --- bin/install_prerequisites_windows.ps1 | 2 +- bin/release/create_windows64_zip_package.ps1 | 2 +- bin/release/release.ps1 | 10 ++++++++-- bin/windows/hurl.nsi | 10 +++++----- contrib/windows/README.md | 17 +++-------------- integration/tests_ok/http_version_2_option.ps1 | 7 ------- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/bin/install_prerequisites_windows.ps1 b/bin/install_prerequisites_windows.ps1 index b5ebd02636a..32741abe5ac 100644 --- a/bin/install_prerequisites_windows.ps1 +++ b/bin/install_prerequisites_windows.ps1 @@ -9,7 +9,7 @@ git -C ((Get-command vcpkg).Source | Split-Path) pull # install libxml and libcurl[openssl] $vcpkg_dir=(Get-command vcpkg).Source -vcpkg install --recurse --x-use-aria2 curl:x64-windows || true +vcpkg install --recurse --x-use-aria2 curl[core,non-http,schannel,ssl,sspi,http2]:x64-windows || true vcpkg install --recurse --x-use-aria2 libxml2[core,iconv]:x64-windows || true vcpkg update diff --git a/bin/release/create_windows64_zip_package.ps1 b/bin/release/create_windows64_zip_package.ps1 index 46912c580cf..807c8573f37 100644 --- a/bin/release/create_windows64_zip_package.ps1 +++ b/bin/release/create_windows64_zip_package.ps1 @@ -11,7 +11,7 @@ $toolchain=((((rustup show active-toolchain) -Split " ")[0]) -Split "-",2)[1] # create windows64 zip package cd $PSScriptRoot\..\..\target\win-package -Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md -Exclude hex_literal* | Compress-Archive -DestinationPath hurl-${hurl_package_version}-${toolchain}.zip +Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md | Compress-Archive -DestinationPath hurl-${hurl_package_version}-${toolchain}.zip Get-ChildItem .\*win64.zip cd $actual_dir diff --git a/bin/release/release.ps1 b/bin/release/release.ps1 index 828928e37bc..bc2e008e4fe 100644 --- a/bin/release/release.ps1 +++ b/bin/release/release.ps1 @@ -11,11 +11,17 @@ cargo build --release --verbose --locked if ($LASTEXITCODE) { Throw } # create final package +$lib_dir=((Get-Command vcpkg).Source | Split-path) + "\installed\x64-windows\bin" $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" +Copy-Item -Path $lib_dir\libcurl.dll -Destination $package_dir +Copy-Item -Path $lib_dir\zlib1.dll -Destination $package_dir +Copy-Item -Path $lib_dir\nghttp2.dll -Destination $package_dir +Copy-Item -Path $lib_dir\libxml2.dll -Destination $package_dir +Copy-Item -Path $lib_dir\iconv-2.dll -Destination $package_dir +Copy-Item -Path $release_dir\hurl.exe -Destination $package_dir +Copy-Item -Path $release_dir\hurlfmt.exe -Destination $package_dir ((& $package_dir\hurl --version) -Split " ")[1] > $package_dir\version.txt Get-Content $package_dir\version.txt diff --git a/bin/windows/hurl.nsi b/bin/windows/hurl.nsi index 565c50f9bb1..1b4d293b321 100644 --- a/bin/windows/hurl.nsi +++ b/bin/windows/hurl.nsi @@ -89,11 +89,6 @@ SectionGroup "executables" SectionGroupEnd SectionGroup "dlls" - Section "charset-1.dll" - SectionIn RO - SetOutPath $INSTDIR - File "charset-1.dll" - SectionEnd Section "iconv-2.dll" SectionIn RO SetOutPath $INSTDIR @@ -114,6 +109,11 @@ SectionGroup "dlls" SetOutPath $INSTDIR File "libcurl.dll" SectionEnd + Section "nghttp2.dll" + SectionIn RO + SetOutPath $INSTDIR + File "nghttp2.dll" + SectionEnd SectionGroupEnd SectionGroup "txt" diff --git a/contrib/windows/README.md b/contrib/windows/README.md index a481f0fafc1..809870ff8d7 100644 --- a/contrib/windows/README.md +++ b/contrib/windows/README.md @@ -54,16 +54,6 @@ Set-ItemProperty -Path HKCU:\Environment -Name Path -Value $newpath $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") ``` -Install build libs requirement - -```pwsh -vcpkg install --recurse --x-use-aria2 curl:x64-windows -vcpkg install --recurse --x-use-aria2 libxml2[core,iconv]:x64-windows -vcpkg integrate install -Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1" -$env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User") -``` - # Clone hurl project ```pwsh @@ -71,18 +61,18 @@ cd c:\ git.exe clone https://github.com/Orange-OpenSource/hurl.git ``` -# Test your app +# Build ```pwsh cd c:\hurl -.\bin\test\test.ps1 +.\bin\install_prerequisites_windows.ps1 +.\bin\release\release.ps1 ``` # Create a simple zip package ```pwsh cd c:\hurl -.\bin\release\release.ps1 .\bin\release\create_windows64_zip_package.ps1 ``` @@ -90,7 +80,6 @@ cd c:\hurl ```pwsh cd c:\hurl -.\bin\release\release.ps1 .\bin\release\create_windows64_installer.ps1 ``` diff --git a/integration/tests_ok/http_version_2_option.ps1 b/integration/tests_ok/http_version_2_option.ps1 index c784d3e7851..7650fea57dc 100755 --- a/integration/tests_ok/http_version_2_option.ps1 +++ b/integration/tests_ok/http_version_2_option.ps1 @@ -1,11 +1,4 @@ Set-StrictMode -Version latest $ErrorActionPreference = 'Stop' -$ErrorActionPreference = 'Continue' -curl --version | grep Features | grep -q HTTP2 -if ($LASTEXITCODE -eq 1) { - exit 255 -} -$ErrorActionPreference = 'Stop' - hurl tests_ok/http_version_2_option.hurl From 85722df858c588ee1f418daeceef79fb6fb76e42 Mon Sep 17 00:00:00 2001 From: fpinto Date: Fri, 20 Oct 2023 15:39:22 +0200 Subject: [PATCH 2/2] wip --- bin/install_prerequisites_windows.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/install_prerequisites_windows.ps1 b/bin/install_prerequisites_windows.ps1 index 32741abe5ac..ad8affc7497 100644 --- a/bin/install_prerequisites_windows.ps1 +++ b/bin/install_prerequisites_windows.ps1 @@ -4,22 +4,25 @@ $ErrorActionPreference = 'Stop' write-host -foregroundcolor Cyan "----- install system prerequisites -----" # update vcpkg install -git -C ((Get-command vcpkg).Source | Split-Path) pull +$vcpkg_dir=((Get-command vcpkg).Source | Split-Path) +$lib_dir="$vcpkg_dir\installed\x64-windows\bin" +git -C $vcpkg_dir pull # install libxml and libcurl[openssl] -$vcpkg_dir=(Get-command vcpkg).Source - vcpkg install --recurse --x-use-aria2 curl[core,non-http,schannel,ssl,sspi,http2]:x64-windows || true vcpkg install --recurse --x-use-aria2 libxml2[core,iconv]:x64-windows || true - vcpkg update if ($LASTEXITCODE) { Throw } vcpkg upgrade --no-dry-run if ($LASTEXITCODE) { Throw } vcpkg integrate install +if ($LASTEXITCODE) { Throw } Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1" $env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User") if ($LASTEXITCODE) { Throw } +Set-ItemProperty -Path HKCU:\Environment -Name Path -Value $lib_dir +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +if ($LASTEXITCODE) { Throw } # update pip python -m pip install --upgrade pip --quiet