Closed Kajusn closed 8 months ago
Adapt Make.rules.mak to your needs instead of setting environment variables
Took @frankmorgner's suggestion and it works! Thanks, I shall close this issue as it does not seem to be a bug, but rather my mistake not modifying Make.rules.mak prior to building.
For anyone coming across this in the future, my solution was to modify Make.rules.mak with the following, not so pretty commands in Windows CMD:
powershell -command "(get-content Make.rules.mak) -replace 'WIX\s*=\s*.*?$','WIX = C:\Program Files (x86)\WiX Toolset v3.14' | Set-Content Make.rules.mak"
powershell -command "(get-content Make.rules.mak) -replace 'CPDK_INCL_DIR\s*=\s*.*$','CPDK_INCL_DIR = \"/IC:\CPDK\Cryptographic Provider Development Kit\Include\"' | Set-Content Make.rules.mak"
powershell -command "(get-content Make.rules.mak) -replace 'CNGSDK_INCL_DIR\s*=\s*.*$','CNGSDK_INCL_DIR = \"/IC:\CPDK\Cryptographic Provider Development Kit\Include\"' | Set-Content Make.rules.mak"
Problem Description
I've been trying to set up a CI/CD workflow to build OpenSC from source on a Windows machine in a docker container. I followed the Compiling on Windows guide My docker container CPDK installation is at
C:\CPDK
and WiX v3.14 atC:\Program Files (x86)\WiX Toolset v3.14
. I have set the following environment variables prior to building:Building OpenSC using
nmake /f Makefile.mak
results in CNGSDK_INCL_DIR and CPDK_INCL_DIR env. variables not being used. This results in minidriver compilation failing due to cardmod.h not being found, because the search happens inC:\Program Files (x86)\Windows Kits\10\Cryptographic Provider Development Kit\Include
, which is not where my CPDK installation is.Building OpenSC installer immediately afterwards (
cd win32
andnmake /f Makefile.mak OpenSC.msi
) results in CNGSDK_INCL_DIR and CPDK_INCL_DIR env. variables being used correctly, for some reason.Oddly enough, it can be seen in the logs that the WIX environment variable is identified properly in both calls of
nmake
.Steps to reproduce
C:\CPDK
C:\Program Files (x86)\WiX Toolset v3.14
nmake /f Makefile.mak
cd win32
nmake /f Makefile.mak OpenSC.msi
Logs
nmake /f Makefile.mak
:cd win32
andnmake /f Makefile.mak OpenSC.msi
result in the following: