mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
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:
parent
0a313eda1c
commit
df511bf179
@ -19,7 +19,7 @@ source "${tests_repo_dir}/.ci/lib.sh"
|
||||
# fail. So let's ensure they are unset here.
|
||||
unset PREFIX DESTDIR
|
||||
|
||||
arch=$(uname -m)
|
||||
arch=${ARCH:-$(uname -m)}
|
||||
workdir="$(mktemp -d --tmpdir build-libseccomp.XXXXX)"
|
||||
|
||||
# Variables for libseccomp
|
||||
@ -70,7 +70,8 @@ build_and_install_gperf() {
|
||||
curl -sLO "${gperf_tarball_url}"
|
||||
tar -xf "${gperf_tarball}"
|
||||
pushd "gperf-${gperf_version}"
|
||||
./configure --prefix="${gperf_install_dir}"
|
||||
# Unset $CC for configure, we will always use native for gperf
|
||||
CC= ./configure --prefix="${gperf_install_dir}"
|
||||
make
|
||||
make install
|
||||
export PATH=$PATH:"${gperf_install_dir}"/bin
|
||||
@ -84,7 +85,7 @@ build_and_install_libseccomp() {
|
||||
curl -sLO "${libseccomp_tarball_url}"
|
||||
tar -xf "${libseccomp_tarball}"
|
||||
pushd "libseccomp-${libseccomp_version}"
|
||||
./configure --prefix="${libseccomp_install_dir}" CFLAGS="${cflags}" --enable-static
|
||||
./configure --prefix="${libseccomp_install_dir}" CFLAGS="${cflags}" --enable-static --host="${arch}"
|
||||
make
|
||||
make install
|
||||
popd
|
||||
|
11
utils.mk
11
utils.mk
@ -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))))
|
||||
|
Loading…
Reference in New Issue
Block a user