packaging: Enable cross-building agent

Requires setting ARCH and CC.

- Add CC linker option for building agent.
- Set host for building libseccomp.

Fixes: #3681
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Jakob Naucke
2022-02-15 19:12:41 +01:00
parent 0a313eda1c
commit df511bf179
2 changed files with 14 additions and 4 deletions

View File

@@ -113,7 +113,8 @@ endef
BUILD_TYPE = release
##VAR ARCH=arch target to build (format: uname -m)
ARCH = $(shell uname -m)
HOST_ARCH = $(shell uname -m)
ARCH ?= $(HOST_ARCH)
##VAR LIBC=musl|gnu
LIBC ?= musl
ifneq ($(LIBC),musl)
@@ -142,6 +143,14 @@ ifeq ($(ARCH), aarch64)
$(warning "WARNING: aarch64-musl needs extra symbols from libgcc")
endif
ifneq ($(HOST_ARCH),$(ARCH))
ifeq ($(CC),)
CC = gcc
$(warning "WARNING: A foreign ARCH was passed, but no CC alternative. Using gcc.")
endif
override EXTRA_RUSTFLAGS += -C linker=$(CC)
endif
TRIPLE = $(ARCH)-unknown-linux-$(LIBC)
CWD := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))