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