diff --git a/README.md b/README.md index 2bac3f967..ee3f31715 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![documentation](https://img.shields.io/badge/-documentation-informational)](https://hurl.dev) -# What's Hurl? +# What's Hurl? Hurl is a command line tool that performs HTTP requests defined in a simple plain text format. @@ -308,6 +308,7 @@ HTTP/* 302 [Doc](https://hurl.dev/docs/capturing-response.html#xpath-capture) # Building +## linux Hurl is written in [Rust](https://www.rust-lang.org/). You should [install](https://www.rust-lang.org/tools/install) the @@ -332,7 +333,9 @@ $ ./target/release/hurl --version cargo install --path packages/hurl ``` +## windows64 +please follow the [contrib/windows section](contrib/windows/README.md) # Feedbacks diff --git a/contrib/windows/README.md b/contrib/windows/README.md new file mode 100644 index 000000000..c0cca6dca --- /dev/null +++ b/contrib/windows/README.md @@ -0,0 +1,11 @@ +# What ? + +This document describes the steps to build the `windows 64bits hurl binary`. + +You just have to follow each chapter sequentially until you get a windows installer allowing the native installation of hurl on your favorite windows 64bits computer. + + +## choose between your prefered build method + +- [using old fashion way with cmd.exe](cmd_build.md) +- [using modern style with powershell.exe](powershell_build.md) diff --git a/contrib/windows/cmd_build.md b/contrib/windows/cmd_build.md new file mode 100644 index 000000000..f3e68ab2d --- /dev/null +++ b/contrib/windows/cmd_build.md @@ -0,0 +1,113 @@ +# What ? + +This document describes the steps to build the `windows 64bits hurl binary` with `cmd.exe`. + +All command have been launched with `admin` privileges on `c:\` root dir and executed sequentially. *(If you don't want to use `c:\` as installation path and git clone path, please replace all its references before executing commands)* + +All the steps have been tested on a `blank` Windows 10 64bits and total operation time is about `30 minutes` with a xdsl connection (5mb/sec). + +You just have to follow each chapter sequentially until you get a windows installer allowing the native installation of hurl on your favorite windows 64bits computer. + +# Win64 workspace installation + +## Manual softwares installation : + +- install `builds tools c++` and `english language` by executing https://visualstudio.microsoft.com/fr/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16 +- install `choco` by executing https://docs.chocolatey.org/en-us/choco/setup#install-with-cmd.exe + +## Command line softwares installation + +```cmd +cd c:\ +choco install --confirm --no-progress curl unxUtils git 7zip nsis python3 winlibs-llvm-free +refreshenv +%ChocolateyInstall%\bin\curl --output "c:\rustup-init.exe" "https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe" +c:\rustup-init.exe -y --default-toolchain stable-x86_64-pc-windows-msvc +setx RUST_BACKTRACE "full" /M +refreshenv +git.exe clone https://github.com/microsoft/vcpkg +c:\vcpkg\bootstrap-vcpkg.bat +setx /M PATH "%PATH%;c:\vcpkg" +setx VCPKGRS_DYNAMIC "1" /M +refreshenv +vcpkg install libxml2:x64-windows +vcpkg integrate install +``` + +## Clone hurl project + +```cmd +git.exe clone https://github.com/Orange-OpenSource/hurl +``` + +## Fix currently known win64 hurl compilation bugs + +```cmd +cp -frp c:\hurl\packages\hurl\src\runner\hurl_file.rs c:\hurl\packages\hurl\src\runner\hurl_file.rs.ori +%ChocolateyInstall%\bin\sed.exe "s/```//g" c:\hurl\packages\hurl\src\runner\hurl_file.rs.ori > c:\hurl\packages\hurl\src\runner\hurl_file.rs +``` + +## Build win64 exe binary + +```cmd +cd c:\hurl +cargo build --release --verbose +mkdir c:\hurl\target\win-package +%ChocolateyInstall%\bin\find c:\hurl\target\release -name "*.dll" | xargs -i cp -frp {} c:\hurl\target\win-package +%ChocolateyInstall%\bin\find c:\hurl\target\release -maxdepth 1 -name "hurl*.exe" | xargs -i cp -frp {} c:\hurl\target\win-package +setx /M PATH "%PATH%;c:\hurl\target\win-package" +refreshenv +``` + +## Test your app + +launch proxy server + +```cmd +pip3 install mitmproxy +start /B mitmdump -p 8888 --modify-header "/From-Proxy/Hello" +``` + +launch test server + +```cmd +pip3 install flask +cd c:\hurl\integration +start /B server.py +``` + +launch hurl unit tests + +```cmd +cd c:\hurl +cargo test +``` + +launch hurl integration tests + +``` +coming soon ... ;) +``` + +## Generate version.txt file + +```cmd +hurl.exe --version | cut -d" " -f2 > c:\hurl\target\win-package\version.txt +``` + +## Create a simple zip package + +```cmd +set /P hurl_package_version= c:\hurl\target\win-package\version.txt +``` + +## Test your app + +install proxy and server + +```powershell +pip3 install mitmproxy flask +``` + +Keep original powershell prompt on background, and open one more separate powershell prompt to launch the server + +```powershell +cd c:\hurl\integration +python server.py +``` + +Keep original powershell prompt on background, and open one more separate powershell prompt to launch the proxy + +```powershell +mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" +``` + +focus on original powershell prompt and launch hurl unit tests + +```powershell +cd c:\hurl\integration +cargo test --verbose +``` + +launch hurl integration tests + +```powershell +coming soon ... ;) +``` + +## Generate version.txt file + +```powershell +((c:\hurl\target\win-package\hurl.exe --version) -Split " ")[1] > c:\hurl\target\win-package\version.txt +``` + +## Create a simple zip package + +```powershell +$hurl_package_version = Get-Content c:\hurl\target\win-package\version.txt +cd c:\hurl\target\win-package +Get-ChildItem -Path *.dll, *hurl.exe, *.txt | Compress-Archive -DestinationPath hurl_${hurl_package_version}_win64.zip +``` + +## Create a real package installer for win64 + +```powershell +cd c:\hurl\target\win-package +$oldpath = Get-ItemProperty -Path HKCU:\Environment -Name Path +$newpath = $oldpath.Path += ";C:\Program Files (x86)\NSIS\Bin" +Set-ItemProperty -Path HKCU:\Environment -Name Path -Value $newpath +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +makensis.exe /NOCD /V4 ..\..\contrib\windows\hurl.nsi +```