diff --git a/Makefile.common b/Makefile.common index e1881b62..1d6d9442 100644 --- a/Makefile.common +++ b/Makefile.common @@ -60,7 +60,7 @@ HOSTCFLAGS := -fstack-protector-strong -Wall -Werror -std=c11 -O2 -g HOSTCPPFLAGS := -I$(TOPDIR)/include HOSTLDFLAGS := HOSTLDLIBS := -HOSTAR := ar +HOSTAR := $(CONFIG_HOST_AR) define HOSTCOMPILE.c @echo "HOSTCC $@" diff --git a/configure.sh b/configure.sh index c38617b8..6d46c278 100755 --- a/configure.sh +++ b/configure.sh @@ -57,7 +57,12 @@ Options: Environment variables affecting the build system configuration: HOST_CC - C compiler used for host tools and tenders. + HOST_AR + C compiler and ar tool used for host tools and tenders. + + HOST_PKG_CONFIG + pkg-config executable to query for information on libraries needed to + build host tools and tenders. TARGET_CC TARGET_LD @@ -247,6 +252,8 @@ done # # Configure host tools and tenders based on HOST_CC. # +HOST_AR=${HOST_AR:-ar} + HOST_CC=${HOST_CC:-cc} HOST_CC_MACHINE=$(${HOST_CC} -dumpmachine) [ $? -ne 0 ] && @@ -281,6 +288,8 @@ case ${HOST_CC_MACHINE} in ;; esac +HOST_PKG_CONFIG=${HOST_PKG_CONFIG:-pkg-config} + CONFIG_SPT_TENDER_NO_PIE= CONFIG_SPT_TENDER_LIBSECCOMP_CFLAGS= CONFIG_SPT_TENDER_LIBSECCOMP_LDFLAGS= @@ -295,24 +304,24 @@ if [ -n "${CONFIG_SPT_TENDER}" ]; then CONFIG_SPT_TENDER_NO_PIE=1 fi - if ! command -v pkg-config >/dev/null; then - die "pkg-config is required" + if ! command -v $HOST_PKG_CONFIG >/dev/null; then + die "pkg-config is required: $HOST_PKG_CONFIG not in PATH" fi - if ! pkg-config libseccomp; then + if ! $HOST_PKG_CONFIG libseccomp; then die "libseccomp development headers are required" else - if ! pkg-config --atleast-version=2.3.3 libseccomp; then + if ! $HOST_PKG_CONFIG --atleast-version=2.3.3 libseccomp; then # TODO Make this a hard error once there are no distros with # libseccomp < 2.3.3 in the various CIs. warn "libseccomp >= 2.3.3 is required" \ "for correct spt tender operation" warn "Proceeding anyway, expect tests to fail" - elif ! pkg-config --atleast-version=2.4.1 libseccomp; then + elif ! $HOST_PKG_CONFIG --atleast-version=2.4.1 libseccomp; then warn "libseccomp < 2.4.1 has known vulnerabilities" warn "Proceeding anyway, but consider upgrading" fi - CONFIG_SPT_TENDER_LIBSECCOMP_CFLAGS="$(pkg-config --cflags libseccomp)" - CONFIG_SPT_TENDER_LIBSECCOMP_LDLIBS="$(pkg-config --libs libseccomp)" + CONFIG_SPT_TENDER_LIBSECCOMP_CFLAGS="$($HOST_PKG_CONFIG --cflags libseccomp)" + CONFIG_SPT_TENDER_LIBSECCOMP_LDLIBS="$($HOST_PKG_CONFIG --libs libseccomp)" fi if ! CC="${HOST_CC}" PKG_CFLAGS="${CONFIG_SPT_TENDER_LIBSECCOMP_CFLAGS}" \ cc_check_header seccomp.h; then @@ -342,6 +351,7 @@ CONFIG_DISABLE_TOOLCHAIN=1 CONFIG_HOST_ARCH=${CONFIG_HOST_ARCH} CONFIG_HOST=${CONFIG_HOST} CONFIG_HOST_CC=${HOST_CC} +CONFIG_HOST_AR=${HOST_AR} CONFIG_HVT_TENDER_ENABLE_CAPSICUM=${CONFIG_HVT_TENDER_ENABLE_CAPSICUM} CONFIG_HVT_TENDER=${CONFIG_HVT_TENDER} CONFIG_SPT_TENDER=${CONFIG_SPT_TENDER} @@ -520,6 +530,7 @@ CONFIG_PREFIX=${OPT_PREFIX} CONFIG_HOST_ARCH=${CONFIG_HOST_ARCH} CONFIG_HOST=${CONFIG_HOST} CONFIG_HOST_CC=${HOST_CC} +CONFIG_HOST_AR=${HOST_AR} CONFIG_HVT=${CONFIG_HVT} CONFIG_HVT_TENDER_ENABLE_CAPSICUM=${CONFIG_HVT_TENDER_ENABLE_CAPSICUM} CONFIG_HVT_TENDER=${CONFIG_HVT_TENDER}