heads/modules/tpm2-tools
Thierry Laurion 43d806f205
modules/tpm2-tools: add with-sysroot, TSS2_ESYS_3_0_LIBS to configure args
Thanks to @JonathonHall-Purism, that pointed to me that sysroot was
neglected in tpm2-tools configure step.

I wonder why this is not respected if not forced with --with-sysroot and
TSS2_ESYS_3_0_LIBS="-ltss2-esys -L$(INSTALL)/lib"?

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2024-05-02 13:00:46 -04:00

47 lines
1.8 KiB
Makefile

# TPM2 tools program
modules-$(CONFIG_TPM2_TOOLS) += tpm2-tools
# CONFIG_TPM means any TPM version. (CONFIG_TPM2_TOOLS differentiates them when
# they must be handled differently, which should be localized.) Boards setting
# CONFIG_TPM2_TOOLS=y imply CONFIG_TPM=y.
ifeq "$(CONFIG_TPM2_TOOLS)" "y"
export CONFIG_TPM=y
endif
tpm2-tools_version := 5.6
tpm2-tools_dir := tpm2-tools-$(tpm2-tools_version)
tpm2-tools_tar := tpm2-tools-$(tpm2-tools_version).tar.gz
tpm2-tools_url := https://github.com/tpm2-software/tpm2-tools/releases/download/$(tpm2-tools_version)/$(tpm2-tools_tar)
tpm2-tools_hash := 52c8bcbaadca082abfe5eb7ee4967d2d632d84b1677675f2f071b6d2ec22cec3
#tpm2-tools 5.6 adds release version based on git, while tarball downloaded doesn't include any .git
# the patch comments out git output to ./VERSION, and we fill it here based on this Makefile's version
#tpm2-tools doesn't play nice with reproducible builds, hardcoding lib paths without providing a configure option to remove rpaths
# We make sure no hardcoding of libdir flags exist in configure script prior of calling the script with sed call
# We pass additional remapping of prefix-map from $INSTALL to local dir
#
# TODO: remove all patches and uniformize with similar sed calls.
tpm2-tools_configure := \
echo "$(tpm2-tools_version)" > ./VERSION \
&& ./bootstrap \
&& sed -i 's/hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=" "/' configure \
&& ./configure \
$(CROSS_TOOLS) \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
--disable-fapi \
CFLAGS="-fdebug-prefix-map=$(INSTALL)=." \
--with-sysroot=$(INSTALL) \
TSS2_ESYS_3_0_CFLAGS="-I$(INSTALL)/include" \
TSS2_ESYS_3_0_LIBS="-ltss2-esys -L$(INSTALL)/lib" \
tpm2-tools_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \
tpm2-tools_output := tools/tpm2
tpm2-tools_depends := openssl tpm2-tss $(musl_dep)