summaryrefslogtreecommitdiffstats
path: root/windows/release.ps1
blob: 423ec20f7e59a9b6b78aeba59ef519f006b9d7b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Copyright (c) 2021-2022 Yubico AB. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# SPDX-License-Identifier: BSD-2-Clause

$ErrorActionPreference = "Stop"
$Architectures = @('x64', 'Win32', 'ARM64', 'ARM')
$InstallPrefixes =  @('Win64', 'Win32', 'ARM64', 'ARM')
$Types = @('dynamic', 'static')
$Config = 'Release'
$LibCrypto = '49'
$SDK = '143'

. "$PSScriptRoot\const.ps1"

foreach ($Arch in $Architectures) {
	foreach ($Type in $Types) {
		./build.ps1 -Arch ${Arch} -Type ${Type} -Config ${Config}
	}
}

foreach ($InstallPrefix in $InstallPrefixes) {
	foreach ($Type in $Types) {
		New-Item -Type Directory `
		    "${OUTPUT}/pkg/${InstallPrefix}/${Config}/v${SDK}/${Type}"
	}
}

Function Package-Headers() {
	Copy-Item "${OUTPUT}\x64\dynamic\include" -Destination "${OUTPUT}\pkg" `
	    -Recurse -ErrorAction Stop
}

Function Package-Dynamic(${SRC}, ${DEST}) {
	Copy-Item "${SRC}\bin\cbor.dll" "${DEST}"
	Copy-Item "${SRC}\lib\cbor.lib" "${DEST}"
	Copy-Item "${SRC}\bin\zlib1.dll" "${DEST}"
	Copy-Item "${SRC}\lib\zlib1.lib" "${DEST}"
	Copy-Item "${SRC}\bin\crypto-${LibCrypto}.dll" "${DEST}"
	Copy-Item "${SRC}\lib\crypto-${LibCrypto}.lib" "${DEST}"
	Copy-Item "${SRC}\bin\fido2.dll" "${DEST}"
	Copy-Item "${SRC}\lib\fido2.lib" "${DEST}"
}

Function Package-Static(${SRC}, ${DEST}) {
	Copy-Item "${SRC}/lib/cbor.lib" "${DEST}"
	Copy-Item "${SRC}/lib/zlib1.lib" "${DEST}"
	Copy-Item "${SRC}/lib/crypto-${LibCrypto}.lib" "${DEST}"
	Copy-Item "${SRC}/lib/fido2_static.lib" "${DEST}/fido2.lib"
}

Function Package-PDBs(${SRC}, ${DEST}) {
	Copy-Item "${SRC}\${LIBRESSL}\crypto\crypto_obj.dir\${Config}\crypto_obj.pdb" `
	    "${DEST}\crypto-${LibCrypto}.pdb"
	Copy-Item "${SRC}\${LIBCBOR}\src\cbor.dir\${Config}\vc${SDK}.pdb" `
	    "${DEST}\cbor.pdb"
	Copy-Item "${SRC}\${ZLIB}\zlib.dir\${Config}\vc${SDK}.pdb" `
	    "${DEST}\zlib1.pdb"
	Copy-Item "${SRC}\src\fido2_shared.dir\${Config}\vc${SDK}.pdb" `
	    "${DEST}\fido2.pdb"
}

Function Package-StaticPDBs(${SRC}, ${DEST}) {
	Copy-Item "${SRC}\${LIBRESSL}\crypto\crypto_obj.dir\${Config}\crypto_obj.pdb" `
	    "${DEST}\crypto-${LibCrypto}.pdb"
	Copy-Item "${SRC}\${LIBCBOR}\src\${Config}\cbor.pdb" `
	    "${DEST}\cbor.pdb"
	Copy-Item "${SRC}\${ZLIB}\${Config}\zlibstatic.pdb" `
	    "${DEST}\zlib1.pdb"
	Copy-Item "${SRC}\src\${Config}\fido2_static.pdb" `
	    "${DEST}\fido2.pdb"
}

Function Package-Tools(${SRC}, ${DEST}) {
	Copy-Item "${SRC}\tools\${Config}\fido2-assert.exe" `
	    "${DEST}\fido2-assert.exe"
	Copy-Item "${SRC}\tools\${Config}\fido2-cred.exe" `
	    "${DEST}\fido2-cred.exe"
	Copy-Item "${SRC}\tools\${Config}\fido2-token.exe" `
	    "${DEST}\fido2-token.exe"
}

Package-Headers

for ($i = 0; $i -lt $Architectures.Length; $i++) {
	$Arch = $Architectures[$i]
	$InstallPrefix = $InstallPrefixes[$i]
	Package-Dynamic "${OUTPUT}\${Arch}\dynamic" `
	    "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\dynamic"
	Package-PDBs "${BUILD}\${Arch}\dynamic" `
	    "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\dynamic"
	Package-Tools "${BUILD}\${Arch}\dynamic" `
	    "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\dynamic"
	Package-Static "${OUTPUT}\${Arch}\static" `
	    "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\static"
	Package-StaticPDBs "${BUILD}\${Arch}\static" `
	    "${OUTPUT}\pkg\${InstallPrefix}\${Config}\v${SDK}\static"
}