From 250f40c48235a52b04b529bc543950ee88dc1618 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 25 Nov 2024 12:44:35 +0200 Subject: [PATCH] Convert to Wix 5 Signed-off-by: Raul Metsma --- .appveyor.yml | 19 +- .github/workflows/windows.yml | 5 + win32/Make.rules.mak | 24 +- win32/Makefile.mak | 7 +- win32/OpenSC.wxs.in | 579 +++++++++++----------------------- 5 files changed, 214 insertions(+), 420 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 57ab9eca73..f9efae8ca3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,18 +15,12 @@ environment: OPENPACE_VER: 1.1.3 ZLIB_VER_DOT: 1.2.12 matrix: - # not compatible with OpenSSL 1.1.1: - # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - # VCVARSALL: "%VS120COMNTOOLS%/../../VC/vcvarsall.bat" - #- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - #VCVARSALL: "%VS140COMNTOOLS%/../../VC/vcvarsall.bat" - #DO_PUSH_ARTIFACT: yes - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - VCVARSALL: "%ProgramFiles(x86)%/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat" + #- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + # VCVARSALL: "%ProgramFiles(x86)%/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat" + # DO_PUSH_ARTIFACT: yes + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + VCVARSALL: "%ProgramFiles(x86)%/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat" DO_PUSH_ARTIFACT: yes - # not compatible with WiX 3.11.2: - # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - # VCVARSALL: "%ProgramFiles(x86)%/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat" install: - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` @@ -68,6 +62,9 @@ install: - cpdksetup.exe /quiet - uname -a - set + - dotnet tool install -g --version 5.0.2 wix + - wix extension add -g WixToolset.UI.wixext/5.0.2 + - wix extension add -g WixToolset.Util.wixext/5.0.2 build_script: - ps: >- diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d44b6e08a6..67d29e909b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -68,6 +68,11 @@ jobs: vcpkgArguments: zlib openssl vcpkgGitCommitId: 511d74f695bd45959d12b50b00f1b68f69e8f0b0 vcpkgTriplet: ${{ matrix.platform }}-windows-static + - name: Install WIX + run: | + dotnet tool install -g --version 5.0.2 wix + wix extension add -g WixToolset.UI.wixext/5.0.2 + wix extension add -g WixToolset.Util.wixext/5.0.2 - name: Restore Cache if: matrix.configuration == 'Release' uses: actions/cache@v4 diff --git a/win32/Make.rules.mak b/win32/Make.rules.mak index 980a2a344f..5dae7c4add 100644 --- a/win32/Make.rules.mak +++ b/win32/Make.rules.mak @@ -38,24 +38,25 @@ OPENSSL_STATIC_DIR = static !IF "$(OPENSSL_LIB)" == "" !IF "$(DEBUG_DEF)" == "/DDEBUG" !IF "$(PLATFORM)" == "x86" -OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\libcrypto32MTd.lib +OPENSSL_LIB = libcrypto32MTd.lib !ELSE -OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\libcrypto64MTd.lib +OPENSSL_LIB = libcrypto64MTd.lib !ENDIF !ELSE !IF "$(PLATFORM)" == "x86" -OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\libcrypto32MT.lib +OPENSSL_LIB = libcrypto32MT.lib !ELSE -OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\libcrypto64MT.lib +OPENSSL_LIB = libcrypto64MT.lib !ENDIF !ENDIF +OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\$(OPENSSL_LIB) !ENDIF OPENSSL_LIB = $(OPENSSL_LIB) user32.lib advapi32.lib crypt32.lib ws2_32.lib PROGRAMS_OPENSSL = cryptoflex-tool.exe pkcs15-init.exe netkey-tool.exe piv-tool.exe \ westcos-tool.exe sc-hsm-tool.exe dnie-tool.exe gids-tool.exe OPENSC_FEATURES = $(OPENSC_FEATURES) openssl -CANDLEFLAGS = -dOpenSSL="$(OPENSSL_DIR)" $(CANDLEFLAGS) +WIXFLAGS = -d OpenSSL="$(OPENSSL_DIR)" $(WIXFLAGS) !ENDIF @@ -82,7 +83,7 @@ ZLIB_INCL_DIR = /IC:\zlib-dll\include ZLIB_LIB = C:\zlib-dll\lib\zdll.lib !ENDIF OPENSC_FEATURES = $(OPENSC_FEATURES) zlib -CANDLEFLAGS = -dzlib="C:\zlib-dll" $(CANDLEFLAGS) +WIXFLAGS = -d zlib="C:\zlib-dll" $(WIXFLAGS) !ENDIF @@ -102,19 +103,20 @@ OPENPACE_LIB = $(OPENPACE_DIR)\src\libeac.lib # Build only when OpenPACE and OpenSSL are available PROGRAMS_OPENPACE = npa-tool.exe !ENDIF -CANDLEFLAGS = -dOpenPACE="$(OPENPACE_DIR)" $(CANDLEFLAGS) +WIXFLAGS = -d OpenPACE="$(OPENPACE_DIR)" $(WIXFLAGS) !ENDIF # Used for MiniDriver CPDK_INCL_DIR = "/IC:\Program Files (x86)\Windows Kits\10\Cryptographic Provider Development Kit\Include" -COPTS = /nologo /Zi /GS /W3 /WX /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS /DHAVE_CONFIG_H /DWINVER=0x0601 /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /DOPENSC_FEATURES="\"$(OPENSC_FEATURES)\"" -COPTS = $(COPTS) $(DEBUG_DEF) $(OPENPACE_DEF) $(OPENSSL_DEF) $(ZLIB_DEF) $(MINIDRIVER_DEF) $(SM_DEF) $(TESTS_DEF) $(OPENSSL_EXTRA_CFLAGS) -COPTS = $(COPTS) /I$(TOPDIR)\win32 /I$(TOPDIR)\src $(OPENPACE_INCL_DIR) $(OPENSSL_INCL_DIR) $(ZLIB_INCL_DIR) $(CPDK_INCL_DIR) $(WIX_INCL_DIR) +COPTS = /nologo /Zi /GS /W3 /WX /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS /DHAVE_CONFIG_H \ + /DWINVER=0x0601 /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /DOPENSC_FEATURES="\"$(OPENSC_FEATURES)\"" \ + $(DEBUG_DEF) $(OPENPACE_DEF) $(OPENSSL_DEF) $(ZLIB_DEF) $(MINIDRIVER_DEF) $(SM_DEF) $(TESTS_DEF) $(OPENSSL_EXTRA_CFLAGS) \ + $(COPTS) /I$(TOPDIR)\win32 /I$(TOPDIR)\src $(OPENPACE_INCL_DIR) $(OPENSSL_INCL_DIR) $(ZLIB_INCL_DIR) $(CPDK_INCL_DIR) $(WIX_INCL_DIR) LINKFLAGS = /nologo /machine:$(PLATFORM) /INCREMENTAL:NO /NXCOMPAT /DYNAMICBASE /DEBUG /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCRTD LIBFLAGS = /nologo /machine:$(PLATFORM) -CANDLEFLAGS = -arch $(PLATFORM) $(CANDLEFLAGS) +WIXFLAGS = -arch $(PLATFORM) $(WIXFLAGS) !IF "$(DEBUG_DEF)" == "/DDEBUG" LINKFLAGS = $(LINKFLAGS) /NODEFAULTLIB:LIBCMT diff --git a/win32/Makefile.mak b/win32/Makefile.mak index 0231c92656..32a51aba41 100644 --- a/win32/Makefile.mak +++ b/win32/Makefile.mak @@ -13,11 +13,8 @@ customactions.dll: versioninfo-customactions.res customactions.obj type customactions.exports >> $*.def link /dll $(LINKFLAGS) /def:$*.def /out:customactions.dll versioninfo-customactions.res customactions.obj msi.lib $(WIX_LIBS) Advapi32.lib User32.lib Version.lib Shell32.lib -OpenSC.msi: OpenSC.wixobj - "$(WIX)\bin\light.exe" -ext WixUIExtension -ext WiXUtilExtension $? - -OpenSC.wixobj: OpenSC.wxs customactions.dll - "$(WIX)\bin\candle.exe" -ext WiXUtilExtension -dSOURCE_DIR=$(TOPDIR) $(CANDLEFLAGS) OpenSC.wxs +OpenSC.msi: OpenSC.wxs customactions.dll + wix build -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -d SOURCE_DIR=$(TOPDIR) $(WIXFLAGS) OpenSC.wxs clean:: del /Q config.h *.msi *.wixobj *.wixpdb diff --git a/win32/OpenSC.wxs.in b/win32/OpenSC.wxs.in index cab970161b..7a041f3dc6 100644 --- a/win32/OpenSC.wxs.in +++ b/win32/OpenSC.wxs.in @@ -1,462 +1,255 @@ - + - + - - - + - + - + - - - + - + - - + - + Manufacturer="@OPENSC_VS_FF_COMPANY_NAME@" + InstallerVersion="300"> + - - + + - - - - + + + + - - + + - - - + + + - - - - - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - + + - - - + + + - - + + - + - - - + + + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - - - + + + - 1 - 1 + + - - - + - - - + - - - + - +