mirror of https://github.com/status-im/xgo.git
Add support for Go 1.5+ and pure Go distributions.
This commit is contained in:
parent
a93a3fe920
commit
0407d11cec
|
@ -44,11 +44,16 @@ RUN \
|
|||
ENV PATH /osxcross/target/bin:$PATH
|
||||
|
||||
|
||||
# Inject the Go package downloader and tool-chain bootstrapper
|
||||
# Inject the old Go package downloader and tool-chain bootstrapper
|
||||
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
|
||||
|
|
|
@ -27,24 +27,41 @@ $FETCH $DIST_WIN_32 $DIST_WIN_32_SHA1
|
|||
|
||||
# Extract the 64 bit Linux package as the primary Go SDK
|
||||
tar -C /usr/local -xzf `basename $DIST_LINUX_64`
|
||||
rm -f `basename $DIST_LINUX_64`
|
||||
|
||||
export GOROOT=/usr/local/go
|
||||
export GOROOT_BOOTSTRAP=$GOROOT
|
||||
|
||||
# Extract all other packages as secondary ones, keeping only the binaries
|
||||
if [ "$DIST_LINUX_32" != "" ]; then
|
||||
tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_32` go/pkg/linux_386*
|
||||
GOOS=linux GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
|
||||
rm -f `basename $DIST_LINUX_32`
|
||||
fi
|
||||
if [ "$DIST_LINUX_ARM" != "" ]; then
|
||||
tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_ARM` go/pkg/linux_arm*
|
||||
GOOS=linux GOARCH=arm /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
|
||||
rm -f `basename $DIST_LINUX_ARM`
|
||||
fi
|
||||
|
||||
if [ "$DIST_OSX_64" != "" ]; then
|
||||
tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_64` go/pkg/darwin_amd64*
|
||||
GOOS=darwin GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
|
||||
rm -f `basename $DIST_OSX_64`
|
||||
fi
|
||||
if [ "$DIST_OSX_32" != "" ]; then
|
||||
tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_32` go/pkg/darwin_386*
|
||||
GOOS=darwin GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
|
||||
rm -f `basename $DIST_OSX_32`
|
||||
fi
|
||||
|
||||
if [ "$DIST_WIN_64" != "" ]; then
|
||||
unzip -d /usr/local -q `basename $DIST_WIN_64` go/pkg/windows_amd64*
|
||||
GOOS=windows GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
|
||||
rm -f `basename $DIST_WIN_64`
|
||||
fi
|
||||
if [ "$DIST_WIN_32" != "" ]; then
|
||||
unzip -d /usr/local -q `basename $DIST_WIN_32` go/pkg/windows_386*
|
||||
GOOS=windows GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
|
||||
|
||||
# Delete all the intermediate downloaded files
|
||||
rm -f `basename $DIST_LINUX_64` `basename $DIST_LINUX_32` `basename $DIST_LINUX_ARM` \
|
||||
`basename $DIST_OSX_64` `basename $DIST_OSX_32` \
|
||||
`basename $DIST_WIN_64` `basename $DIST_WIN_32`
|
||||
rm -f `basename $DIST_WIN_32`
|
||||
fi
|
||||
|
|
|
@ -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 but 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
|
|
@ -92,12 +92,12 @@ 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
|
||||
CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get -d ./$PACK
|
||||
CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-darwin-386 ./$PACK
|
||||
CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build -ldflags=-s $V -o $NAME-darwin-386 ./$PACK
|
||||
|
||||
echo "Moving binaries to host..."
|
||||
cp `ls -t | head -n 7` /build
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
# Usage: fetch.sh <remote URL> <SHA1 checksum>
|
||||
set -e
|
||||
|
||||
# Skip the download if no operands specified
|
||||
if [ "$1" == "" -o "$2" == "" ]; then
|
||||
echo "Fetch operands missing, skipping..."
|
||||
exit
|
||||
fi
|
||||
|
||||
# Pull the file from the remote URL
|
||||
file=`basename $1`
|
||||
echo "Downloading $1..."
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Go cross compiler (xgo): Go 1.5.0 layer
|
||||
# Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
#
|
||||
# Released under the MIT license.
|
||||
|
||||
FROM karalabe/xgo-base
|
||||
|
||||
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
||||
|
||||
# Configure the root Go distribution and bootstrap based on it
|
||||
RUN \
|
||||
export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz && \
|
||||
export ROOT_DIST_SHA1=5817fa4b2252afdb02e11e8b9dc1d9173ef3bd5a && \
|
||||
\
|
||||
$BOOTSTRAP_PURE
|
|
@ -0,0 +1,15 @@
|
|||
# Go cross compiler (xgo): Go 1.5.1 layer
|
||||
# Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
#
|
||||
# Released under the MIT license.
|
||||
|
||||
FROM karalabe/xgo-base
|
||||
|
||||
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
||||
|
||||
# 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,0 +1,8 @@
|
|||
# Go cross compiler (xgo): Wildcard layer to the latest 1.5 release
|
||||
# Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
#
|
||||
# Released under the MIT license.
|
||||
|
||||
FROM karalabe/xgo-1.5.1
|
||||
|
||||
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
|
@ -3,6 +3,6 @@
|
|||
#
|
||||
# Released under the MIT license.
|
||||
|
||||
FROM karalabe/xgo-1.4.x
|
||||
FROM karalabe/xgo-1.5.x
|
||||
|
||||
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
||||
|
|
Loading…
Reference in New Issue