mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-05-30 06:40:22 +02:00
Updated Windows agents for PCRE2 library
This commit is contained in:
parent
3b6368f7c9
commit
f6340c05b5
@ -3,7 +3,7 @@
|
|||||||
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022
|
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022
|
||||||
FROM $BUILD_BASE_IMAGE
|
FROM $BUILD_BASE_IMAGE
|
||||||
|
|
||||||
ARG PCRE_VERSION=8.45
|
ARG PCRE2_VERSION=10.39
|
||||||
ARG OPENSSL_VERSION=1.1.1m
|
ARG OPENSSL_VERSION=1.1.1m
|
||||||
ARG LIBMODBUS_VERSION=master
|
ARG LIBMODBUS_VERSION=master
|
||||||
ARG BUILD_ARCH=x64
|
ARG BUILD_ARCH=x64
|
||||||
@ -16,14 +16,14 @@ ARG VS_BUILDTOOLS_URL=https://aka.ms/vs/16/release/vs_buildtools.exe
|
|||||||
ARG NASM_URL=https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe
|
ARG NASM_URL=https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe
|
||||||
ARG PERL_URL=https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit.msi
|
ARG PERL_URL=https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit.msi
|
||||||
ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip
|
ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-busybox-64-bit.zip
|
||||||
ARG PCRE_URL=https://sourceforge.net/projects/pcre/files/pcre/$PCRE_VERSION/pcre-$PCRE_VERSION.zip
|
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
|
ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
|
||||||
ARG LIBMODBUS_URL=https://github.com/stephane/libmodbus.git
|
ARG LIBMODBUS_URL=https://github.com/stephane/libmodbus.git
|
||||||
|
|
||||||
ENV ZBX_VERSION=$ZBX_VERSION `
|
ENV ZBX_VERSION=$ZBX_VERSION `
|
||||||
BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL `
|
BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL `
|
||||||
PCRE_VERSION=$PCRE_VERSION OPENSSL_VERSION=$OPENSSL_VERSION LIBMODBUS_VERSION=$LIBMODBUS_VERSION `
|
PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION LIBMODBUS_VERSION=$LIBMODBUS_VERSION `
|
||||||
GIT_URL=$GIT_URL NASM_URL=$NASM_URL PERL_URL=$PERL_URL LIBMODBUS_URL=$LIBMODBUS_URL PCRE_URL=$PCRE_URL OPENSSL_URL=$OPENSSL_URL
|
GIT_URL=$GIT_URL NASM_URL=$NASM_URL PERL_URL=$PERL_URL LIBMODBUS_URL=$LIBMODBUS_URL PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="Zabbix agent build base for Windows" `
|
LABEL org.opencontainers.image.title="Zabbix agent build base for Windows" `
|
||||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
|
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
|
||||||
@ -144,39 +144,39 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
|||||||
Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); `
|
Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); `
|
||||||
Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||||
`
|
`
|
||||||
Write-Host ('Downloading {0} ...' -f $env:PCRE_URL); `
|
Write-Host ('Downloading {0} ...' -f $env:PCRE2_URL); `
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
||||||
(new-object System.Net.WebClient).DownloadFile("""$env:PCRE_URL""","""$env:SystemDrive\pcre.zip"""); `
|
Invoke-WebRequest -OutFile $env:SystemDrive\pcre2.zip -Uri $env:PCRE2_URL; `
|
||||||
`
|
`
|
||||||
$sha256 = '5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977'; `
|
$sha256 = '08a8861f60fec3af30ca1e0f51d89ab5dc5c07bb71b74db5297f78b7e26c7226'; `
|
||||||
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
|
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
|
||||||
if ((Get-FileHash $env:SystemDrive\pcre.zip -Algorithm sha256).Hash -ne $sha256) { `
|
if ((Get-FileHash $env:SystemDrive\pcre2.zip -Algorithm sha256).Hash -ne $sha256) { `
|
||||||
Write-Host 'Checksum PCRE library failed!'; `
|
Write-Host 'Checksum PCRE2 library failed!'; `
|
||||||
exit 1; `
|
exit 1; `
|
||||||
}; `
|
}; `
|
||||||
Write-Host 'Extracting archive ...'; `
|
Write-Host 'Extracting archive ...'; `
|
||||||
Expand-Archive -Path $env:SystemDrive\pcre.zip -DestinationPath $env:SystemDrive; `
|
Expand-Archive -Path $env:SystemDrive\pcre2.zip -DestinationPath $env:SystemDrive; `
|
||||||
Write-Host 'Removing downloaded...'; `
|
Write-Host 'Removing downloaded...'; `
|
||||||
Remove-Item -Force -Path $env:SystemDrive\pcre.zip; `
|
Remove-Item -Force -Path $env:SystemDrive\pcre2.zip; `
|
||||||
Rename-Item -Path $env:SystemDrive\pcre-$env:PCRE_VERSION -NewName $env:SystemDrive\pcre_build; `
|
Rename-Item -Path $env:SystemDrive\pcre2-$env:PCRE2_VERSION -NewName $env:SystemDrive\pcre2_build; `
|
||||||
New-Item -ItemType directory -Path "$env:SystemDrive\pcre_build\build" | Out-Null; `
|
New-Item -ItemType directory -Path "$env:SystemDrive\pcre2_build\build" | Out-Null; `
|
||||||
`
|
`
|
||||||
Set-Location -Path $env:SystemDrive\pcre_build\build; `
|
Set-Location -Path $env:SystemDrive\pcre2_build\build; `
|
||||||
Write-Host 'Building PCRE library ...'; `
|
Write-Host 'Building PCRE2 library ...'; `
|
||||||
cmake --log-level=ERROR `
|
cmake --log-level=ERROR `
|
||||||
-G 'Visual Studio 16 2019' `
|
-G 'Visual Studio 16 2019' `
|
||||||
-A $env:BUILD_ARCH `
|
-A $env:BUILD_ARCH `
|
||||||
-DPCRE_SUPPORT_UNICODE_PROPERTIES=ON `
|
-DPCRE_SUPPORT_UNICODE_PROPERTIES=ON `
|
||||||
-DPCRE_SUPPORT_UTF=ON `
|
-DPCRE_SUPPORT_UTF=ON `
|
||||||
-DCMAKE_C_FLAGS_RELEASE:string="""/MT""" ..; `
|
-DCMAKE_C_FLAGS_RELEASE:string="""/MT""" ..; `
|
||||||
msbuild PCRE.sln `
|
msbuild PCRE2.sln `
|
||||||
-maxcpucount:"""$env:NUMBER_OF_PROCESSORS""" `
|
-maxcpucount:"""$env:NUMBER_OF_PROCESSORS""" `
|
||||||
/verbosity:quiet `
|
/verbosity:quiet `
|
||||||
/property:Configuration=Release `
|
/property:Configuration=Release `
|
||||||
/property:Platform=$env:BUILD_ARCH `
|
/property:Platform=$env:BUILD_ARCH `
|
||||||
/target:pcre; `
|
/target:pcre2-8-static; `
|
||||||
`
|
`
|
||||||
Write-Host 'PCRE is ready...';
|
Write-Host 'PCRE2 is ready...';
|
||||||
|
|
||||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||||
`
|
`
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022
|
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022
|
||||||
FROM $BUILD_BASE_IMAGE as builder_base
|
FROM $BUILD_BASE_IMAGE as builder_base
|
||||||
|
|
||||||
ARG PCRE_VERSION=8.45
|
ARG PCRE2_VERSION=10.39
|
||||||
ARG OPENSSL_VERSION=1.1.1m
|
ARG OPENSSL_VERSION=1.1.1m
|
||||||
ARG GOLANG_VERSION=1.17.6
|
ARG GOLANG_VERSION=1.17.6
|
||||||
ARG SEVEN_ZIP_VERSION=1900
|
ARG SEVEN_ZIP_VERSION=1900
|
||||||
@ -18,16 +18,16 @@ ARG GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.33.0.win
|
|||||||
ARG MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z
|
ARG MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z
|
||||||
ARG GOLANG_URL=https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.msi
|
ARG GOLANG_URL=https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.msi
|
||||||
ARG CYGWIN_URL=https://cygwin.com/setup-x86_64.exe
|
ARG CYGWIN_URL=https://cygwin.com/setup-x86_64.exe
|
||||||
ARG PCRE_URL=https://sourceforge.net/projects/pcre/files/pcre/$PCRE_VERSION/pcre-$PCRE_VERSION.zip
|
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
|
ARG OPENSSL_URL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
|
||||||
ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi
|
ARG SEVEN_ZIP_URL=https://www.7-zip.org/a/7z$SEVEN_ZIP_VERSION-$BUILD_ARCH.msi
|
||||||
|
|
||||||
ENV ZBX_VERSION=$ZBX_VERSION `
|
ENV ZBX_VERSION=$ZBX_VERSION `
|
||||||
BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL `
|
BUILD_ARCH=$BUILD_ARCH CPU_MODEL=$CPU_MODEL `
|
||||||
PCRE_VERSION=$PCRE_VERSION OPENSSL_VERSION=$OPENSSL_VERSION `
|
PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION `
|
||||||
GOLANG_VERSION=$GOLANG_VERSION SEVEN_ZIP_VERSION=$SEVEN_ZIP_VERSION `
|
GOLANG_VERSION=$GOLANG_VERSION SEVEN_ZIP_VERSION=$SEVEN_ZIP_VERSION `
|
||||||
GIT_URL=$GIT_URL MINGW_URL=$MINGW_URL CYGWIN_URL=$CYGWIN_URL GOLANG_URL=$GOLANG_URL SEVEN_ZIP_URL=$SEVEN_ZIP_URL `
|
GIT_URL=$GIT_URL MINGW_URL=$MINGW_URL CYGWIN_URL=$CYGWIN_URL GOLANG_URL=$GOLANG_URL SEVEN_ZIP_URL=$SEVEN_ZIP_URL `
|
||||||
PCRE_URL=$PCRE_URL OPENSSL_URL=$OPENSSL_URL
|
PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" `
|
LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" `
|
||||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
|
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
|
||||||
@ -166,34 +166,34 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
|||||||
Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); `
|
Import-Module ('{0}\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' -f ${env:ProgramFiles(x86)} ); `
|
||||||
Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
Enter-VsDevShell -VsInstallPath ('{0}\Microsoft Visual Studio\2019\BuildTools' -f ${env:ProgramFiles(x86)}) -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||||
`
|
`
|
||||||
Write-Host ('Downloading {0} ...' -f $env:PCRE_URL); `
|
Write-Host ('Downloading {0} ...' -f $env:PCRE2_URL); `
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
||||||
(new-object System.Net.WebClient).DownloadFile("""$env:PCRE_URL""","""$env:SystemDrive\pcre.zip"""); `
|
Invoke-WebRequest -OutFile $env:SystemDrive\pcre2.zip -Uri $env:PCRE2_URL; `
|
||||||
`
|
`
|
||||||
|
$sha256 = '08a8861f60fec3af30ca1e0f51d89ab5dc5c07bb71b74db5297f78b7e26c7226'; `
|
||||||
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
|
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
|
||||||
$sha256 = '5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977'; `
|
if ((Get-FileHash $env:SystemDrive\pcre2.zip -Algorithm sha256).Hash -ne $sha256) { `
|
||||||
if ((Get-FileHash $env:SystemDrive\pcre.zip -Algorithm sha256).Hash -ne $sha256) { `
|
Write-Host 'Checksum PCRE2 library failed!'; `
|
||||||
Write-Host 'Checksum PCRE library failed!'; `
|
|
||||||
exit 1; `
|
exit 1; `
|
||||||
}; `
|
}; `
|
||||||
Write-Host 'Extracting archive ...'; `
|
Write-Host 'Extracting archive ...'; `
|
||||||
Expand-Archive -Path $env:SystemDrive\pcre.zip -DestinationPath $env:SystemDrive; `
|
Expand-Archive -Path $env:SystemDrive\pcre2.zip -DestinationPath $env:SystemDrive; `
|
||||||
Write-Host 'Removing downloaded...'; `
|
Write-Host 'Removing downloaded...'; `
|
||||||
Remove-Item -Force -Path $env:SystemDrive\pcre.zip; `
|
Remove-Item -Force -Path $env:SystemDrive\pcre2.zip; `
|
||||||
Rename-Item -Path $env:SystemDrive\pcre-$env:PCRE_VERSION -NewName $env:SystemDrive\pcre_build; `
|
Rename-Item -Path $env:SystemDrive\pcre2-$env:PCRE2_VERSION -NewName $env:SystemDrive\pcre2_build; `
|
||||||
`
|
`
|
||||||
Set-Location -Path $env:SystemDrive\pcre_build; `
|
Set-Location -Path $env:SystemDrive\pcre2_build; `
|
||||||
Write-Host 'Building PCRE library ...'; `
|
Write-Host 'Building PCRE2 library ...'; `
|
||||||
cmake --log-level=ERROR `
|
cmake --log-level=ERROR `
|
||||||
-G 'MinGW Makefiles' `
|
-G 'MinGW Makefiles' `
|
||||||
-DBUILD_SHARED_LIBS=OFF `
|
-DBUILD_SHARED_LIBS=OFF `
|
||||||
-DCMAKE_C_COMPILER=gcc `
|
-DCMAKE_C_COMPILER=gcc `
|
||||||
-DCMAKE_C_FLAGS='-O2 -g' `
|
-DCMAKE_C_FLAGS='-O2 -g' `
|
||||||
-DCMAKE_CXX_FLAGS='-O2 -g' `
|
-DCMAKE_CXX_FLAGS='-O2 -g' `
|
||||||
-DCMAKE_INSTALL_PREFIX="""$env:SystemDrive\pcre_output""" . ; `
|
-DCMAKE_INSTALL_PREFIX="""$env:SystemDrive\pcre2_output""" . ; `
|
||||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; `
|
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; `
|
||||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; `
|
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; `
|
||||||
Write-Host 'PCRE is ready...';
|
Write-Host 'PCRE2 is ready...';
|
||||||
|
|
||||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||||
`
|
`
|
||||||
|
@ -41,8 +41,8 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
|||||||
nmake /S -f Makefile `
|
nmake /S -f Makefile `
|
||||||
CPU=$env:CPU_MODEL `
|
CPU=$env:CPU_MODEL `
|
||||||
CFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D HAVE_LIBMODBUS_STATIC""" `
|
CFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D HAVE_LIBMODBUS_STATIC""" `
|
||||||
PCREINCDIR=$env:SystemDrive\pcre_build\build `
|
PCRE2INCDIR=$env:SystemDrive\pcre2_build\build `
|
||||||
PCRELIBDIR=$env:SystemDrive\pcre_build\build\Release TLS=openssl `
|
PCRE2LIBDIR=$env:SystemDrive\pcre2_build\build\Release TLS=openssl `
|
||||||
RFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D ZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM""" `
|
RFLAGS="""/D ZABBIX_VERSION_REVISION=$ZbxRevision /D ZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM""" `
|
||||||
# LIBS="Crypt32.lib" `
|
# LIBS="Crypt32.lib" `
|
||||||
TLSINCDIR=$env:SystemDrive\openssl_output\include `
|
TLSINCDIR=$env:SystemDrive\openssl_output\include `
|
||||||
|
@ -38,8 +38,8 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
|||||||
(Get-Content src\go\pkg\version\version.go).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content src\go\pkg\version\version.go; `
|
(Get-Content src\go\pkg\version\version.go).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content src\go\pkg\version\version.go; `
|
||||||
Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\build\mingw; `
|
Set-Location -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\build\mingw; `
|
||||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" `
|
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" `
|
||||||
# CGO_LDFLAGS="""-lssl -lcrypto -lcrypt32 -L$env:SystemDrive\openssl_output\lib -L$env:SystemDrive\pcre_output\lib""" `
|
# CGO_LDFLAGS="""-lssl -lcrypto -lcrypt32 -L$env:SystemDrive\openssl_output\lib -L$env:SystemDrive\pcre2_output\lib""" `
|
||||||
PCRE=$env:SystemDrive\pcre_output `
|
PCRE2=$env:SystemDrive\pcre2_output `
|
||||||
OPENSSL=$env:SystemDrive\openssl_output `
|
OPENSSL=$env:SystemDrive\openssl_output `
|
||||||
RFLAGS="""-DZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM"""; `
|
RFLAGS="""-DZABBIX_VERSION_RC_NUM=$env:ZABBIX_VERSION_RC_NUM"""; `
|
||||||
`
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user