Merge pull request #1387 from zabbix/trunk_windows

Updated build process for Zabbix agent (windows)
This commit is contained in:
Alexey Pustovalov 2024-05-20 21:09:36 +09:00 committed by GitHub
commit 5a776c3350
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -180,89 +180,4 @@ RUN Set-Location -Path $env:SystemDrive\.; `
`
Write-Host 'Removing downloaded...'; `
Remove-Item -Force -Recurse $env:TEMP\*; `
Write-Host 'Build environment is ready...'; `
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
`
New-Item -ItemType directory -Path $env:BUILD_OUTPUT -Force | Out-Null; `
New-Item -ItemType directory -Path $env:BUILD_SRC -Force | Out-Null; `
Set-Location -Path $env:BUILD_SRC; `
`
Write-Host ('Downloading {0} ...' -f $env:PCRE2_URL); `
Invoke-WebRequest -OutFile $env:TEMP\pcre2.zip -Uri $env:PCRE2_URL; `
`
$sha256 = 'F2816E84DD7A402068797501BF69E24ECA18D882ADB2143DE9F831F39B850257'; `
$d_sha256 = (Get-FileHash $env:TEMP\pcre2.zip -Algorithm sha256).Hash; `
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
if ($d_sha256 -ne $sha256) { `
Write-Host ('Checksum PCRE2 library ({0}) failed!' -f $d_sha256); `
exit 1; `
}; `
`
Write-Host ('Downloading {0} ...' -f $env:OPENSSL_URL); `
Invoke-WebRequest -OutFile $env:TEMP\openssl.tar.gz -Uri $env:OPENSSL_URL; `
`
$sha256 = '53E66B043322A606ABF0087E7699A0E033A37FA13FEB9742DF35C3A33B18FB02'; `
$d_sha256 = (Get-FileHash $env:TEMP\openssl.tar.gz -Algorithm sha256).Hash; `
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
if ($d_sha256 -ne $sha256) { `
Write-Host ('Checksum OpenSSL library ({0}) failed!' -f $d_sha256); `
exit 1; `
}; `
`
Write-Host 'Extracting PCRE2 archive ...'; `
Expand-Archive -Path $env:TEMP\pcre2.zip -DestinationPath $env:BUILD_SRC; `
`
Write-Host 'Removing downloaded ...'; `
Remove-Item -Force -Path $env:TEMP\pcre2.zip; `
Rename-Item -Path $env:BUILD_SRC\pcre2-$env:PCRE2_VERSION -NewName $env:BUILD_SRC\pcre2; `
`
Write-Host 'Extracting OpenSSL archive ...'; `
$env:SystemDirectory = [Environment]::SystemDirectory; `
tar -zxf "$env:TEMP\openssl.tar.gz"; `
`
Write-Host 'Removing downloaded...'; `
Remove-Item -Force -Path $env:TEMP\openssl.tar.gz; `
Rename-Item -Path $env:BUILD_SRC\openssl-$env:OPENSSL_VERSION -NewName $env:BUILD_SRC\openssl; `
`
Write-Host 'Building PCRE2 library ...'; `
Set-Location -Path $env:BUILD_SRC\pcre2; `
cmake --log-level=ERROR `
-G 'MinGW Makefiles' `
-DBUILD_SHARED_LIBS=OFF `
-DBUILD_STATIC_LIBS=ON `
-DPCRE2_DEBUG=OFF `
-DPCRE2_BUILD_TESTS=OFF `
-DINSTALL_MSVC_PDB=OFF `
-DCMAKE_C_COMPILER=gcc `
-DCMAKE_C_FLAGS='-O2 -g' `
-DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\pcre2""" . ; `
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; `
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; `
mingw32-make -s clean | Out-Null; `
Remove-Item -Path $env:BUILD_OUTPUT\pcre2\man -Force -Recurse; `
Remove-Item -Path $env:BUILD_OUTPUT\pcre2\share -Force -Recurse; `
Write-Host 'PCRE2 is ready...'; `
`
Write-Host 'Building OpenSSL library...'; `
Set-Location -Path $env:BUILD_SRC\openssl; `
perl Configure `
mingw64 `
no-shared `
no-ui-console `
no-tests `
no-unit-test `
no-capieng `
--api=1.1.0 `
--libdir=lib `
--prefix=$env:BUILD_OUTPUT/openssl `
--openssldir=$env:BUILD_OUTPUT/openssl_ssl; `
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" build_sw; `
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install_dev; `
mingw32-make -s clean | Out-Null; `
Write-Host 'OpenSSL is ready...'; `
`
Write-Host 'Removing downloaded...'; `
Remove-Item -Force -Recurse $env:SystemDrive\msys64; `
Remove-Item -Force -Recurse $env:SystemDrive\mingw64; `
Remove-Item -Force -Recurse $env:TEMP\*; `
Write-Host 'Building completed ...';
Write-Host 'Build environment is ready...';