mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
f30244ee1b
This implements cross-build for "make release", moving the build into a container. This way we can support arm, arm64, ppc, and whatnot. * script/seccomp.sh: separate out of script/release.sh, amend to support cross-compile and save needed environment variables to a file. * Dockerfile: add installing libseccomp from source, as this is needed for release builds. * script/release.sh: amend to support more architectures in addition to the native build. Additional arches can be added by specifying "-a <arch>" argument (can be specified multiple times), or "make RELEASE_ARGS="-a arm64" release" if called via make. All supported architectures can be enabled via "make releaseall". * Makefile: move "release" target to "localrelease", add "release" and "releaseall" targets to build via the Dockerfile. This is done because most distros (including Fedora and openSUSE) lack cross-glibc, which is needed to cross-compile libseccomp. * Makefile: remove 'cross' and 'localcross' targets, as this is now done by the release script. * .github/workflows/validate.yum: amend the release CI job to cross-build for supported architectures, remove cross job. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
37 lines
596 B
Bash
37 lines
596 B
Bash
#!/bin/bash
|
|
|
|
# set_cross_vars sets a few environment variables used for cross-compiling,
|
|
# based on the architecture specified in $1.
|
|
function set_cross_vars() {
|
|
GOARCH="$1" # default, may be overridden below
|
|
unset GOARM
|
|
|
|
case $1 in
|
|
arm64)
|
|
HOST=aarch64-linux-gnu
|
|
;;
|
|
armel)
|
|
HOST=arm-linux-gnueabi
|
|
GOARCH=arm
|
|
GOARM=6
|
|
;;
|
|
armhf)
|
|
HOST=arm-linux-gnueabihf
|
|
GOARCH=arm
|
|
GOARM=7
|
|
;;
|
|
ppc64le)
|
|
HOST=powerpc64le-linux-gnu
|
|
;;
|
|
*)
|
|
echo "set_cross_vars: unsupported architecture: $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
CC=$HOST-gcc
|
|
STRIP=$HOST-strip
|
|
|
|
export HOST GOARM GOARCH CC STRIP
|
|
}
|