ci: combine cross compile container definitions

The cross compile container definitions for each architecture were
almost the same files except for the architecture.

This moves the architecture to variables so that all cross compile
setups can use the same container definition.

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2021-07-05 08:10:12 +00:00 committed by Andrei Vagin
parent 2ebb1c7419
commit 0ca36c95ee
15 changed files with 77 additions and 195 deletions

1
.gitignore vendored
View file

@ -42,4 +42,3 @@ lib/.crit-setup.files
compel/include/asm
include/common/asm
include/common/config.h
build/

View file

@ -1,47 +0,0 @@
FROM dockcross/base:latest
COPY scripts/ci/apt-install /bin/apt-install
# Add the cross compiler sources
RUN echo "deb http://ftp.us.debian.org/debian/ buster main" >> /etc/apt/sources.list && \
dpkg --add-architecture arm64 && \
apt-install emdebian-archive-keyring
RUN apt-install \
crossbuild-essential-arm64 \
libc6-dev-arm64-cross \
libc6-arm64-cross \
libbz2-dev:arm64 \
libexpat1-dev:arm64 \
ncurses-dev:arm64 \
libssl-dev:arm64 \
protobuf-c-compiler \
protobuf-compiler \
python3-protobuf \
libnl-3-dev:arm64 \
libprotobuf-dev:arm64 \
libnet-dev:arm64 \
libprotobuf-c-dev:arm64 \
libcap-dev:arm64 \
libaio-dev:arm64 \
libnl-route-3-dev:arm64
ENV CROSS_TRIPLE=aarch64-linux-gnu
ENV CROSS_COMPILE=${CROSS_TRIPLE}- \
CROSS_ROOT=/usr/${CROSS_TRIPLE} \
AS=/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/bin/${CROSS_TRIPLE}-ar \
CC=/usr/bin/${CROSS_TRIPLE}-gcc \
CPP=/usr/bin/${CROSS_TRIPLE}-cpp \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld \
FC=/usr/bin/${CROSS_TRIPLE}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLE}/pkgconfig \
ARCH=aarch64
COPY . /criu
WORKDIR /criu
RUN make mrproper && date && make -j $(nproc) zdtm && date

View file

@ -0,0 +1,5 @@
FROM docker.io/dockcross/base:latest
ENV ARCH=aarch64
ENV DEBIAN_ARCH=arm64
ENV CROSS_TRIPLET=aarch64-linux-gnu

View file

@ -0,0 +1 @@
Dockerfile.cross.tmpl

View file

@ -1,46 +0,0 @@
FROM dockcross/base:latest
COPY scripts/ci/apt-install /bin/apt-install
# Add the cross compiler sources
RUN echo "deb http://ftp.us.debian.org/debian/ buster main" >> /etc/apt/sources.list && \
dpkg --add-architecture armhf && \
apt-install emdebian-archive-keyring
RUN apt-install \
crossbuild-essential-armhf \
libbz2-dev:armhf \
libexpat1-dev:armhf \
ncurses-dev:armhf \
libssl-dev:armhf \
protobuf-c-compiler \
protobuf-compiler \
python3-protobuf \
libnl-3-dev:armhf \
libprotobuf-dev:armhf \
libnet-dev:armhf \
libprotobuf-c-dev:armhf \
libcap-dev:armhf \
libaio-dev:armhf \
libnl-route-3-dev:armhf
ENV CROSS_TRIPLE=arm-linux-gnueabihf
ENV CROSS_COMPILE=${CROSS_TRIPLE}- \
CROSS_ROOT=/usr/${CROSS_TRIPLE} \
AS=/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/bin/${CROSS_TRIPLE}-ar \
CC=/usr/bin/${CROSS_TRIPLE}-gcc \
CPP=/usr/bin/${CROSS_TRIPLE}-cpp \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld \
FC=/usr/bin/${CROSS_TRIPLE}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLE}/pkgconfig \
ARCH=arm \
SUBARCH=armv7
COPY . /criu
WORKDIR /criu
RUN make mrproper && date && make -j $(nproc) zdtm && date

