Skip to content

Commit

Permalink
Updated Go to version 1.5.1
Browse files Browse the repository at this point in the history
Because the toolchain bootstraping process changed in Go 1.5,
this change imports the "pure bootstraper" from the
https://github.com/karalabe/xgo project.

There's also Go 1.5 bug that required adding the `ldflags=-s` flag
for OS X: golang/go#11994
  • Loading branch information
Tudor Golubenco committed Sep 25, 2015
1 parent c23edbd commit c9b6975
Show file tree
Hide file tree
Showing 16 changed files with 116 additions and 61 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.swp
*.swo
/build/
/env/
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ go:
script:
- make pull-images
# uncomment to build fresh images
# - docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
# - make images
# - make push-images
#- docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
#- make images
#- make push-images
- make deps
- make

Expand Down
5 changes: 5 additions & 0 deletions docker/xgo-image-deb6/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ ADD bootstrap.sh /bootstrap.sh
ENV BOOTSTRAP /bootstrap.sh
RUN chmod +x $BOOTSTRAP

# Inject the new Go root distribution downloader and secondary bootstrapper
ADD bootstrap_pure.sh /bootstrap_pure.sh
ENV BOOTSTRAP_PURE /bootstrap_pure.sh
RUN chmod +x $BOOTSTRAP_PURE

# Inject the C dependency cross compiler
ADD build_deps.sh /build_deps.sh
ENV BUILD_DEPS /build_deps.sh
Expand Down
26 changes: 26 additions & 0 deletions docker/xgo-image-deb6/base/bootstrap_pure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Contains the Go tool-chain pure-Go bootstrapper, that as of Go 1.5, initiates
# not only a few pre-built Go cross compilers, but rather bootstraps all of the
# supported platforms from the origin Linux amd64 distribution.
#
# Usage: bootstrap.sh
#
# Needed environment variables:
# FETCH - Remote file fetcher and checksum verifier (injected by image)
# ROOT_DIST - 64 bit Linux Go binary distribution package
# ROOT_DIST_SHA1 - 64 bit Linux Go distribution package checksum
set -e

# Download, verify and install the root distribution
$FETCH $ROOT_DIST $ROOT_DIST_SHA1

tar -C /usr/local -xzf `basename $ROOT_DIST`
rm -f `basename $ROOT_DIST`

export GOROOT=/usr/local/go
export GOROOT_BOOTSTRAP=$GOROOT

# Pre-build all guest distributions based on the root distribution
echo "Bootstrapping linux/386..."
GOOS=linux GOARCH=386 CGO_ENABLED=1 go install std
2 changes: 1 addition & 1 deletion docker/xgo-image-deb6/beats-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tudorg/xgo-deb6-1.4.2
FROM tudorg/xgo-deb6-1.5.1

MAINTAINER Tudor Golubenco <tudor@elastic.co>

Expand Down
2 changes: 1 addition & 1 deletion docker/xgo-image-deb6/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

docker build --rm=true -t tudorg/xgo-deb6-base base/ && \
docker build --rm=true -t tudorg/xgo-deb6-1.4.2 go-1.4.2/ &&
docker build --rm=true -t tudorg/xgo-deb6-1.5.1 go-1.5.1/ &&
docker build --rm=true -t tudorg/beats-builder-deb6 beats-builder
18 changes: 0 additions & 18 deletions docker/xgo-image-deb6/go-1.4.2/Dockerfile

This file was deleted.

15 changes: 15 additions & 0 deletions docker/xgo-image-deb6/go-1.5.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Go cross compiler (xgo): Go 1.5.1 layer
# Copyright (c) 2014 Péter Szilágyi. All rights reserved.
#
# Released under the MIT license.

FROM tudorg/xgo-deb6-base

MAINTAINER Tudor Golubenco <tudor@elastic.co>

# Configure the root Go distribution and bootstrap based on it
RUN \
export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz && \
export ROOT_DIST_SHA1=46eecd290d8803887dec718c691cc243f2175fe0 && \
\
$BOOTSTRAP_PURE
5 changes: 5 additions & 0 deletions docker/xgo-image/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ ADD bootstrap.sh /bootstrap.sh
ENV BOOTSTRAP /bootstrap.sh
RUN chmod +x $BOOTSTRAP

# Inject the new Go root distribution downloader and secondary bootstrapper
ADD bootstrap_pure.sh /bootstrap_pure.sh
ENV BOOTSTRAP_PURE /bootstrap_pure.sh
RUN chmod +x $BOOTSTRAP_PURE

