summaryrefslogtreecommitdiffstats
path: root/recipes-extended/xen/tpm-emulator.inc
blob: f58a276392cbca6bbcbbb5299ad82eef2bb88976 (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
# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com>
# Released under the MIT license (see COPYING.MIT for the terms)

require stubdom.inc

DEPENDS += "\
    cmake-native \
    newlib \
    stubdom-gmp \
"

# nothing to configure
do_configure[noexec] = "1"

export CMAKE_C_FLAGS = "\
    -std=c99 \
    -DTPM_NO_EXTERN \
    ${STUBDOM_CPPFLAGS} \
    ${STUBDOM_CFLAGS} \
    -Wno-declaration-after-statement \
    -Wno-implicit-fallthrough \
"

do_compile() {
    CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" cmake .. -DCMAKE_C_FLAGS:STRING="${CMAKE_C_FLAGS}"
    ${MAKE} VERBOSE=1 tpm_crypto tpm
}

do_install() {
    install -d ${D}/${libdir}
    install -m 644 -t ${D}/${libdir} ${B}/crypto/libtpm_crypto.a
    install -m 644 -t ${D}/${libdir} ${B}/tpm/libtpm.a

    install -D -m 644 -t ${D}/${includedir}/tpm-emulator/build ${S}/build/config.h
    install -D -m 644 -t ${D}/${includedir}/tpm-emulator/crypto ${S}/crypto/*.h
    install -D -m 644 -t ${D}/${includedir}/tpm-emulator/tpm ${S}/tpm/*.h
}