diff --git a/env/linux-s390x-stretch/Dockerfile b/env/linux-s390x-stretch/Dockerfile new file mode 100644 index 0000000000..a4cab7efb1 --- /dev/null +++ b/env/linux-s390x-stretch/Dockerfile @@ -0,0 +1,65 @@ +# Copyright 2016 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# Linux builder VM running Debian stretch (i.e. Debian testing) +# Docker tag gobuilders/linux-s390x-stretch + +FROM debian:stretch +MAINTAINER golang-dev + +ENV DEBIAN_FRONTEND noninteractive + +# curl: for getting and unpacking Go 1.4 source +# git-core: for interacting with the Go source & subrepos +# gcc, libc-dev: for building Go's bootstrap 'dist' prog +# gcc-s390x-linux-gnu, libc6-dev-s390x-cross: for s390x builds +# systemd: for init when image is used with docker2boot +# net-tools, ifupdown, isc-dhcp-client: required for networking in a VM on GCE +# procps, lsof, psmisc: misc tools +RUN apt-get update && apt-get install -y \ + bzip2 \ + ca-certificates \ + curl \ + git-core \ + gcc \ + libc6-dev \ + gcc-s390x-linux-gnu \ + libc6-dev-s390x-cross \ + systemd \ + net-tools \ + ifupdown \ + isc-dhcp-client \ + procps \ + lsof \ + psmisc \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /go1.4-amd64 \ + && ( \ + curl --silent https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /go1.4-amd64 -zxv \ + ) \ + && mv /go1.4-amd64/go /go1.4 \ + && rm -rf /go1.4-amd64 \ + && rm -rf /go1.4/pkg/linux_amd64_race \ + /go1.4/api \ + /go1.4/blog \ + /go1.4/doc \ + /go1.4/misc \ + /go1.4/test \ + && find /go1.4 -type d -name testdata | xargs rm -rf + +RUN curl -o /usr/local/bin/stage0 https://storage.googleapis.com/go-builder-data/stage0.linux-amd64.92ebb4ec \ + && chmod +x /usr/local/bin/stage0 + +COPY buildlet.service /etc/systemd/system/buildlet.service +RUN systemctl enable /etc/systemd/system/buildlet.service + +RUN rm -f /lib/systemd/system/multi-user.target.wants/systemd-logind.service +RUN (echo "[Journal]"; echo "ForwardToConsole=yes") > /etc/systemd/journald.conf + +RUN (echo "auto lo"; echo "iface lo inet loopback"; echo "auto eth0"; echo "iface eth0 inet dhcp") > /etc/network/interfaces + +ENV GOROOT_BOOTSTRAP=/go1.4 GOOS=linux GOARCH=s390x CC_FOR_TARGET=s390x-linux-gnu-gcc +COPY build-release.sh /usr/bin/ diff --git a/env/linux-s390x-stretch/Makefile b/env/linux-s390x-stretch/Makefile new file mode 100644 index 0000000000..4f9a354b90 --- /dev/null +++ b/env/linux-s390x-stretch/Makefile @@ -0,0 +1,6 @@ +# Copyright 2016 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +docker: Dockerfile + docker build --rm --force-rm -t gobuilders/linux-s390x-stretch . diff --git a/env/linux-s390x-stretch/README b/env/linux-s390x-stretch/README new file mode 100644 index 0000000000..3bcf51f439 --- /dev/null +++ b/env/linux-s390x-stretch/README @@ -0,0 +1,10 @@ +The docker image created from this directory can be used to cross compile go +from linux/amd64 to linux/s390x. + +How to use: + +$ docker run --rm -it -v $(pwd)/artifacts:/artifacts \ + gobuilders/linux-s390x-stretch build-release.sh $GIT_REV + +This will make the built go artifact, go-${GIT_REV}-linux-s390x.tar.gz, +available in the directory you mounted as `/artifacts` in the container. diff --git a/env/linux-s390x-stretch/build-release.sh b/env/linux-s390x-stretch/build-release.sh new file mode 100755 index 0000000000..2b5b849821 --- /dev/null +++ b/env/linux-s390x-stretch/build-release.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 2016 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. +set -e + +GIT_REV=$1 +if [[ -z "$GIT_REV" ]]; then + GIT_REV=master +fi + +# fetch the source +git clone https://go.googlesource.com/go /usr/src/go +( +cd /usr/src/go +# checkout the specific revision +git checkout "$GIT_REV" + +cd /usr/src/go/src +# build +./bootstrap.bash + +cd / +mv /usr/src/go-${GOOS}-${GOARCH}-bootstrap /go +mkdir -p /artifacts +# tarball the artifact +tar -czvf /artifacts/go-${GIT_REV}-${GOOS}-${GOARCH}.tar.gz /go +) diff --git a/env/linux-s390x-stretch/buildlet.service b/env/linux-s390x-stretch/buildlet.service new file mode 100644 index 0000000000..4334bc78ed --- /dev/null +++ b/env/linux-s390x-stretch/buildlet.service @@ -0,0 +1,8 @@ +[Unit] +Description=Buildlet + +[Service] +ExecStart=/usr/local/bin/stage0 + +[Install] +WantedBy=multi-user.target