util/futility: Check for pkg-config and libcrypto

When building a configuration that requires futility (e.g. Chrome OS
builds), pkg-config and libcrypto are required. Since vboot's build
system isn't the most helpful about it, test ourselves and fail out
with some actionable message.

Tested:
 - configs that don't need futility don't test for pkg-config, so it's
   not required for them.
 - failing pkg-config test leads to the message
 - working pkg-config test leads to a successful build

Fixes https://ticket.coreboot.org/issues/242

Change-Id: I103ce5115284352e0a3a7fdcf8b427f56ce15ba7
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42881
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Patrick Georgi 2020-06-29 21:10:44 +02:00
parent c6dd4435d2
commit 8edfddcb54
1 changed files with 9 additions and 2 deletions

View File

@ -2,15 +2,22 @@ additional-dirs += $(objutil)/futility
VBOOT_FUTILITY = $(VBOOT_HOST_BUILD)/futility/futility
$(VBOOT_FUTILITY):
HOSTPKGCONFIG ?= pkg-config
$(VBOOT_FUTILITY): check-openssl-presence
@printf " MAKE $(subst $(objutil)/,,$(@))\n"
unset CFLAGS LDFLAGS; $(MAKE) -C $(VBOOT_SOURCE) \
BUILD=$(VBOOT_HOST_BUILD) \
CC="$(HOSTCC)" \
$(if $(HOSTPKGCONFIG), PKG_CONFIG="$(HOSTPKGCONFIG)") \
PKG_CONFIG="$(HOSTPKGCONFIG)" \
V=$(V) \
$@
.PHONY: check-openssl-presence
check-openssl-presence:
$(HOSTPKGCONFIG) --exists libcrypto || \
(echo "Error: Ensure that pkg-config and openssl's libcrypto, including header files, are installed."; exit 1)
$(objutil)/futility/futility: $(VBOOT_FUTILITY)
mkdir -p $(dir $@)
cp $< $@.tmp