-
Notifications
You must be signed in to change notification settings - Fork 31
Update version and libs and build universal installer #390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,90 @@ | ||
| #powershell -ExecutionPolicy ByPass -File build.ps1 | ||
| param( | ||
| [string]$webeid = $PSScriptRoot, | ||
| [string]$cmake = "C:\Program Files\CMake\bin\cmake.exe", | ||
| [string]$vcpkgroot = "C:\vcpkg", | ||
| [string]$qtdir = "C:\Qt\6.10.0\msvc2022_64", | ||
| [string]$vcpkgroot = $env:VCPKG_ROOT, | ||
| [string]$build_number = $(if ($null -eq $env:BUILD_NUMBER) {"0"} else {$env:BUILD_NUMBER}), | ||
| [string]$version = (Select-String -Path "$webeid/CMakeLists.txt" -Pattern 'project\(web-eid VERSION (\d+\.\d+\.\d+)').Matches[0].Groups[1].Value + ".$build_number", | ||
| [bool]$crosscompile = ($env:PROCESSOR_ARCHITECTURE -eq "AMD64"), | ||
| [string]$qt_dir = "C:\Qt\6.11.1", | ||
| [string]$qt_x64 = "$qt_dir\msvc2022_64", | ||
| [string]$qt_arm64 = $(if ($crosscompile) { "$qt_dir\msvc2022_arm64_cross_compiled" } else { "$qt_dir\msvc2022_arm64" }), | ||
| [string]$buildtype = "RelWithDebInfo", | ||
| [string]$arch = "x64" | ||
| [string]$sign = $null | ||
| ) | ||
|
|
||
| & $cmake -S . -B build\windows -A $arch -DCMAKE_BUILD_TYPE=$buildtype "-DCMAKE_PREFIX_PATH=$qtdir" "-DCMAKE_TOOLCHAIN_FILE=$vcpkgroot\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_MANIFEST_DIR=lib/libelectronic-id" | ||
| & $cmake --build build\windows --config $buildtype | ||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| Try { & wix > $null } Catch { | ||
| & dotnet tool install --global --version 6.0.2 wix | ||
| & wix extension add -g WixToolset.UI.wixext/6.0.2 | ||
| & wix extension add -g WixToolset.Util.wixext/6.0.2 | ||
| & wix extension add -g WixToolset.BootstrapperApplications.wixext/6.0.2 | ||
| } | ||
|
|
||
| if(!(Test-Path -Path $vcpkgroot)) { | ||
| $vcpkgroot = "$webeid\vcpkg" | ||
| & git clone https://github.com/microsoft/vcpkg $vcpkgroot | ||
| & $vcpkgroot\bootstrap-vcpkg.bat | ||
| } | ||
|
|
||
| $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | ||
| $vcvars = & $vswhere -latest -find "VC\Auxiliary\Build\vcvarsall.bat" | ||
|
|
||
| $msi = @{} | ||
|
|
||
| foreach ($arch in @("x64", "arm64")) { | ||
| $env:PLATFORM = $arch | ||
| $buildpath = "$webeid\build\$arch" | ||
| $qt_path = if ($arch -eq "arm64") { $qt_arm64 } else { $qt_x64 } | ||
|
|
||
| $vsarch = if ($arch -eq "arm64") { if ($crosscompile) { "amd64_arm64" } else { "arm64" } } else { "amd64" } | ||
| cmd /c "`"$vcvars`" $vsarch && set" | Where-Object { $_ -match '=' } | ForEach-Object { | ||
| $name, $value = $_ -split '=', 2 | ||
| [System.Environment]::SetEnvironmentVariable($name, $value) | ||
| } | ||
|
|
||
| $cmakeargs = @( | ||
| "-A", $(if ($arch -eq "arm64") { "ARM64" } else { "x64" }), | ||
| "-S", $webeid, | ||
| "-B", $buildpath, | ||
| "-DCMAKE_BUILD_TYPE=$buildtype", | ||
| "-DCMAKE_PREFIX_PATH=$qt_path", | ||
| "-DCMAKE_TOOLCHAIN_FILE=$vcpkgroot\scripts\buildsystems\vcpkg.cmake", | ||
| "-DVCPKG_MANIFEST_DIR=$webeid\lib\libelectronic-id" | ||
| ) | ||
| if ($arch -eq "arm64" -and $crosscompile) { | ||
| $cmakeargs += "-DQT_HOST_PATH=$($qt_x64 -replace '\\','/')" | ||
| } | ||
| if ($sign) { $cmakeargs += "-DSIGNCERT=$sign" } | ||
|
|
||
| & $cmake @cmakeargs | ||
| & $cmake --build $buildpath --config $buildtype | ||
| & $cmake --build $buildpath --config $buildtype --target installer | ||
|
|
||
| $msi[$arch] = "$buildpath\src\app\$buildtype\web-eid_$version.$arch" | ||
| } | ||
|
|
||
| # Bundle | ||
| $bundle = "$webeid\build\web-eid_$version.exe" | ||
| & wix build -nologo ` | ||
| -ext WixToolset.BootstrapperApplications.wixext ` | ||
| -ext WixToolset.Util.wixext ` | ||
| -d webeid_x64="$($msi['x64'])" ` | ||
| -d webeid_arm64="$($msi['arm64'])" ` | ||
| -d MSI_VERSION=$version ` | ||
| -d path="$webeid\install" ` | ||
| "$webeid\install\plugins.wxs" ` | ||
| -o $bundle | ||
|
|
||
| if ($sign) { | ||
| $signargs = @("sign", "/a", "/v", "/s", "MY", "/n", $sign, | ||
| "/fd", "SHA256", "/du", "http://installer.id.ee", | ||
| "/tr", "http://timestamp.digicert.com", "/td", "SHA256") | ||
| $engine = "$webeid\build\web-eid_$version.engine.exe" | ||
| & wix burn detach -nologo $bundle -engine $engine | ||
| & signtool.exe @signargs $engine | ||
| & wix burn reattach -nologo $bundle -engine $engine -o $bundle | ||
| & signtool.exe @signargs $bundle | ||
| Remove-Item $engine | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,10 +32,21 @@ | |
| Key="SOFTWARE\Microsoft\Edge\Extensions\gnmckgbandlkacikdndelhfghdejfido" Value="update_url" After="WebEIDInstalled" /> | ||
| <util:RegistrySearch Variable="FirefoxSupport" Condition="Installed > v0.0.0.0" Result="exists" Root="HKLM" | ||
| Key="SOFTWARE\Mozilla\NativeMessagingHosts\eu.webeid" Bitness="always64" After="WebEIDInstalled" /> | ||
| <util:RegistrySearch Id="DetectARM64Processor" Root="HKLM" Result="value" Variable="ARCH" | ||
| Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Value="PROCESSOR_ARCHITECTURE" /> | ||
|
|
||
| <Chain> | ||
| <MsiPackage Id="WebEID" InstallCondition="VersionNT64" ForcePerMachine="yes" | ||
| SourceFile="$(var.webeid).qt.msi" Compressed="yes"> | ||
| <MsiPackage Id="WebEID.X64" InstallCondition="NOT ARCH="ARM64"" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the install condition too broad now? This essentially allows installation on 32-bit Windows XP.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not prevent successful install. It just does not install msi package then |
||
| ForcePerMachine="yes" SourceFile="$(var.webeid_x64).qt.msi" Compressed="yes"> | ||
| <MsiProperty Name="INSTALLFOLDER" Value="[ProgramFiles64Folder]Web eID" /> | ||
| <MsiProperty Name="CHROMEINSTALL" Value="[ChromeSupport]" /> | ||
| <MsiProperty Name="CHROMEPOLICY" Value="[ForceChromeExtensionActivation]" /> | ||
| <MsiProperty Name="EDGEINSTALL" Value="[EdgeSupport]" /> | ||
| <MsiProperty Name="EDGEPOLICY" Value="[ForceEdgeExtensionActivation]" /> | ||
| <MsiProperty Name="FIREFOXINSTALL" Value="[FirefoxSupport]" /> | ||
| </MsiPackage> | ||
| <MsiPackage Id="WebEID.ARM64" InstallCondition="ARCH="ARM64"" | ||
| ForcePerMachine="yes" SourceFile="$(var.webeid_arm64).qt.msi" Compressed="yes"> | ||
| <MsiProperty Name="INSTALLFOLDER" Value="[ProgramFiles64Folder]Web eID" /> | ||
| <MsiProperty Name="CHROMEINSTALL" Value="[ChromeSupport]" /> | ||
| <MsiProperty Name="CHROMEPOLICY" Value="[ForceChromeExtensionActivation]" /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build.ps1requires setting$VCPKG_ROOT:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or you can provide -vcpkgroot argument to powershell script.
https://learn.microsoft.com/en-us/vcpkg/users/config-environment#vcpkg_root