View file

@ -0,0 +1,6 @@
FROM docker.io/dockcross/base:latest
ENV ARCH=arm
ENV SUBARCH=armv7
ENV DEBIAN_ARCH=armhf
ENV CROSS_TRIPLET=arm-linux-gnueabihf

View file

@ -0,0 +1 @@
Dockerfile.cross.tmpl

View file

@ -0,0 +1,43 @@
COPY scripts/ci/apt-install /bin/apt-install
# Add the cross compiler sources
RUN echo "deb http://deb.debian.org/debian/ buster main" >> /etc/apt/sources.list && \
dpkg --add-architecture ${DEBIAN_ARCH} && \
apt-install emdebian-archive-keyring
RUN apt-install \
crossbuild-essential-${DEBIAN_ARCH} \
libc6-dev-${DEBIAN_ARCH}-cross \
libc6-${DEBIAN_ARCH}-cross \
libbz2-dev:${DEBIAN_ARCH} \
libexpat1-dev:${DEBIAN_ARCH} \
ncurses-dev:${DEBIAN_ARCH} \
libssl-dev:${DEBIAN_ARCH} \
protobuf-c-compiler \
protobuf-compiler \
python3-protobuf \
libnl-3-dev:${DEBIAN_ARCH} \
libprotobuf-dev:${DEBIAN_ARCH} \
libnet-dev:${DEBIAN_ARCH} \
libprotobuf-c-dev:${DEBIAN_ARCH} \
libcap-dev:${DEBIAN_ARCH} \
libaio-dev:${DEBIAN_ARCH} \
libnl-route-3-dev:${DEBIAN_ARCH}
ENV CROSS_COMPILE=${CROSS_TRIPLET}- \
CROSS_ROOT=/usr/${CROSS_TRIPLET} \
AS=/usr/bin/${CROSS_TRIPLET}-as \
AR=/usr/bin/${CROSS_TRIPLET}-ar \
CC=/usr/bin/${CROSS_TRIPLET}-gcc \
CPP=/usr/bin/${CROSS_TRIPLET}-cpp \
CXX=/usr/bin/${CROSS_TRIPLET}-g++ \
LD=/usr/bin/${CROSS_TRIPLET}-ld \
FC=/usr/bin/${CROSS_TRIPLET}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig
COPY . /criu
WORKDIR /criu
RUN make mrproper && date && make -j $(nproc) zdtm && date

View file

@ -1,46 +0,0 @@
FROM dockcross/base:latest
COPY scripts/ci/apt-install /bin/apt-install
# Add the cross compiler sources
RUN echo "deb http://ftp.us.debian.org/debian/ buster main" >> /etc/apt/sources.list && \
dpkg --add-architecture mips64el && \
apt-install emdebian-archive-keyring
RUN apt-install \
crossbuild-essential-mips64el \
libbz2-dev:mips64el \
libexpat1-dev:mips64el \
ncurses-dev:mips64el \
libssl-dev:mips64el \
protobuf-c-compiler \
protobuf-compiler \
python3-protobuf \
libnl-3-dev:mips64el \
libprotobuf-dev:mips64el \
libnet-dev:mips64el \
libprotobuf-c-dev:mips64el \
libcap-dev:mips64el \
libaio-dev:mips64el \
libnl-route-3-dev:mips64el
ENV CROSS_TRIPLE=mips64el-linux-gnuabi64
ENV CROSS_COMPILE=${CROSS_TRIPLE}- \
CROSS_ROOT=/usr/${CROSS_TRIPLE} \
AS=/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/bin/${CROSS_TRIPLE}-ar \
CC=/usr/bin/${CROSS_TRIPLE}-gcc \
CPP=/usr/bin/${CROSS_TRIPLE}-cpp \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld \
FC=/usr/bin/${CROSS_TRIPLE}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLE}/pkgconfig \
ARCH=mips \
SUBARCH=mips
COPY . /criu
WORKDIR /criu
RUN make mrproper && date && make -j $(nproc) zdtm && date

