Skip to content

Commit

Permalink
Build Windows Arm64 binaries
Browse files Browse the repository at this point in the history
OpenSC#2450, Depends OpenSC#3283

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma committed Jan 16, 2025
1 parent 23a664b commit 3ccc537
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 29 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ jobs:
runs-on: ${{ matrix.image }}
strategy:
matrix:
platform: [x86, x64]
platform: [x86, x64, arm64]
configuration: [Light, Release]
image: [windows-2019, windows-2022]
include:
- platform: x86
setenv: amd64_x86
- platform: x64
setenv: amd64
- platform: arm64
setenv: amd64_arm64
env:
OPENPACE_VER: 1.1.3
steps:
Expand All @@ -34,7 +41,7 @@ jobs:
- name: Package name
shell: bash
run: |
echo ARTIFACT=OpenSC-${{ steps.ghd.outputs.tag }}_${{ matrix.platform == 'x86' && 'win32' || 'win64' }}${{ matrix.configuration == 'Light' && '-Light' || '' }} >> $GITHUB_ENV
echo ARTIFACT=OpenSC-${{ steps.ghd.outputs.tag }}_${{ matrix.platform }}${{ matrix.configuration == 'Light' && '-Light' || '' }} >> $GITHUB_ENV
- name: Install CPDK
run: choco install windows-cryptographic-provider-development-kit -y > $null
- name: Install autotools
Expand All @@ -59,7 +66,7 @@ jobs:
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.platform }}
arch: ${{ matrix.setenv }}
- name: Prepare vcpkg
if: matrix.configuration == 'Release'
uses: lukka/run-vcpkg@v7
Expand Down
6 changes: 1 addition & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ define([VS_FF_LEGAL_COMPANY_URL], [https://github.com/OpenSC])
define([VS_FF_COMMENTS], [Provided under the terms of the GNU Lesser General Public License (LGPLv2.1+).])
define([VS_FF_PRODUCT_NAME], [OpenSC smartcard framework])
define([VS_FF_PRODUCT_UPDATES], [https://github.com/OpenSC/OpenSC/releases])
define([VS_FF_PRODUCT_URL], [https://github.com/OpenSC/OpenSC])

m4_sinclude(m4/version.m4.ci)

Expand All @@ -40,7 +39,6 @@ OPENSC_VS_FF_COMPANY_URL="VS_FF_LEGAL_COMPANY_URL"
OPENSC_VS_FF_COMMENTS="VS_FF_COMMENTS"
OPENSC_VS_FF_PRODUCT_NAME="VS_FF_PRODUCT_NAME"
OPENSC_VS_FF_PRODUCT_UPDATES="VS_FF_PRODUCT_UPDATES"
OPENSC_VS_FF_PRODUCT_URL="VS_FF_PRODUCT_URL"

# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
Expand Down Expand Up @@ -1082,7 +1080,6 @@ AC_DEFINE_UNQUOTED([OPENSC_VS_FF_COMPANY_NAME], ["${OPENSC_VS_FF_COMPANY_NAME}"]
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_COMMENTS], ["${OPENSC_VS_FF_COMMENTS}"], [OpenSC version-info Comments])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_PRODUCT_NAME], ["${OPENSC_VS_FF_PRODUCT_NAME}"], [OpenSC version-info ProductName])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_PRODUCT_UPDATES], ["${OPENSC_VS_FF_PRODUCT_UPDATES}"], [OpenSC version-info UpdateURL])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_PRODUCT_URL], ["${OPENSC_VS_FF_PRODUCT_URL}"], [OpenSC version-info ProductURL])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_COMPANY_URL], ["${OPENSC_VS_FF_COMPANY_URL}"], [OpenSC version-info UpdateURL])

pkcs11dir="\$(libdir)/pkcs11"
Expand All @@ -1099,7 +1096,6 @@ AC_SUBST([OPENSC_VS_FF_COMPANY_NAME])
AC_SUBST([OPENSC_VS_FF_COMMENTS])
AC_SUBST([OPENSC_VS_FF_PRODUCT_NAME])
AC_SUBST([OPENSC_VS_FF_PRODUCT_UPDATES])
AC_SUBST([OPENSC_VS_FF_PRODUCT_URL])
AC_SUBST([OPENSC_VS_FF_COMPANY_URL])
AC_SUBST([OPENSC_LT_CURRENT])
AC_SUBST([OPENSC_LT_REVISION])
Expand Down Expand Up @@ -1225,7 +1221,7 @@ Company URL: ${OPENSC_VS_FF_COMPANY_URL}
Comments: ${OPENSC_VS_FF_COMMENTS}
Product name: ${OPENSC_VS_FF_PRODUCT_NAME}
Product updates: ${OPENSC_VS_FF_PRODUCT_UPDATES}
Product URL: ${OPENSC_VS_FF_PRODUCT_URL}
Product URL: ${PACKAGE_URL}

