1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-12 07:03:44 +00:00

Build exe installer with embedded VC redist

This commit is contained in:
Mike Gelfand 2024-12-25 11:20:54 +00:00
parent 79b548c439
commit d6286cba8e
No known key found for this signature in database
GPG key ID: CC4DBBE3299B16F8
5 changed files with 54 additions and 5 deletions

View file

@ -65,7 +65,7 @@ for:
choco install ccache
dotnet tool install --global wix --version 5.0.2
wix extension add --global WixToolset.UI.wixext WixToolset.Util.wixext
wix extension add --global WixToolset.BootstrapperApplications.wixext WixToolset.UI.wixext WixToolset.Util.wixext
wix extension list --global
Remove-Item -Path (Join-Path $Env:SystemDrive OpenSSL-Win32) -Recurse
@ -113,6 +113,7 @@ for:
}
artifacts:
- path: '*.exe'
- path: '*.msi'
- path: '*-pdb.7z'

28
dist/msi/Bundle.wxs vendored Normal file
View file

@ -0,0 +1,28 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<?include TransmissionConfig.wxi ?>
<?define ProductName = "Transmission $(var.TrVersionFull) ($(sys.BUILDARCH))" ?>
<?if $(sys.BUILDARCH) = x86 ?>
<?define VcRedistId = "{C2BB95AA-90F3-4891-81C1-A7E565BB836C}" ?>
<?define VcRedistWin64 = "no" ?>
<?elseif $(sys.BUILDARCH) = x64 ?>
<?define VcRedistId = "{382F1166-A409-4C5B-9B1E-85ED538B8291}" ?>
<?define VcRedistWin64 = "yes" ?>
<?endif ?>
<Bundle Name="$(var.ProductName)" UpgradeCode="D81AC143-1E07-47CB-B464-42DDDFF36A0D" Version="$(var.TrVersionMsi)" Manufacturer="Transmission Project" SplashScreenSourceFile="$(var.SplashScreenFile)">
<BootstrapperApplication>
<bal:WixInternalUIBootstrapperApplication />
</BootstrapperApplication>
<Chain>
<ExePackage Id="VcRedist" SourceFile="$(var.VcRedistFile)" InstallArguments="/install /passive /norestart" Permanent="yes" PerMachine="yes">
<ArpEntry Id="$(var.VcRedistId)" Version="!(bind.packageVersion.VcRedist)" Win64="$(var.VcRedistWin64)" />
</ExePackage>
<MsiPackage Id="MainApp" SourceFile="$(var.MsiFile)" />
</Chain>
</Bundle>
</Wix>

View file

@ -57,6 +57,7 @@ endif()
configure_file(TransmissionConfig.wxi.in TransmissionConfig.wxi)
set(WIX_OUTPUT_BASE "${CMAKE_CURRENT_BINARY_DIR}/transmission-${MSI_FILENAME_VERSION}-${ARCH}")
add_custom_target(pack-msi
COMMAND wix build
-arch ${ARCH}
@ -72,7 +73,7 @@ add_custom_target(pack-msi
-define "OpenSslCryptoName=${TR_OPENSSL_CRYPTO_NAME}"
-define "OpenSslSslName=${TR_OPENSSL_SSL_NAME}"
-includepath "${CMAKE_CURRENT_BINARY_DIR}"
-out "${CMAKE_CURRENT_BINARY_DIR}/transmission-${MSI_FILENAME_VERSION}-${ARCH}.msi"
-out "${WIX_OUTPUT_BASE}.msi"
-ext WixToolset.UI.wixext
-ext WixToolset.Util.wixext
"${CMAKE_CURRENT_SOURCE_DIR}/components/CliTools.wxs"
@ -91,3 +92,18 @@ add_custom_target(pack-msi
Transmission.wxs
TransmissionConfig.wxi.in
"${CMAKE_CURRENT_BINARY_DIR}/TransmissionConfig.wxi")
add_custom_target(pack-exe
COMMAND wix build
-arch ${ARCH}
-define "VcRedistFile=$ENV{VCINSTALLDIR}Redist/MSVC/v${MSVC_TOOLSET_VERSION}/vc_redist.${ARCH}.exe"
-define "MsiFile=${WIX_OUTPUT_BASE}.msi"
-define "SplashScreenFile=${CMAKE_CURRENT_SOURCE_DIR}/SplashScreen.bmp"
-includepath "${CMAKE_CURRENT_BINARY_DIR}"
-out "${WIX_OUTPUT_BASE}.exe"
-ext WixToolset.BootstrapperApplications.wixext
"${CMAKE_CURRENT_SOURCE_DIR}/Bundle.wxs"
SOURCES
Bundle.wxs
TransmissionConfig.wxi.in
"${CMAKE_CURRENT_BINARY_DIR}/TransmissionConfig.wxi")

BIN
dist/msi/SplashScreen.bmp vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 KiB

View file

@ -91,11 +91,15 @@ function global:Build-Transmission(
Copy-Item -Path (Join-Path $DepsPrefixDir translations) -Destination $PrefixDir -Recurse
}
Invoke-VcEnvCommand cmake --build $BuildDir --target pack-msi
New-Item -Path $ArtifactsDir -ItemType Directory -ErrorAction Ignore | Out-Null
Invoke-VcEnvCommand cmake --build $BuildDir --target pack-msi
$MsiPackage = (Get-ChildItem (Join-Path $BuildDir dist msi 'transmission-*.msi'))[0]
Move-Item -Path $MsiPackage.FullName -Destination $ArtifactsDir
Copy-Item -Path $MsiPackage.FullName -Destination $ArtifactsDir
Invoke-VcEnvCommand cmake --build $BuildDir --target pack-exe
$ExePackage = (Get-ChildItem (Join-Path $BuildDir dist msi 'transmission-*.exe'))[0]
Copy-Item -Path $ExePackage.FullName -Destination $ArtifactsDir
if ($PackDebugSyms) {
Invoke-NativeCommand cmake -E chdir $DebugSymbolsDir 7z a -y (Join-Path $ArtifactsDir "$($MsiPackage.BaseName)-pdb.7z")