View file

@ -0,0 +1,6 @@
FROM dockcross/base:latest
ENV ARCH=mips
ENV SUBARCH=mips
ENV DEBIAN_ARCH=mips64el
ENV CROSS_TRIPLET=mips64el-linux-gnuabi64

View file

@ -0,0 +1 @@
Dockerfile.cross.tmpl

View file

@ -1,47 +0,0 @@
FROM dockcross/base:latest
COPY scripts/ci/apt-install /bin/apt-install
# Add the cross compiler sources
RUN echo "deb http://ftp.us.debian.org/debian/ buster main" >> /etc/apt/sources.list && \
dpkg --add-architecture ppc64el && \
apt-install emdebian-archive-keyring
RUN apt-install \
crossbuild-essential-ppc64el \
libc6-dev-ppc64el-cross \
libc6-ppc64el-cross \
libbz2-dev:ppc64el \
libexpat1-dev:ppc64el \
ncurses-dev:ppc64el \
libssl-dev:ppc64el \
protobuf-c-compiler \
protobuf-compiler \
python3-protobuf \
libnl-3-dev:ppc64el \
libprotobuf-dev:ppc64el \
libnet-dev:ppc64el \
libprotobuf-c-dev:ppc64el \
libcap-dev:ppc64el \
libaio-dev:ppc64el \
libnl-route-3-dev:ppc64el
ENV CROSS_TRIPLE=powerpc64le-linux-gnu
ENV CROSS_COMPILE=${CROSS_TRIPLE}- \
CROSS_ROOT=/usr/${CROSS_TRIPLE} \
AS=/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/bin/${CROSS_TRIPLE}-ar \
CC=/usr/bin/${CROSS_TRIPLE}-gcc \
CPP=/usr/bin/${CROSS_TRIPLE}-cpp \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld \
FC=/usr/bin/${CROSS_TRIPLE}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLE}/pkgconfig \
ARCH=ppc64
COPY . /criu
WORKDIR /criu
RUN make mrproper && date && make -j $(nproc) zdtm && date

View file

@ -0,0 +1,5 @@
FROM dockcross/base:latest
ENV ARCH=ppc64
ENV DEBIAN_ARCH=ppc64el
ENV CROSS_TRIPLET=powerpc64le-linux-gnu

View file

@ -0,0 +1 @@
Dockerfile.cross.tmpl

View file

@ -1,26 +1,26 @@
ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8
NON_CLANG := armv7-cross aarch64-cross ppc64-cross mips64el-cross
CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG)
TARGETS := $(ARCHES) alpine
TARGETS_CLANG := $(addsuffix $(TARGETS),-clang)
CONTAINER_RUNTIME := docker
CONTAINER_TARGETS := $(TARGETS) $(NON_CLANG)
TARGETS += armv7-cross aarch64-cross ppc64-cross mips64el-cross
all: $(TARGETS) $(TARGETS_CLANG)
all: $(CONTAINER_TARGETS) $(TARGETS_CLANG)
.PHONY: all
# A build for each architecture requires appropriate Dockerfile
define ARCH_DEP
define FILE_DEP
$(1): Dockerfile.$(1)
endef
$(foreach arch,$(ARCHES),$(eval $(call ARCH_DEP,$(arch))))
$(foreach file,$(CREATE_DOCKERFILES),$(eval $(call FILE_DEP,$(file))))
Dockerfile.%: Dockerfile.%.hdr Dockerfile.%.tmpl
cat $^ > $@
$(TARGETS):
$(CONTAINER_TARGETS):
$(CONTAINER_RUNTIME) build -t criu-$@ -f Dockerfile.$@ $(DB_CC) ../..
.PHONY: $(TARGETS)
.PHONY: $(CONTAINER_TARGETS)
# Clang builds add some Docker build env
define CLANG_DEP