1*2ccfa855SEd Maste # Copyright (c) 2021-2022 Yubico AB. All rights reserved.
2f540a430SEd Maste # Use of this source code is governed by a BSD-style
3f540a430SEd Maste # license that can be found in the LICENSE file.
4*2ccfa855SEd Maste # SPDX-License-Identifier: BSD-2-Clause
5f540a430SEd Maste
6f540a430SEd Maste $ErrorActionPreference = "Stop"
7f540a430SEd Maste $Architectures = @('x64', 'Win32', 'ARM64', 'ARM')
8f540a430SEd Maste $InstallPrefixes = @('Win64', 'Win32', 'ARM64', 'ARM')
9f540a430SEd Maste $Types = @('dynamic', 'static')
10f540a430SEd Maste $Config = 'Release'
113e696dfbSEd Maste $SDK = '143'
12f540a430SEd Maste
13f540a430SEd Maste . "$PSScriptRoot\const.ps1"
14f540a430SEd Maste
15f540a430SEd Maste foreach ($Arch in $Architectures) {
16f540a430SEd Maste foreach ($Type in $Types) {
17f540a430SEd Maste ./build.ps1 -Arch ${Arch} -Type ${Type} -Config ${Config}
18f540a430SEd Maste }
19f540a430SEd Maste }
20f540a430SEd Maste
21f540a430SEd Maste foreach ($InstallPrefix in $InstallPrefixes) {
22f540a430SEd Maste foreach ($Type in $Types) {
23f540a430SEd Maste New-Item -Type Directory `
24f540a430SEd Maste "${OUTPUT}/pkg/${InstallPrefix}/${Config}/v${SDK}/${Type}"
25f540a430SEd Maste }
26f540a430SEd Maste }
27f540a430SEd Maste
Package-Headers()28f540a430SEd Maste Function Package-Headers() {
29f540a430SEd Maste Copy-Item "${OUTPUT}\x64\dynamic\include" -Destination "${OUTPUT}\pkg" `
30f540a430SEd Maste -Recurse -ErrorAction Stop
31f540a430SEd Maste }
32f540a430SEd Maste
Package-Dynamic(${SRC}, ${DEST})33f540a430SEd Maste Function Package-Dynamic(${SRC}, ${DEST}) {
34f540a430SEd Maste Copy-Item "${SRC}\bin\cbor.dll" "${DEST}"
35f540a430SEd Maste Copy-Item "${SRC}\lib\cbor.lib" "${DEST}"
36f540a430SEd Maste Copy-Item "${SRC}\bin\zlib1.dll" "${DEST}"
37*2ccfa855SEd Maste Copy-Item "${SRC}\lib\zlib1.lib" "${DEST}"
38*2ccfa855SEd Maste Copy-Item "${SRC}\bin\${CRYPTO_LIBRARIES}.dll" "${DEST}"
39*2ccfa855SEd Maste Copy-Item "${SRC}\lib\${CRYPTO_LIBRARIES}.lib" "${DEST}"
40f540a430SEd Maste Copy-Item "${SRC}\bin\fido2.dll" "${DEST}"
41f540a430SEd Maste Copy-Item "${SRC}\lib\fido2.lib" "${DEST}"
42f540a430SEd Maste }
43f540a430SEd Maste
Package-Static(${SRC}, ${DEST})44f540a430SEd Maste Function Package-Static(${SRC}, ${DEST}) {
45f540a430SEd Maste Copy-Item "${SRC}/lib/cbor.lib" "${DEST}"
46*2ccfa855SEd Maste Copy-Item "${SRC}/lib/zlib1.lib" "${DEST}"
47*2ccfa855SEd Maste Copy-Item "${SRC}/lib/${CRYPTO_LIBRARIES}.lib" "${DEST}"
48f540a430SEd Maste Copy-Item "${SRC}/lib/fido2_static.lib" "${DEST}/fido2.lib"
49f540a430SEd Maste }
50f540a430SEd Maste
Package-PDBs({SRC}, {DEST})51f540a430SEd Maste Function Package-PDBs(${SRC}, ${DEST}) {
523e696dfbSEd Maste Copy-Item "${SRC}\${LIBRESSL}\crypto\crypto_obj.dir\${Config}\crypto_obj.pdb" `
53*2ccfa855SEd Maste "${DEST}\${CRYPTO_LIBRARIES}.pdb"
54f540a430SEd Maste Copy-Item "${SRC}\${LIBCBOR}\src\cbor.dir\${Config}\vc${SDK}.pdb" `
55f540a430SEd Maste "${DEST}\cbor.pdb"
56f540a430SEd Maste Copy-Item "${SRC}\${ZLIB}\zlib.dir\${Config}\vc${SDK}.pdb" `
57*2ccfa855SEd Maste "${DEST}\zlib1.pdb"
58f540a430SEd Maste Copy-Item "${SRC}\src\fido2_shared.dir\${Config}\vc${SDK}.pdb" `
59f540a430SEd Maste "${DEST}\fido2.pdb"
60f540a430SEd Maste }
61f540a430SEd Maste
Package-StaticPDBs(${SRC}, ${DEST})623e696dfbSEd Maste Function Package-StaticPDBs(${SRC}, ${DEST}) {
63*2ccfa855SEd Maste Copy-Item "${SRC}\${LIBRESSL}\crypto\crypto_obj.dir\${Config}\crypto_obj.pdb" `
64*2ccfa855SEd Maste "${DEST}\${CRYPTO_LIBRARIES}.pdb"
65*2ccfa855SEd Maste Copy-Item "${SRC}\${LIBCBOR}\src\${Config}\cbor.pdb" `
663e696dfbSEd Maste "${DEST}\cbor.pdb"
67*2ccfa855SEd Maste Copy-Item "${SRC}\${ZLIB}\${Config}\zlibstatic.pdb" `
68*2ccfa855SEd Maste "${DEST}\zlib1.pdb"
69*2ccfa855SEd Maste Copy-Item "${SRC}\src\${Config}\fido2_static.pdb" `
703e696dfbSEd Maste "${DEST}\fido2.pdb"
713e696dfbSEd Maste }
723e696dfbSEd Maste
Package-Tools(${SRC}, ${DEST})73f540a430SEd Maste Function Package-Tools(${SRC}, ${DEST}) {
74f540a430SEd Maste Copy-Item "${SRC}\tools\${Config}\fido2-assert.exe" `
75f540a430SEd Maste "${DEST}\fido2-assert.exe"
76f540a430SEd Maste Copy-Item "${SRC}\tools\${Config}\fido2-cred.exe" `
77f540a430SEd Maste "${DEST}\fido2-cred.exe"
78f540a430SEd Maste Copy-Item "${SRC}\tools\${Config}\fido2-token.exe" `
79f540a430SEd Maste "${DEST}\fido2-token.exe"
80f540a430SEd Maste }
81f540a430SEd Maste
82f540a430SEd Maste Package-Headers
83f540a430SEd Maste
84f540a430SEd Maste for ($i = 0; $i -lt $Architectures.Length; $i++) {
85f540a430SEd Maste $Arch = $Architectures[$i]
86f540a430SEd Maste $InstallPrefix = $InstallPrefixes[$i]
87f540a430SEd Maste Package-Dynamic "${OUTPUT}\${Arch}\dynamic" `
88f540a430SEd Maste "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\dynamic"
89f540a430SEd Maste Package-PDBs "${BUILD}\${Arch}\dynamic" `
90f540a430SEd Maste "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\dynamic"
91f540a430SEd Maste Package-Tools "${BUILD}\${Arch}\dynamic" `
92f540a430SEd Maste "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\dynamic"
93f540a430SEd Maste Package-Static "${OUTPUT}\${Arch}\static" `
94f540a430SEd Maste "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\static"
953e696dfbSEd Maste Package-StaticPDBs "${BUILD}\${Arch}\static" `
963e696dfbSEd Maste "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\static"
97f540a430SEd Maste }
98