Add MSM packaging support

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-04-16 16:10:48 +02:00
parent f8a2923b93
commit 1031ad44da
3 changed files with 83 additions and 2 deletions

View File

@ -4,6 +4,12 @@
# Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
#
# TODO: Unify version definition with wintun.vcxproj.
WINTUN_VERSION_MAJ=0
WINTUN_VERSION_MIN=0
WINTUN_VERSION_REV=2019
WINTUN_VERSION_BUILD=0128
!IFNDEF CFG
CFG=Release
!ENDIF
@ -13,17 +19,26 @@ PLAT=amd64
!IF "$(PLAT)" == "x86" || "$(PLAT)" == "X86"
PLAT=x86
PLAT_MSBUILD=Win32
PLAT_WIX=x86
!ELSEIF "$(PLAT)" == "amd64" || "$(PLAT)" == "AMD64"
PLAT=amd64
PLAT_MSBUILD=x64
PLAT_WIX=x64
!ELSEIF "$(PLAT)" == "arm64" || "$(PLAT)" == "ARM64"
PLAT=arm64
PLAT_MSBUILD=ARM64
PLAT_WIX=arm64 # TODO: Follow WiX ARM64 support.
!ELSE
!ERROR Invalid platform "$(PLAT)". PLAT must be "x86", "amd64", or "arm64".
!ENDIF
OUTPUT_DIR=$(PLAT)\$(CFG)
MSBUILD_FLAGS=/p:Configuration="$(CFG)" /p:Platform="$(PLAT_MSBUILD)" /m /v:minimal /nologo
WIX_CANDLE_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -arch "$(PLAT_WIX)" \
-dWINTUN_VERSION_MAJ="$(WINTUN_VERSION_MAJ)" \
-dWINTUN_VERSION_MIN="$(WINTUN_VERSION_MIN)" \
-dWINTUN_VERSION_REV="$(WINTUN_VERSION_REV)" \
-dWINTUN_VERSION_BUILD="$(WINTUN_VERSION_BUILD)"
WIX_LIGHT_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -b output_dir="$(OUTPUT_DIR)"
build ::
msbuild.exe "wintun.vcxproj" /t:Build $(MSBUILD_FLAGS)
@ -47,3 +62,22 @@ clean ::
msbuild.exe "wintun.vcxproj" /t:dvl $(MSBUILD_FLAGS)
!ENDIF
msm :: "$(OUTPUT_DIR)\wintun.msm"
clean ::
-if exist "$(OUTPUT_DIR)\wintun.wixobj" del /f /q "$(OUTPUT_DIR)\wintun.wixobj"
-if exist "$(OUTPUT_DIR)\wintun.wixpdb" del /f /q "$(OUTPUT_DIR)\wintun.wixpdb"
-if exist "$(OUTPUT_DIR)\wintun.msm" del /f /q "$(OUTPUT_DIR)\wintun.msm"
"$(OUTPUT_DIR)\wintun.wixobj" : "wintun.wxs"
"$(WIX)bin\candle.exe" $(WIX_CANDLE_FLAGS) -out $@ $**
"$(OUTPUT_DIR)\wintun.msm" "$(OUTPUT_DIR)\wintun.wixpdb" : \
"$(OUTPUT_DIR)\wintun.cer" \
"$(OUTPUT_DIR)\wintun\wintun.cat" \
"$(OUTPUT_DIR)\wintun\wintun.inf" \
"$(OUTPUT_DIR)\wintun\wintun.sys" \
"$(OUTPUT_DIR)\wintun.wixobj" \
"$(WIX)bin\difxapp_$(PLAT_WIX).wixlib"
"$(WIX)bin\light.exe" $(WIX_LIGHT_FLAGS) -out "$(OUTPUT_DIR)\wintun.msm" "$(OUTPUT_DIR)\wintun.wixobj" "$(WIX)bin\difxapp_$(PLAT_WIX).wixlib"

View File

@ -7,6 +7,7 @@ This is a layer 3 TUN driver for Windows 7, 8, 8.1, and 10. Originally created f
- [Visual Studio 2017](https://visualstudio.microsoft.com/downloads/)
- [Windows Driver Kit for Windows 10](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk)
- [WiX Toolset 3.11.1](http://wixtoolset.org/releases/)
## Digital Signing
@ -47,6 +48,8 @@ nmake [<target>] [CFG=<configuration>] [PLAT=<platform>]
- `dvl`: Runs Static Driver Verifier, which includes a clean driver build, and creates a Driver Verification Log in `wintun.DVL.XML` file. Release configurations only. When you are ready to test your driver using the Windows Hardware Certification Kit (HCK), you need to copy the `wintun.DVL.XML` file to the `%SystemDrive%\DVL` directory on the test computer.
- `msm`: Builds Microsoft Installer Merge Module in `<output folder>\wintun.msm`. This target requires the driver to be built first (e.g. `nmake build msm` or `nmake dvl msm`).
The driver output folder is:
Platform and Configuration | Folder

44
wintun.wxs Normal file
View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-License-Identifier: GPL-2.0
Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
-->
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:diffx="http://schemas.microsoft.com/wix/DifxAppExtension"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Module Id="wintun" Language="1033" Version="$(var.WINTUN_VERSION_MAJ).$(var.WINTUN_VERSION_MIN).$(var.WINTUN_VERSION_REV).$(var.WINTUN_VERSION_BUILD)">
<Package
Id="c28309d9-1954-4f2d-a7d1-228850092460"
Description="Wintun Userspace Tunnel"
Manufacturer="WireGuard LLC"
InstallerVersion="200" />
<Binary Id="wintun.cer" SourceFile="!(bindpath.output_dir)wintun.cer"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder">
<Component Id="wintun.cat" Guid="41fbe711-a1af-4b83-8b5d-fc1b112969c1">
<File Id="wintun.cat" Name="wintun.cat" Source="!(bindpath.output_dir)wintun\wintun.cat"/>
<iis:Certificate
Id="wintun.cer"
Name="WireGuard LLC"
StoreLocation="localMachine"
StoreName="trustedPublisher"
BinaryKey="wintun.cer"
Request="no"/>
<diffx:Driver
AddRemovePrograms="no"
PlugAndPlayPrompt="no"/>
</Component>
<Component Id="wintun.inf" Guid="c58122b3-c7ba-4207-b68d-a236e371f9ed">
<File Id="wintun.inf" Name="wintun.inf" Source="!(bindpath.output_dir)wintun\wintun.inf"/>
</Component>
<Component Id="wintun.sys" Guid="d0fde4a4-d228-4803-b57e-76bd8b16cf42">
<File Id="wintun.sys" Name="wintun.sys" Source="!(bindpath.output_dir)wintun\wintun.sys"/>
</Component>
</Directory>
</Directory>
</Module>
</Wix>