windows: Add build scripts

This commit is contained in:
Markus Frosch 2018-02-02 17:19:14 +01:00
parent 34d31a8a41
commit 5936c0db6f
3 changed files with 117 additions and 0 deletions

16
tools/win32/build.ps1 Normal file
View File

@ -0,0 +1,16 @@
[string]$pwd = Get-Location
if (-not (Test-Path build)) {
Write-Host "Path '$pwd\build' does not exist!"
exit 1
}
if (-not (Test-Path env:CMAKE_PATH)) {
$env:CMAKE_PATH = 'C:\Program Files\CMake\bin'
}
if (-not ($env:PATH -contains $env:CMAKE_PATH)) {
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
}
cmake.exe --build build --target PACKAGE --config RelWithDebInfo
if ($lastexitcode -ne 0) { exit $lastexitcode }

53
tools/win32/configure.ps1 Normal file
View File

@ -0,0 +1,53 @@
if (-not (Test-Path build)) {
mkdir build
}
if (-not (Test-Path install)) {
mkdir install
}
if (-not (Test-Path env:CMAKE_PATH)) {
$env:CMAKE_PATH = 'C:\Program Files\CMake\bin'
}
if (-not ($env:PATH -contains $env:CMAKE_PATH)) {
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
}
[string]$pwd = Get-Location
if (-not (Test-Path env:CMAKE_GENERATOR)) {
$env:CMAKE_GENERATOR = 'Visual Studio 15 2017 Win64'
}
if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
$env:OPENSSL_ROOT_DIR = $pwd + '\vendor\OpenSSL'
}
if (-not (Test-Path env:BOOST_ROOT)) {
$env:BOOST_ROOT = 'c:\local\boost_1_65_1'
}
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_65_1\lib64-msvc-14.1'
}
if (-not (Test-Path env:FLEX_BINARY)) {
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
}
if (-not (Test-Path env:BISON_BINARY)) {
$env:BISON_BINARY = 'C:\ProgramData\chocolatey\bin\win_bison.exe'
}
cd build
& cmake.exe .. `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-G $env:CMAKE_GENERATOR -DCPACK_GENERATOR=WIX `
-DCMAKE_INSTALL_PREFIX="..\install" `
-DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF `
-DOPENSSL_ROOT_DIR="$env:OPENSSL_ROOT_DIR" `
-DBOOST_ROOT="$env:BOOST_ROOT" `
-DBOOST_LIBRARYDIR="$env:BOOST_LIBRARYDIR" `
-DFLEX_EXECUTABLE="$env:FLEX_BINARY" `
-DBISON_EXECUTABLE="$env:BISON_BINARY"
if ($lastexitcode -ne 0) {
cd ..
exit $lastexitcode
}
cd ..

View File

@ -0,0 +1,48 @@
[string]$pwd = Get-Location
$OpenSSL_version = '1.1.0g'
$OpenSSL_arch = 'x64'
$OpenSSL_vcbuild = 'vc150'
$OpenSSL_fileversion = $OpenSSL_version.Replace('.', '_')
$OpenSSL_file = [string]::Format(
'openssl-{0}-binary-icinga-{1}-{2}.zip',
$OpenSSL_fileversion,
$OpenSSL_arch,
$OpenSSL_vcbuild
)
# TODO: from GitHub Release!
#$OpenSSL_url = ''
$OpenSSL_url = 'https://ci.appveyor.com/api/buildjobs/4hwjjxgvvyeplrjd/artifacts/' + $OpenSSL_file
$OpenSSL_zip_location = $pwd + '\vendor\' + $OpenSSL_file
$vendor_path = $pwd + '\vendor'
$OpenSSL_vendor_path = $vendor_path + '\OpenSSL'
if (-not (Test-Path $vendor_path)) {
mkdir $vendor_path
}
if (Test-Path $OpenSSL_zip_location) {
Write-Output "OpenSSL archive available at $OpenSSL_zip_location"
} else {
Write-Output "Downloading OpenSSL binary dist from $OpenSSL_url"
$progressPreference = 'silentlyContinue'
Invoke-WebRequest -Uri $OpenSSL_url -OutFile $OpenSSL_zip_location
if ($lastexitcode -ne 0){ exit $lastexitcode }
$progressPreference = 'Continue'
if (Test-Path $OpenSSL_vendor_path) {
Remove-Item -Recurse $OpenSSL_vendor_path
}
}
if (-not (Test-Path $OpenSSL_vendor_path)) {
mkdir $OpenSSL_vendor_path
}
Write-Output "Extracting ZIP to $OpenSSL_vendor_path"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($OpenSSL_zip_location, $OpenSSL_vendor_path)
if ($lastexitcode -ne 0){ exit $lastexitcode }
exit 0