aboutsummaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-08-05 13:32:03 +0200
committerSimon Rozman <simon@rozman.si>2019-08-05 17:14:27 +0200
commitfa715c48638c7316ed6eaf555e664fa39b302d5e (patch)
tree12b8a6e06e6b3d4b0b83a5bb6389a4199a71cdb5 /installer
parentDynamically gather signtool full path (diff)
downloadwintun-fa715c48638c7316ed6eaf555e664fa39b302d5e.tar.xz
wintun-fa715c48638c7316ed6eaf555e664fa39b302d5e.zip
Use WiX directly rather than via WiX's MSBuild
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'installer')
-rw-r--r--installer/installer.vcxproj41
-rw-r--r--installer/installer.vcxproj.filters3
-rw-r--r--installer/installer.wixproj76
-rw-r--r--installer/installer.wxs2
4 files changed, 39 insertions, 83 deletions
diff --git a/installer/installer.vcxproj b/installer/installer.vcxproj
index 29a5cf1..d334ca6 100644
--- a/installer/installer.vcxproj
+++ b/installer/installer.vcxproj
@@ -111,8 +111,20 @@
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
<LocalDebuggerCommand>rundll32.exe</LocalDebuggerCommand>
- <LocalDebuggerCommandArguments>..\$(WintunPlatform)\$(Configuration)\installer.dll,InstallWintun</LocalDebuggerCommandArguments>
+ <LocalDebuggerCommandArguments>$(OutDir)$(TargetName)$(TargetExt),InstallWintun</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ <WixArch Condition="'$(Platform)'=='Win32'">x86</WixArch>
+ <WixArch Condition="'$(Platform)'=='x64'">x64</WixArch>
+ <WixArch Condition="'$(Platform)'=='ARM64'">arm64</WixArch>
+ <WixCandleFlags>$(WixCandleFlags) -nologo -arch $(WixArch) -dWINTUN_PLATFORM=$(WintunPlatform) -dWINTUN_VERSION=$(WintunVersion) -sw1086</WixCandleFlags>
+ <WixLightFlags>$(WixLightFlags) -nologo -b output_dir="$(OutDir.TrimEnd('\'))" -spdb -sw1076 -sw1079</WixLightFlags>
+ <WixOutputPath>$(OutDir)</WixOutputPath>
+ <WixOutputName>wintun</WixOutputName>
+ <WixOutputExt>.msm</WixOutputExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)'=='Release'">
+ <WixOutputPath>..\$(DistributionDir)</WixOutputPath>
+ <WixOutputName>wintun-$(WintunPlatform)-$(WintunVersionStr)</WixOutputName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
@@ -171,7 +183,6 @@
</ItemGroup>
<ItemGroup>
<None Include="exports.def" />
- <None Include="installer.wixproj" />
<None Include="installer.wxs" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
@@ -182,7 +193,9 @@
<SigningCertificate Condition="$(SignMode)=='TestSign' And '$(TestCertificate)'!=''">$(TestCertificate)</SigningCertificate>
<SigningCertificate Condition="$(SignMode)=='ProductionSign' And '$(ProductionCertificate)'!=''">$(ProductionCertificate)</SigningCertificate>
<BuildDependsOn Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">$(BuildDependsOn);SignTarget</BuildDependsOn>
- <CleanDependsOn>CleanSignTarget;$(CleanDependsOn)</CleanDependsOn>
+ <MSMDependsOn>$(MSMDependsOn);WixCompile;WixLink</MSMDependsOn>
+ <MSMDependsOn Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">$(MSMDependsOn);WixSign</MSMDependsOn>
+ <CleanDependsOn>CleanSignTarget;WixClean;$(CleanDependsOn)</CleanDependsOn>
</PropertyGroup>
<Target Name="SignTarget" Inputs="$(TargetPath)" Outputs="$(IntermediateOutputPath)$(TargetName).sign">
<Exec Command="&quot;$(SignToolPath)&quot; sign /sha1 &quot;$(SigningCertificate)&quot; /fd sha256 /tr &quot;$(TimeStampServer)&quot; /td sha256 &quot;$(TargetPath)&quot;" />
@@ -191,4 +204,26 @@
<Target Name="CleanSignTarget">
<Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
</Target>
+ <Target Name="HashInstallerLibrary" DependsOnTargets="Build">
+ <GetFileHash Files="$(OutDir)$(TargetName)$(TargetExt)" Algorithm="SHA256" HashEncoding="hex">
+ <Output TaskParameter="Items" ItemName="InstallerLibraryHash" />
+ </GetFileHash>
+ <PropertyGroup>
+ <WixCandleFlags>$(WixCandleFlags) -dINSTALLER_LIBRARY_HASH=@(InstallerLibraryHash->Metadata('FileHash')) -dINSTALLER_LIBRARY_TIME=$([System.IO.File]::GetLastWriteTime('$(OutDir)$(TargetName)$(TargetExt)').Ticks)</WixCandleFlags>
+ </PropertyGroup>
+ </Target>
+ <Target Name="WixCompile" DependsOnTargets="HashInstallerLibrary" Inputs="installer.wxs" Outputs="$(IntDir)installer.wixobj">
+ <Exec Command="&quot;$(WIX)bin\candle.exe&quot; $(WixCandleFlags) -out &quot;$(IntDir)installer.wixobj&quot; installer.wxs" />
+ </Target>
+ <Target Name="WixLink" DependsOnTargets="Build;WixCompile" Inputs="$(IntDir)installer.wixobj;$(OutDir)$(TargetName)$(TargetExt)" Outputs="$(WixOutputPath)$(WixOutputName)$(WixOutputExt)">
+ <Exec Command="&quot;$(WIX)bin\light.exe&quot; $(WixLightFlags) -out &quot;$(WixOutputPath)$(WixOutputName)$(WixOutputExt)&quot; &quot;$(IntDir)installer.wixobj&quot;" />
+ </Target>
+ <Target Name="WixSign" DependsOnTargets="WixLink" Inputs="$(WixOutputPath)$(WixOutputName)$(WixOutputExt)" Outputs="$(IntDir)$(WixOutputName).sign">
+ <Exec Command="&quot;$(SignToolPath)&quot; sign /sha1 &quot;$(SigningCertificate)&quot; /fd sha256 /tr &quot;$(TimeStampServer)&quot; /td sha256 &quot;$(WixOutputPath)$(WixOutputName)$(WixOutputExt)&quot;" />
+ <Touch Files="$(IntDir)$(WixOutputName).sign" AlwaysCreate="true" />
+ </Target>
+ <Target Name="WixClean">
+ <Delete Files="$(IntDir)installer.wixobj;$(WixOutputPath)$(WixOutputName)$(WixOutputExt);$(IntDir)$(WixOutputName).sign" />
+ </Target>
+ <Target Name="MSM" DependsOnTargets="$(MSMDependsOn)" />
</Project> \ No newline at end of file
diff --git a/installer/installer.vcxproj.filters b/installer/installer.vcxproj.filters
index bfbd0ec..e9d0282 100644
--- a/installer/installer.vcxproj.filters
+++ b/installer/installer.vcxproj.filters
@@ -42,9 +42,6 @@
<None Include="exports.def">
<Filter>Source Files</Filter>
</None>
- <None Include="installer.wixproj">
- <Filter>MSM</Filter>
- </None>
<None Include="installer.wxs">
<Filter>MSM</Filter>
</None>
diff --git a/installer/installer.wixproj b/installer/installer.wixproj
deleted file mode 100644
index fd1d8c3..0000000
--- a/installer/installer.wixproj
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- SPDX-License-Identifier: GPL-2.0
-
- Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
--->
-<Project
- xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
- ToolsVersion="4.0"
- InitialTargets="EnsureWixToolsetInstalled;HashInstallerLibrary"
- DefaultTargets="Build">
- <PropertyGroup>
- <Configuration Condition="'$(Configuration)'==''">Release</Configuration>
- <Platform Condition="'$(Platform)'==''">x64</Platform>
- <ProjectGuid>{F95A1EBF-1E19-47D4-9D8C-4F0C41B9E3B8}</ProjectGuid>
- <ProjectName>wintun</ProjectName>
- <OutputType>Module</OutputType>
- <DefineSolutionProperties>false</DefineSolutionProperties>
- </PropertyGroup>
-
- <Import Project="..\wintun.props" />
-
- <PropertyGroup>
- <IntermediateOutputPath>..\$(WintunPlatform)\$(Configuration)\</IntermediateOutputPath>
- <OutputPath>..\$(WintunPlatform)\$(Configuration)\</OutputPath>
- <OutputName>$(ProjectName)</OutputName>
- <DefineConstants>WINTUN_VERSION=$(WintunVersion);$(DefineConstants)</DefineConstants>
- <SuppressSpecificWarnings>1006;1086;$(SuppressSpecificWarnings)</SuppressSpecificWarnings>
- <LinkerSuppressSpecificWarnings>1079;1103;$(LinkerSuppressSpecificWarnings)</LinkerSuppressSpecificWarnings>
- <SuppressIces>ICE30;ICE49;$(SuppressIces)</SuppressIces>
- <LinkerAdditionalOptions>-b output_dir="$(IntermediateOutputPath.TrimEnd('\'))" $(LinkerAdditionalOptions)</LinkerAdditionalOptions>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)'=='Release'">
- <SuppressPdbOutput>true</SuppressPdbOutput>
- <OutputPath>..\$(DistributionDir)</OutputPath>
- <OutputName>$(ProjectName)-$(WintunPlatform)-$(WintunVersionStr)</OutputName>
- </PropertyGroup>
-
- <ItemGroup>
- <Compile Include="installer.wxs" />
- </ItemGroup>
-
- <Import Project="$(MSBuildProjectName).user" Condition="exists('$(MSBuildProjectName).user')" />
- <Import Project="$(WixTargetsPath)" Condition="'$(WixTargetsPath)'!=''" />
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition="'$(WixTargetsPath)'=='' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets')" />
- <Target Name="EnsureWixToolsetInstalled" Condition="'$(WixTargetsImported)'!='true'">
- <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
- </Target>
-
- <Target Name="HashInstallerLibrary">
- <GetFileHash Files="$(IntermediateOutputPath)installer.dll" Algorithm="SHA256" HashEncoding="hex">
- <Output TaskParameter="Items" ItemName="InstallerLibraryHash" />
- </GetFileHash>
- <PropertyGroup>
- <DefineConstants>$(DefineConstants);INSTALLER_LIBRARY_HASH=@(InstallerLibraryHash->Metadata('FileHash'));INSTALLER_LIBRARY_TIME=$([System.IO.File]::GetLastWriteTime('$(IntermediateOutputPath)installer.dll').Ticks)</DefineConstants>
- </PropertyGroup>
- </Target>
-
- <Import Project="..\wintun.vcxproj.user" Condition="exists('..\wintun.vcxproj.user')" />
- <PropertyGroup>
- <SigningCertificate Condition="$(SignMode)=='TestSign' And '$(TestCertificate)'!=''">$(TestCertificate)</SigningCertificate>
- <SigningCertificate Condition="$(SignMode)=='ProductionSign' And '$(ProductionCertificate)'!=''">$(ProductionCertificate)</SigningCertificate>
- <BuildDependsOn Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">$(BuildDependsOn);SignTarget</BuildDependsOn>
- <CleanDependsOn>CleanSignTarget;$(CleanDependsOn)</CleanDependsOn>
- </PropertyGroup>
- <Target
- Name="SignTarget"
- Inputs="$(TargetPath)"
- Outputs="$(IntermediateOutputPath)$(TargetName).sign">
- <Exec Command="&quot;$(SignToolPath)&quot; sign /sha1 &quot;$(SigningCertificate)&quot; /fd sha256 /tr &quot;$(TimeStampServer)&quot; /td sha256 &quot;$(TargetPath)&quot;" />
- <Touch Files="$(IntermediateOutputPath)$(TargetName).sign" AlwaysCreate="true" />
- </Target>
- <Target Name="CleanSignTarget">
- <Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
- </Target>
-</Project>
diff --git a/installer/installer.wxs b/installer/installer.wxs
index dd2f1c8..1883618 100644
--- a/installer/installer.wxs
+++ b/installer/installer.wxs
@@ -38,7 +38,7 @@
<Custom Action="ProcessWintun" After="InstallFiles" />
</InstallExecuteSequence>
- <?if $(var.Platform) = "x86"?>
+ <?if $(var.WINTUN_PLATFORM) = "x86"?>
<CustomAction Id="WoW64Unsupported" Error="You are attempting to install the 32-bit variant of [ProductName] on a 64-bit operating system, which is not supported. Please install the 64-bit variant instead." />
<InstallExecuteSequence>
<Custom Action="WoW64Unsupported" After="LaunchConditions"><![CDATA[VersionNT64]]></Custom>