# Inject the C dependency cross compiler
ADD build_deps.sh /build_deps.sh
ENV BUILD_DEPS /build_deps.sh
Expand Down
2 changes: 0 additions & 2 deletions docker/xgo-image/base/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ set -e
# Download and verify all the binary packages
$FETCH $DIST_LINUX_64 $DIST_LINUX_64_SHA1
$FETCH $DIST_LINUX_32 $DIST_LINUX_32_SHA1
$FETCH $DIST_LINUX_ARM $DIST_LINUX_ARM_SHA1
$FETCH $DIST_OSX_64 $DIST_OSX_64_SHA1
$FETCH $DIST_OSX_32 $DIST_OSX_32_SHA1
$FETCH $DIST_WIN_64 $DIST_WIN_64_SHA1
$FETCH $DIST_WIN_32 $DIST_WIN_32_SHA1

Expand Down
41 changes: 41 additions & 0 deletions docker/xgo-image/base/bootstrap_pure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
#
# Contains the Go tool-chain pure-Go bootstrapper, that as of Go 1.5, initiates
# not only a few pre-built Go cross compilers, but rather bootstraps all of the
# supported platforms from the origin Linux amd64 distribution.
#
# Usage: bootstrap.sh
#
# Needed environment variables:
# FETCH - Remote file fetcher and checksum verifier (injected by image)
# ROOT_DIST - 64 bit Linux Go binary distribution package
# ROOT_DIST_SHA1 - 64 bit Linux Go distribution package checksum
set -e

# Download, verify and install the root distribution
$FETCH $ROOT_DIST $ROOT_DIST_SHA1

tar -C /usr/local -xzf `basename $ROOT_DIST`
rm -f `basename $ROOT_DIST`

export GOROOT=/usr/local/go
export GOROOT_BOOTSTRAP=$GOROOT

# Pre-build all guest distributions based on the root distribution
echo "Bootstrapping linux/386..."
GOOS=linux GOARCH=386 CGO_ENABLED=1 go install std

echo "Bootstrapping linux/arm..."
GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc go install std

echo "Bootstrapping windows/amd64..."
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go install std

echo "Bootstrapping windows/386..."
GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go install std

echo "Bootstrapping darwin/amd64..."
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=o64-clang go install std

echo "Bootstrapping darwin/386..."
GOOS=darwin GOARCH=386 CGO_ENABLED=1 CC=o32-clang go install std
2 changes: 1 addition & 1 deletion docker/xgo-image/base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 go build $V -o $NA
echo "Compiling for darwin/amd64..."
CC=o64-clang HOST=x86_64-apple-darwin10 PREFIX=/usr/local $BUILD_DEPS /deps
CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get -d ./$PACK
CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-darwin-amd64$R ./$PACK
CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -ldflags=-s $V $R -o $NAME-darwin-amd64$R ./$PACK

#echo "Compiling for darwin/386..."
#CC=o32-clang HOST=i386-apple-darwin10 PREFIX=/usr/local $BUILD_DEPS /deps
Expand Down
2 changes: 1 addition & 1 deletion docker/xgo-image/beats-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tudorg/xgo-1.4.2
FROM tudorg/xgo-1.5.1

MAINTAINER Tudor Golubenco <tudor@elastic.co>

Expand Down
2 changes: 1 addition & 1 deletion docker/xgo-image/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

docker build --rm=true -t tudorg/xgo-base base/ && \
docker build --rm=true -t tudorg/xgo-1.4.2 go-1.4.2/ &&
docker build --rm=true -t tudorg/xgo-1.5.1 go-1.5.1/ &&
docker build --rm=true -t tudorg/beats-builder beats-builder
33 changes: 0 additions & 33 deletions docker/xgo-image/go-1.4.2/Dockerfile

This file was deleted.

15 changes: 15 additions & 0 deletions docker/xgo-image/go-1.5.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Go cross compiler (xgo): Go 1.5.1 layer
# Copyright (c) 2014 Péter Szilágyi. All rights reserved.
#
# Released under the MIT license.

FROM tudorg/xgo-base

MAINTAINER Tudor Golubenco <tudor@elastic.co>

# Configure the root Go distribution and bootstrap based on it
RUN \
export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz && \
export ROOT_DIST_SHA1=46eecd290d8803887dec718c691cc243f2175fe0 && \
\
$BOOTSTRAP_PURE

0 comments on commit c9b6975

Please sign in to comment.