2014-08-13 09:38:40 +00:00
|
|
|
# Go cross compiler (xgo): Base cross-compilation layer
|
|
|
|
# Copyright (c) 2014 Péter Szilágyi. All rights reserved.
|
|
|
|
#
|
|
|
|
# Released under the MIT license.
|
|
|
|
|
|
|
|
FROM ubuntu:14.04
|
|
|
|
|
|
|
|
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
|
|
|
|
2015-05-08 09:21:51 +00:00
|
|
|
# Configure the Go environment, since it's not going to change
|
|
|
|
ENV PATH /usr/local/go/bin:$PATH
|
|
|
|
ENV GOPATH /go
|
|
|
|
|
|
|
|
|
|
|
|
# Inject the remote file fetcher and checksum verifier
|
|
|
|
ADD fetch.sh /fetch.sh
|
|
|
|
ENV FETCH /fetch.sh
|
|
|
|
RUN chmod +x $FETCH
|
2014-08-13 09:38:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Make sure apt-get is up to date and dependent packages are installed
|
|
|
|
RUN \
|
|
|
|
apt-get update && \
|
2015-09-11 09:26:49 +00:00
|
|
|
apt-get install -y automake autogen build-essential ca-certificates \
|
2014-08-13 09:38:40 +00:00
|
|
|
gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-multilib gcc-mingw-w64 \
|
2015-09-11 09:26:49 +00:00
|
|
|
clang llvm-dev libtool libxml2-dev uuid-dev libssl-dev pkg-config \
|
|
|
|
patch make xz-utils cpio wget unzip p7zip git mercurial bzr \
|
|
|
|
--no-install-recommends
|
2014-08-13 09:38:40 +00:00
|
|
|
|
|
|
|
# Configure the container for OSX cross compilation
|
|
|
|
ENV OSX_SDK_PATH https://github.com/trevd/android_platform_build2/raw/master/osxsdks10.6.tar.gz
|
|
|
|
ENV OSX_SDK MacOSX10.6.sdk
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
git clone https://github.com/tpoechtrager/osxcross.git && \
|
|
|
|
\
|
2015-09-11 09:26:49 +00:00
|
|
|
$FETCH $OSX_SDK_PATH f526b4ae9806e8d31e3b094e3f004f8f160a3fad && \
|
2014-08-13 09:38:40 +00:00
|
|
|
tar -xzf `basename $OSX_SDK_PATH` --strip-components 1 SDKs/$OSX_SDK && \
|
|
|
|
tar -cjf /osxcross/tarballs/$OSX_SDK.tar.bz2 $OSX_SDK && \
|
|
|
|
rm -rf `basename $OSX_SDK_PATH` $OSX_SDK && \
|
|
|
|
\
|
2015-07-14 13:52:02 +00:00
|
|
|
UNATTENDED=yes /osxcross/build.sh
|
2015-09-11 09:26:49 +00:00
|
|
|
|
2015-05-04 07:38:10 +00:00
|
|
|
ENV PATH /osxcross/target/bin:$PATH
|
2014-08-13 09:38:40 +00:00
|
|
|
|
2015-09-11 09:26:49 +00:00
|
|
|
# Configure the container for Android cross compilation
|
|
|
|
ENV ANDROID_NDK_PATH http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
|
|
|
|
ENV ANDROID_NDK android-ndk-r10e
|
|
|
|
ENV ANDROID_PLATROOT /usr/local/$ANDROID_NDK/platforms/
|
|
|
|
ENV ANDROID_PLATFORM android-21
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
$FETCH $ANDROID_NDK_PATH c685e5f106f8daa9b5449d0a4f21ee8c0afcb2f6 && \
|
|
|
|
7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/platforms/*/arch-arm/*" -o/usr/local > /dev/null && \
|
|
|
|
7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8" -o/usr/local > /dev/null && \
|
|
|
|
rm -rf `basename $ANDROID_NDK_PATH`
|
|
|
|
|
|
|
|
ENV PATH /usr/local/$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH
|
|
|
|
|
2014-08-13 09:38:40 +00:00
|
|
|
|
2015-09-10 08:37:52 +00:00
|
|
|
# Inject the old Go package downloader and tool-chain bootstrapper
|
2015-05-08 09:21:51 +00:00
|
|
|
ADD bootstrap.sh /bootstrap.sh
|
|
|
|
ENV BOOTSTRAP /bootstrap.sh
|
|
|
|
RUN chmod +x $BOOTSTRAP
|
2014-08-13 09:38:40 +00:00
|
|
|
|
2015-09-10 08:37:52 +00:00
|
|
|
# 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
|
|
|
|
|
2015-05-08 09:21:51 +00:00
|
|
|
# Inject the C dependency cross compiler
|
|
|
|
ADD build_deps.sh /build_deps.sh
|
2015-05-03 13:38:21 +00:00
|
|
|
ENV BUILD_DEPS /build_deps.sh
|
2015-05-08 09:21:51 +00:00
|
|
|
RUN chmod +x $BUILD_DEPS
|
2015-05-03 13:38:21 +00:00
|
|
|
|
2015-05-08 09:21:51 +00:00
|
|
|
# Inject the container entry point, the build script
|
|
|
|
ADD build.sh /build.sh
|
|
|
|
ENV BUILD /build.sh
|
|
|
|
RUN chmod +x $BUILD
|
2015-05-03 13:38:21 +00:00
|
|
|
|
2015-05-08 09:21:51 +00:00
|
|
|
ENTRYPOINT ["/build.sh"]
|