mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
Update windows build scripts
This commit is contained in:
parent
80c8f12b3a
commit
b6c674e716
6
.gitignore
vendored
6
.gitignore
vendored
@ -11,11 +11,7 @@
|
|||||||
tickets.pickle
|
tickets.pickle
|
||||||
|
|
||||||
## Build artifacts
|
## Build artifacts
|
||||||
build/
|
build*/
|
||||||
build-debug/
|
|
||||||
build-release/
|
|
||||||
build32/
|
|
||||||
build64/
|
|
||||||
debug/
|
debug/
|
||||||
release/
|
release/
|
||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
|
40
appveyor.yml
40
appveyor.yml
@ -2,9 +2,11 @@
|
|||||||
version: 2.9.0.dev.{build}
|
version: 2.9.0.dev.{build}
|
||||||
|
|
||||||
os: Visual Studio 2017
|
os: Visual Studio 2017
|
||||||
|
platform: x64
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
|
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
|
||||||
|
VSCMD_VER: 15.0
|
||||||
BOOST_ROOT: 'C:\Libraries\boost_1_65_1'
|
BOOST_ROOT: 'C:\Libraries\boost_1_65_1'
|
||||||
BOOST_LIBRARYDIR: 'C:\Libraries\boost_1_65_1\lib64-msvc-14.1'
|
BOOST_LIBRARYDIR: 'C:\Libraries\boost_1_65_1\lib64-msvc-14.1'
|
||||||
BISON_BINARY: 'C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe'
|
BISON_BINARY: 'C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe'
|
||||||
@ -16,36 +18,46 @@ branches:
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
- build -> appveyor.yml
|
- build -> appveyor.yml
|
||||||
- vendor -> tools\win32\download-openssl.ps1
|
|
||||||
- C:\ProgramData\chocolatey\lib\winflexbison3
|
- C:\ProgramData\chocolatey\lib\winflexbison3
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ps: |
|
|
||||||
if (-not (Test-Path "vendor\OpenSSL")) {
|
|
||||||
.\tools\win32\download-openssl.ps1
|
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
||||||
}
|
|
||||||
- ps: |
|
- ps: |
|
||||||
if (-not (Test-Path "C:\ProgramData\chocolatey\lib\winflexbison3")) {
|
if (-not (Test-Path "C:\ProgramData\chocolatey\lib\winflexbison3")) {
|
||||||
choco install winflexbison3
|
& choco install winflexbison3
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# why that env handling, see
|
||||||
|
# https://help.appveyor.com/discussions/questions/18777-how-to-use-vcvars64bat-from-powershell#comment_44999171
|
||||||
before_build:
|
before_build:
|
||||||
- ps: |
|
- ps: |
|
||||||
.\tools\win32\configure.ps1
|
$bits = $env:PLATFORM -replace "^x", ""
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars${bits}.bat`" && set > `"${env:TEMP}\vcvars.txt`""
|
||||||
|
Get-Content "$env:TEMP\vcvars.txt" | Foreach-Object {
|
||||||
|
if ($_ -match "^(VSCMD.*?)=(.*)$") {
|
||||||
|
Set-Content ("env:" + $matches[1]) $matches[2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path ".\build\vendor\OpenSSL")) {
|
||||||
|
& .\tools\win32\download-openssl.ps1
|
||||||
|
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||||
|
}
|
||||||
|
|
||||||
|
& .\tools\win32\configure.ps1
|
||||||
|
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||||
|
|
||||||
del build\Icinga*.msi
|
del build\Icinga*.msi
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- ps: |
|
- ps: |
|
||||||
.\tools\win32\build.ps1
|
& .\tools\win32\build.ps1
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- ps: |
|
- ps: |
|
||||||
.\tools\win32\test.ps1
|
& .\tools\win32\test.ps1
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||||
|
|
||||||
# Disable until we really need them
|
# Disable until we really need them
|
||||||
# https://github.com/Icinga/icinga2/issues/6106
|
# https://github.com/Icinga/icinga2/issues/6106
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
[string]$pwd = Get-Location
|
if (-not (Test-Path env:ICINGA2_BUILDPATH)) {
|
||||||
|
$env:ICINGA2_BUILDPATH = '.\build'
|
||||||
|
}
|
||||||
|
|
||||||
if (-not (Test-Path build)) {
|
if (-not (Test-Path $env:ICINGA2_BUILDPATH)) {
|
||||||
Write-Host "Path '$pwd\build' does not exist!"
|
Write-Host "Path '$env:ICINGA2_BUILDPATH' does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,5 +14,5 @@ if (-not ($env:PATH -contains $env:CMAKE_PATH)) {
|
|||||||
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
cmake.exe --build build --target PACKAGE --config RelWithDebInfo
|
cmake.exe --build "$env:ICINGA2_BUILDPATH" --target PACKAGE --config RelWithDebInfo
|
||||||
if ($lastexitcode -ne 0) { exit $lastexitcode }
|
if ($lastexitcode -ne 0) { exit $lastexitcode }
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
if (-not (Test-Path build)) {
|
if (-not (Test-Path env:ICINGA2_BUILDPATH)) {
|
||||||
mkdir build
|
$env:ICINGA2_BUILDPATH = '.\build'
|
||||||
}
|
}
|
||||||
if (-not (Test-Path install)) {
|
|
||||||
mkdir install
|
if (-not (Test-Path "$env:ICINGA2_BUILDPATH")) {
|
||||||
|
mkdir "$env:ICINGA2_BUILDPATH" | out-null
|
||||||
|
}
|
||||||
|
if (-not (Test-Path "$env:ICINGA2_BUILDPATH\install")) {
|
||||||
|
mkdir "$env:ICINGA2_BUILDPATH\install" | out-null
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:CMAKE_PATH)) {
|
if (-not (Test-Path env:CMAKE_PATH)) {
|
||||||
$env:CMAKE_PATH = 'C:\Program Files\CMake\bin'
|
$env:CMAKE_PATH = 'C:\Program Files\CMake\bin'
|
||||||
@ -11,13 +15,24 @@ if (-not ($env:PATH -contains $env:CMAKE_PATH)) {
|
|||||||
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
[string]$pwd = Get-Location
|
|
||||||
|
|
||||||
if (-not (Test-Path env:CMAKE_GENERATOR)) {
|
if (-not (Test-Path env:CMAKE_GENERATOR)) {
|
||||||
$env:CMAKE_GENERATOR = 'Visual Studio 15 2017 Win64'
|
$env:CMAKE_GENERATOR = 'Visual Studio 15 2017 Win64'
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
|
if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
|
||||||
$env:OPENSSL_ROOT_DIR = $pwd + '\vendor\OpenSSL'
|
if (Test-Path env:VSCMD_ARG_TGT_ARCH) {
|
||||||
|
$OpenSSL_arch = $env:VSCMD_ARG_TGT_ARCH
|
||||||
|
} else {
|
||||||
|
throw "Missing env variable VSCMD_ARG_TGT_ARCH"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path env:VSCMD_VER) {
|
||||||
|
$VSmajor = $env:VSCMD_VER -replace "\..*$", ""
|
||||||
|
$OpenSSL_vcbuild = "vc${VSmajor}0"
|
||||||
|
} else {
|
||||||
|
throw "Missing env variable VSCMD_VER"
|
||||||
|
}
|
||||||
|
|
||||||
|
$env:OPENSSL_ROOT_DIR = "$env:ICINGA2_BUILDPATH\vendor\OpenSSL-$OpenSSL_arch-$OpenSSL_vcbuild"
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:BOOST_ROOT)) {
|
if (-not (Test-Path env:BOOST_ROOT)) {
|
||||||
$env:BOOST_ROOT = 'c:\local\boost_1_65_1'
|
$env:BOOST_ROOT = 'c:\local\boost_1_65_1'
|
||||||
@ -32,12 +47,15 @@ if (-not (Test-Path env:BISON_BINARY)) {
|
|||||||
$env:BISON_BINARY = 'C:\ProgramData\chocolatey\bin\win_bison.exe'
|
$env:BISON_BINARY = 'C:\ProgramData\chocolatey\bin\win_bison.exe'
|
||||||
}
|
}
|
||||||
|
|
||||||
cd build
|
$sourcePath = Get-Location
|
||||||
|
|
||||||
& cmake.exe .. `
|
cd "$env:ICINGA2_BUILDPATH"
|
||||||
|
|
||||||
|
#-DCMAKE_INSTALL_PREFIX="C:\Program Files\Icinga2" `
|
||||||
|
|
||||||
|
& cmake.exe "$sourcePath" `
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||||
-G $env:CMAKE_GENERATOR -DCPACK_GENERATOR=WIX `
|
-G $env:CMAKE_GENERATOR -DCPACK_GENERATOR=WIX `
|
||||||
-DCMAKE_INSTALL_PREFIX="..\install" `
|
|
||||||
-DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF `
|
-DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF `
|
||||||
-DOPENSSL_ROOT_DIR="$env:OPENSSL_ROOT_DIR" `
|
-DOPENSSL_ROOT_DIR="$env:OPENSSL_ROOT_DIR" `
|
||||||
-DBOOST_ROOT="$env:BOOST_ROOT" `
|
-DBOOST_ROOT="$env:BOOST_ROOT" `
|
||||||
@ -45,9 +63,8 @@ cd build
|
|||||||
-DFLEX_EXECUTABLE="$env:FLEX_BINARY" `
|
-DFLEX_EXECUTABLE="$env:FLEX_BINARY" `
|
||||||
-DBISON_EXECUTABLE="$env:BISON_BINARY"
|
-DBISON_EXECUTABLE="$env:BISON_BINARY"
|
||||||
|
|
||||||
|
cd "$sourcePath"
|
||||||
|
|
||||||
if ($lastexitcode -ne 0) {
|
if ($lastexitcode -ne 0) {
|
||||||
cd ..
|
|
||||||
exit $lastexitcode
|
exit $lastexitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
cd ..
|
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
[string]$pwd = Get-Location
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
$OpenSSL_version = '1.1.0g-1'
|
$OpenSSL_version = '1.1.0g-1'
|
||||||
$OpenSSL_arch = 'x64'
|
|
||||||
$OpenSSL_vcbuild = 'vc150'
|
if (Test-Path env:VSCMD_ARG_TGT_ARCH) {
|
||||||
|
$OpenSSL_arch = $env:VSCMD_ARG_TGT_ARCH
|
||||||
|
} else {
|
||||||
|
throw "Missing env variable VSCMD_ARG_TGT_ARCH"
|
||||||
|
}
|
||||||
|
if (Test-Path env:VSCMD_VER) {
|
||||||
|
$VSmajor = $env:VSCMD_VER -replace "\..*$", ""
|
||||||
|
$OpenSSL_vcbuild = "vc${VSmajor}0"
|
||||||
|
} else {
|
||||||
|
throw "Missing env variable VSCMD_VER"
|
||||||
|
}
|
||||||
|
|
||||||
$OpenSSL_fileversion = $OpenSSL_version.Replace('.', '_').Split('-')[0]
|
$OpenSSL_fileversion = $OpenSSL_version.Replace('.', '_').Split('-')[0]
|
||||||
$OpenSSL_file = [string]::Format(
|
$OpenSSL_file = [string]::Format(
|
||||||
'openssl-{0}-binary-icinga-{1}-{2}.zip',
|
'openssl-{0}-binary-icinga-{1}-{2}.zip',
|
||||||
@ -15,12 +27,23 @@ $OpenSSL_url = [string]::Format(
|
|||||||
$OpenSSL_file
|
$OpenSSL_file
|
||||||
)
|
)
|
||||||
|
|
||||||
$OpenSSL_zip_location = $pwd + '\vendor\' + $OpenSSL_file
|
if (-not (Test-Path env:ICINGA2_BUILDPATH)) {
|
||||||
$vendor_path = $pwd + '\vendor'
|
$env:ICINGA2_BUILDPATH = '.\build'
|
||||||
$OpenSSL_vendor_path = $vendor_path + '\OpenSSL'
|
}
|
||||||
|
|
||||||
|
$vendor_path = $env:ICINGA2_BUILDPATH + '\vendor'
|
||||||
|
$OpenSSL_zip_location = $env:ICINGA2_BUILDPATH + '\vendor\' + $OpenSSL_file
|
||||||
|
$OpenSSL_vendor_path = "$vendor_path\OpenSSL-$OpenSSL_arch-$OpenSSL_vcbuild"
|
||||||
|
|
||||||
|
# Tune Powershell TLS protocols
|
||||||
|
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
|
||||||
|
|
||||||
|
if (-not (Test-Path $env:ICINGA2_BUILDPATH)) {
|
||||||
|
mkdir $env:ICINGA2_BUILDPATH | out-null
|
||||||
|
}
|
||||||
if (-not (Test-Path $vendor_path)) {
|
if (-not (Test-Path $vendor_path)) {
|
||||||
mkdir $vendor_path
|
mkdir $vendor_path | out-null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path $OpenSSL_zip_location) {
|
if (Test-Path $OpenSSL_zip_location) {
|
||||||
@ -30,21 +53,24 @@ if (Test-Path $OpenSSL_zip_location) {
|
|||||||
|
|
||||||
$progressPreference = 'silentlyContinue'
|
$progressPreference = 'silentlyContinue'
|
||||||
Invoke-WebRequest -Uri $OpenSSL_url -OutFile $OpenSSL_zip_location
|
Invoke-WebRequest -Uri $OpenSSL_url -OutFile $OpenSSL_zip_location
|
||||||
if ($lastexitcode -ne 0){ exit $lastexitcode }
|
|
||||||
$progressPreference = 'Continue'
|
$progressPreference = 'Continue'
|
||||||
|
|
||||||
if (Test-Path $OpenSSL_vendor_path) {
|
if (Test-Path $OpenSSL_vendor_path) {
|
||||||
Remove-Item -Recurse $OpenSSL_vendor_path
|
Remove-Item -Recurse $OpenSSL_vendor_path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Path $OpenSSL_vendor_path)) {
|
if (-not (Test-Path $OpenSSL_vendor_path)) {
|
||||||
mkdir $OpenSSL_vendor_path
|
mkdir $OpenSSL_vendor_path | out-null
|
||||||
|
|
||||||
Write-Output "Extracting ZIP to $OpenSSL_vendor_path"
|
Write-Output "Extracting ZIP to $OpenSSL_vendor_path"
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($OpenSSL_zip_location, $OpenSSL_vendor_path)
|
$pwd = Get-Location
|
||||||
if ($lastexitcode -ne 0){ exit $lastexitcode }
|
[System.IO.Compression.ZipFile]::ExtractToDirectory(
|
||||||
|
(Join-Path -path $pwd -childpath $OpenSSL_zip_location),
|
||||||
|
(Join-Path -path $pwd -childpath $OpenSSL_vendor_path)
|
||||||
|
)
|
||||||
|
if ($lastexitcode -ne 0){ exit $lastexitcode }
|
||||||
} else {
|
} else {
|
||||||
Write-Output "OpenSSL is already available at $OpenSSL_vendor_path"
|
Write-Output "OpenSSL is already available at $OpenSSL_vendor_path"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
if (-not (Test-Path env:ICINGA2_BUILDPATH)) {
|
||||||
|
$env:ICINGA2_BUILDPATH = 'build'
|
||||||
|
}
|
||||||
|
|
||||||
[string]$pwd = Get-Location
|
[string]$pwd = Get-Location
|
||||||
|
|
||||||
if (-not (Test-Path build)) {
|
if (-not (Test-Path $env:ICINGA2_BUILDPATH)) {
|
||||||
Write-Host "Path '$pwd\build' does not exist!"
|
Write-Host "Path '$pwd\$env:ICINGA2_BUILDPATH' does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,12 +16,12 @@ if (-not ($env:PATH -contains $env:CMAKE_PATH)) {
|
|||||||
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
cd build
|
cd "$env:ICINGA2_BUILDPATH"
|
||||||
|
|
||||||
ctest.exe -C RelWithDebInfo -T test -O build/Test.xml --output-on-failure
|
ctest.exe -C RelWithDebInfo -T test -O $env:ICINGA2_BUILDPATH/Test.xml --output-on-failure
|
||||||
if ($lastexitcode -ne 0) {
|
if ($lastexitcode -ne 0) {
|
||||||
cd ..
|
cd ..
|
||||||
exit $lastexitcode
|
exit $lastexitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
Loading…
x
Reference in New Issue
Block a user