diff --git a/.gitignore b/.gitignore index d270f10bcab..282e34ec294 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ vendor/pkg /runc +/runc-* contrib/cmd/recvtty/recvtty man/man8 release diff --git a/.travis.yml b/.travis.yml index 2120f167890..0d1c66c6ef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,4 +32,4 @@ before_install: script: - git-validation -run DCO,short-subject -v - make BUILDTAGS="${BUILDTAGS}" - - make BUILDTAGS="${BUILDTAGS}" clean ci + - make BUILDTAGS="${BUILDTAGS}" clean ci cross diff --git a/Dockerfile b/Dockerfile index 2f14dffbf88..2f153c9e698 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ FROM golang:1.10-stretch -RUN apt-get update && apt-get install -y \ +RUN dpkg --add-architecture armel \ + && dpkg --add-architecture armhf \ + && dpkg --add-architecture arm64 \ + && dpkg --add-architecture ppc64el \ + && apt-get update && apt-get install -y \ build-essential \ curl \ sudo \ @@ -21,6 +25,8 @@ RUN apt-get update && apt-get install -y \ python-minimal \ uidmap \ kmod \ + crossbuild-essential-armel crossbuild-essential-armhf crossbuild-essential-arm64 crossbuild-essential-ppc64el \ + libseccomp-dev:armel libseccomp-dev:armhf libseccomp-dev:arm64 libseccomp-dev:ppc64el \ --no-install-recommends \ && apt-get clean diff --git a/Makefile b/Makefile index 36d5065be47..96b9023264c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .PHONY: all shell dbuild man release \ localtest localunittest localintegration \ - test unittest integration + test unittest integration \ + cross localcross GO := go @@ -105,7 +106,7 @@ uninstall-man: rm -f $(addprefix $(MAN_INSTALL_PATH),$(MAN_PAGES_BASE)) clean: - rm -f runc + rm -f runc runc-* rm -f contrib/cmd/recvtty/recvtty rm -rf $(RELEASE_DIR) rm -rf $(MAN_DIR) @@ -117,6 +118,15 @@ validate: ci: validate test release +cross: runcimage + docker run -e BUILDTAGS="$(BUILDTAGS)" --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_IMAGE) make localcross + +localcross: + CGO_ENABLED=1 GOARCH=arm GOARM=6 CC=arm-linux-gnueabi-gcc $(GO) build -buildmode=pie $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o runc-armel . + CGO_ENABLED=1 GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc $(GO) build -buildmode=pie $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o runc-armhf . + CGO_ENABLED=1 GOARCH=arm64 CC=aarch64-linux-gnu-gcc $(GO) build -buildmode=pie $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o runc-arm64 . + CGO_ENABLED=1 GOARCH=ppc64le CC=powerpc64le-linux-gnu-gcc $(GO) build -buildmode=pie $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o runc-ppc64le . + # memoize allpackages, so that it's executed only once and only if used _allpackages = $(shell $(GO) list ./... | grep -v vendor) allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)