mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-02 13:44:33 +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.
|
# fail. So let's ensure they are unset here.
|
||||||
unset PREFIX DESTDIR
|
unset PREFIX DESTDIR
|
||||||
|
|
||||||
arch=$(uname -m)
|
arch=${ARCH:-$(uname -m)}
|
||||||
workdir="$(mktemp -d --tmpdir build-libseccomp.XXXXX)"
|
workdir="$(mktemp -d --tmpdir build-libseccomp.XXXXX)"
|
||||||
|
|
||||||
# Variables for libseccomp
|
# Variables for libseccomp
|
||||||
@ -70,7 +70,8 @@ build_and_install_gperf() {
|
|||||||
curl -sLO "${gperf_tarball_url}"
|
curl -sLO "${gperf_tarball_url}"
|
||||||
tar -xf "${gperf_tarball}"
|
tar -xf "${gperf_tarball}"
|
||||||
pushd "gperf-${gperf_version}"
|
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
|
||||||
make install
|
make install
|
||||||
export PATH=$PATH:"${gperf_install_dir}"/bin
|
export PATH=$PATH:"${gperf_install_dir}"/bin
|
||||||
@ -84,7 +85,7 @@ build_and_install_libseccomp() {
|
|||||||
curl -sLO "${libseccomp_tarball_url}"
|
curl -sLO "${libseccomp_tarball_url}"
|
||||||
tar -xf "${libseccomp_tarball}"
|
tar -xf "${libseccomp_tarball}"
|
||||||
pushd "libseccomp-${libseccomp_version}"
|
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
|
||||||
make install
|
make install
|
||||||
popd
|
popd
|
||||||
|
11
utils.mk
11
utils.mk
@ -113,7 +113,8 @@ endef
|
|||||||
BUILD_TYPE = release
|
BUILD_TYPE = release
|
||||||
|
|
||||||
##VAR ARCH=arch target to build (format: uname -m)
|
##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
|
##VAR LIBC=musl|gnu
|
||||||
LIBC ?= musl
|
LIBC ?= musl
|
||||||
ifneq ($(LIBC),musl)
|
ifneq ($(LIBC),musl)
|
||||||
@ -142,6 +143,14 @@ ifeq ($(ARCH), aarch64)
|
|||||||
$(warning "WARNING: aarch64-musl needs extra symbols from libgcc")
|
$(warning "WARNING: aarch64-musl needs extra symbols from libgcc")
|
||||||
endif
|
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)
|
TRIPLE = $(ARCH)-unknown-linux-$(LIBC)
|
||||||
|
|
||||||
CWD := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
CWD := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
|
Loading…
Reference in New Issue
Block a user