Updated build process for Zabbix agent (windows)

This commit is contained in:
Alexey Pustovalov 2024-05-21 14:56:57 +09:00
parent 150ecc6f16
commit d53ff2fabe

View File

@ -20,7 +20,7 @@ ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi
ARG MINGW_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z
ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/17/release/vs_buildtools.exe
ARG GOLANG_URL=https://go.dev/dl/go$GOLANG_VERSION.windows-amd64.zip
ARG MSYS2_URL=https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe
ARG MSYS2_URL=https://api.github.com/repos/msys2/msys2-installer/releases/latest
ARG PCRE2_URL=https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.zip
ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
@ -100,7 +100,10 @@ RUN Set-Location -Path $env:SystemDrive\.; `
}; `
`
Write-Host ('Downloading {0} ...' -f $env:MSYS2_URL); `
Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri $env:MSYS2_URL; `
Invoke-WebRequest -OutFile $env:TEMP\msys2.sfx.exe -Uri -Uri $(Invoke-RestMethod -UseBasicParsing $env:MSYS2_URL | `
Select -ExpandProperty "assets" | `
Select -ExpandProperty "browser_download_url" | `
Select-String -Pattern '.sfx.exe$').ToString(); `
`
$sha256 = 'D96C53ECBFA4B9D81F6C58077965BB2E31472A8BDA4D4446EF8F45F9C601B11D'; `
$d_sha256 = (Get-FileHash $env:TEMP\msys2.sfx.exe -Algorithm sha256).Hash; `
@ -146,13 +149,14 @@ RUN Set-Location -Path $env:SystemDrive\.; `
`
Write-Host 'Installing MSYS2...'; `
& $env:TEMP\msys2.sfx.exe -y -o"""$env:SystemDrive\""" | Out-Null; `
bash -lc 'pacman --noconfirm -Syuu'; `
bash -lc 'pacman --noconfirm -Syuu'; `
bash -lc 'pacman --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; `
bash -lc 'pacman --noconfirm -Scc'; `
bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; `
bash -lc 'pacman --noprogressbar --noconfirm -Syuu'; `
bash -lc 'pacman --noprogressbar --sync --quiet --noconfirm mingw-w64-ucrt-x86_64-cmake'; `
bash -lc 'pacman --noprogressbar --noconfirm -Scc'; `
bash -lc 'rm -rf /usr/share/info/ /usr/share/zoneinfo/ /usr/share/locale/ /usr/share/man/ /usr/lib/terminfo/'; `
bash -lc 'rm -rf /usr/share/doc/ /ucrt64/share/doc /ucrt64/share/man /ucrt64/share/info /ucrt64/share/oneinfo /ucrt64/share/zoneinfo /ucrt64/share/locale'; `
bash -lc 'rm -rf /usr/share/bash-completion/ /usr/share/terminfo/'; `
bash -lc 'rm -rf /var/cache/pacman/pkg/*'; `
compact /c /i /s:$env:SystemDrive\msys64 | Out-Null; `
`
Write-Host 'Verifying install ("sh --version") ...'; `