User binaries: $(eval eval eval echo "${bindir}")
Configuration files: $(eval eval eval echo "${sysconfdir}")
Expand Down
1 change: 0 additions & 1 deletion win32/Make.rules.mak
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ COPTS = /nologo /Zi /GS /W3 /WX /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_WAR
/I$(TOPDIR)\win32 /I$(TOPDIR)\src $(OPENPACE_INCL_DIR) $(OPENSSL_INCL_DIR) $(ZLIB_INCL_DIR) $(CPDK_INCL_DIR)
LINKFLAGS = /nologo /INCREMENTAL:NO /NXCOMPAT /DYNAMICBASE /DEBUG /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCRTD
LIBFLAGS = /nologo
WIXFLAGS = -arch $(PLATFORM) $(WIXFLAGS)

!IF "$(DEBUG_DEF)" == "/DDEBUG"
LINKFLAGS = $(LINKFLAGS) /NODEFAULTLIB:LIBCMT
Expand Down
2 changes: 1 addition & 1 deletion win32/Makefile.mak
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ customactions.dll: versioninfo-customactions.res customactions.obj
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.wxs customactions.dll
wix build -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -d SOURCE_DIR=$(TOPDIR) $(WIXFLAGS) OpenSC.wxs
wix build -arch $(PLATFORM) -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -d SOURCE_DIR=$(TOPDIR) $(WIXFLAGS) OpenSC.wxs

clean::
del /Q config.h *.msi *.wixobj *.wixpdb
48 changes: 29 additions & 19 deletions win32/OpenSC.wxs.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@
<?define ProductName = "@OPENSC_VS_FF_PRODUCT_NAME@ (64bit)" ?>
<?endif?>
<?define PlatformUpgradeCode = "{9A449570-69A2-11E0-9CC6-955B4824019B}" ?>
<?define BUILD_ARCH = "AMD64" ?>
<?define SUFFIX = "" ?>
<?elseif $(sys.BUILDARCH) = arm64 ?>
<?ifndef OpenSSL ?>
<?define ProductName = "@OPENSC_VS_FF_PRODUCT_NAME@ Light (ARM 64bit)" ?>
<?else?>
<?define ProductName = "@OPENSC_VS_FF_PRODUCT_NAME@ (ARM 64bit)" ?>
<?endif?>
<?define PlatformUpgradeCode = "{63666c12-c4b5-4e55-87af-3babcd563c28}" ?>
<?define BUILD_ARCH = "ARM64" ?>
<?define SUFFIX = "_arm64" ?>
<?else?>
<?ifndef OpenSSL ?>
<?define ProductName = "@OPENSC_VS_FF_PRODUCT_NAME@ Light" ?>
<?else?>
<?define ProductName = "@OPENSC_VS_FF_PRODUCT_NAME@" ?>
<?endif?>
<?define PlatformUpgradeCode = "{69428F65-B96D-458D-BB87-DBB5FDB35DCE}" ?>
<?define BUILD_ARCH = "x86" ?>
<?define SUFFIX = "" ?>
<?endif?>

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
Expand All @@ -23,16 +36,15 @@
Language="1033"
Codepage="1252"
Version="@OPENSC_VERSION_MAJOR@.@OPENSC_VERSION_MINOR@.@OPENSC_VERSION_FIX@.@OPENSC_VERSION_REVISION@"
Manufacturer="@OPENSC_VS_FF_COMPANY_NAME@"
InstallerVersion="300">
<SummaryInformation Description="@VS_FF_PRODUCT_NAME@ Installer"
Manufacturer="@OPENSC_VS_FF_COMPANY_NAME@">
<SummaryInformation Description="@OPENSC_VS_FF_PRODUCT_NAME@ Installer"
Manufacturer="@OPENSC_VS_FF_COMPANY_NAME@" />
<!-- Setup background images -->
<WixVariable Id="WixUIBannerBmp" Value="bannrbmp.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="dlgbmp.bmp" />
<!-- Links in info -->
<Property Id="ARPHELPLINK" Value="@PRODUCT_BUGREPORT@" />
<Property Id="ARPURLINFOABOUT" Value="@OPENSC_VS_FF_PRODUCT_URL@" />
<Property Id="ARPHELPLINK" Value="@PACKAGE_BUGREPORT@" />
<Property Id="ARPURLINFOABOUT" Value="@PACKAGE_URL@" />
<Property Id="ARPURLUPDATEINFO" Value="@OPENSC_VS_FF_PRODUCT_UPDATES@" />
<Property Id="ARPCONTACT" Value="@OPENSC_VS_FF_COMPANY_URL@" />

