1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-09 08:57:25 +00:00
kata-containers/tools/packaging/static-build/agent/build-static-agent.sh
Fabiano Fidêncio 5b0d0687e5
packaging: agent: Allow building in all arches
We're moving away from alpine and using ubuntu in order to be able to
build the agent for all the architectures we need.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-25 19:41:32 +01:00

57 lines
997 B
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright (c) 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${script_dir}/../../scripts/lib.sh"
init_env() {
source "$HOME/.cargo/env"
ARCH=$(uname -m)
rust_arch=""
case ${ARCH} in
"aarch64")
export LIBC=musl
rust_arch=${ARCH}
;;
"ppc64le")
export LIBC=gnu
rust_arch="powerpc64le"
;;
"x86_64")
export LIBC=musl
rust_arch=${ARCH}
;;
"s390x")
export LIBC=gnu
rust_arch=${ARCH}
;;
esac
rustup target add ${rust_arch}-unknown-linux-${LIBC}
export LIBSECCOMP_LINK_TYPE=static
export LIBSECCOMP_LIB_PATH=/usr/lib
}
build_agent_from_source() {
echo "build agent from source"
init_env
/usr/bin/install_libseccomp.sh /usr /usr
cd src/agent
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make install
}
build_agent_from_source $@