Expand All @@ -45,6 +57,12 @@
<CustomAction Id="AddSmartCardConfiguration" BinaryRef="customactions" DllEntry="AddSmartCardConfiguration" Execute="commit" Impersonate="no" />
<CustomAction Id="Start_pkcs11_register.exe" Execute="immediate" Impersonate="yes" Return="asyncNoWait" FileRef="pkcs11_register.exe" ExeCommand="" />

<Property Id="NATIVE_ARCH">
<RegistrySearch Id="NativeArchSearch" Root="HKLM" Name="PROCESSOR_ARCHITECTURE" Type="raw"
Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment" />
</Property>
<Property Id="BUILD_ARCH" Value="$(var.BUILD_ARCH)" />

<Media Id="1" Cabinet="OpenSC.cab" EmbedCab="yes" CompressionLevel="high" />

<Component Id="SCardSvr" Permanent="yes" Directory="INSTALLDIR">
Expand All @@ -57,7 +75,7 @@
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="OpenSC_Project_Dir" Name="OpenSC Project">
<!-- Most of the stuff goes to the Program Files folder -->
<Directory Id="INSTALLDIR" Name="OpenSC">
<Directory Id="INSTALLDIR" Name="OpenSC$(var.SUFFIX)">
<!-- opensc.conf sample goes to installation directory -->
<Component Id="opensc.conf">
<File Source="$(var.SOURCE_DIR)\etc\opensc.conf" KeyPath="yes" />
Expand Down Expand Up @@ -106,12 +124,8 @@
</Directory>

<Directory Id="INSTALLDIR_PKCS11" Name="pkcs11">
<Component Id="opensc_pkcs11.dll">
<File Source="$(var.SOURCE_DIR)\src\pkcs11\opensc-pkcs11.dll" />
</Component>
<Component Id="onepin_opensc_pkcs11.dll">
<File Name="onepin-opensc-pkcs11.dll" Source="$(var.SOURCE_DIR)\src\pkcs11\opensc-pkcs11.dll" />
</Component>
<File Id="opensc_pkcs11.dll" Source="$(var.SOURCE_DIR)\src\pkcs11\opensc-pkcs11.dll" />
<File Id="onepin_opensc_pkcs11.dll" Name="onepin-opensc-pkcs11.dll" Source="$(var.SOURCE_DIR)\src\pkcs11\opensc-pkcs11.dll" />
</Directory>

<Directory Id="INSTALLDIR_TOOLS" Name="tools" />
Expand All @@ -121,20 +135,16 @@
<RegistryValue Type="string" Name="pkcs11-register.exe" Value="[INSTALLDIR_TOOLS]pkcs11-register.exe" />
</RegistryKey>
</Component>
<Component Id="Autostart_native_tools" Condition="'$(sys.BUILDARCH)' != 'x86' OR NOT VersionNT64">
<Component Id="Autostart_native_tools" Condition="BUILD_ARCH = NATIVE_ARCH">
<RegistryKey Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Type="string" Name="opensc-notify.exe" Value="[INSTALLDIR_TOOLS]opensc-notify.exe" />
</RegistryKey>
</Component>

<?ifdef OpenPACE ?>
<Directory Id="INSTALLDIR_CVC" Name="cvc">
<Component Id="DESRCACC100001">
<File Source="$(var.SOURCE_DIR)\etc\DESRCACC100001" />
</Component>
<Component Id="DESCHSMCVCA00001">
<File Source="$(var.SOURCE_DIR)\etc\DESCHSMCVCA00001" />
</Component>
<File Id="DESRCACC100001" Source="$(var.SOURCE_DIR)\etc\DESRCACC100001" />
<File Id="DESCHSMCVCA00001" Source="$(var.SOURCE_DIR)\etc\DESCHSMCVCA00001" />
</Directory>
<?endif?>
</Directory>
Expand Down

0 comments on commit 3ccc537

Please sign in to comment.