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 && \
|
|
|
|
apt-get install -y automake autogen build-essential ca-certificates \
|
|
|
|
gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-multilib gcc-mingw-w64 \
|
2014-08-27 13:16:03 +00:00
|
|
|
clang llvm-dev libtool libxml2-dev uuid-dev libssl-dev pkg-config \
|
|
|
|
patch make xz-utils cpio wget unzip git mercurial --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 && \
|
|
|
|
sed -i.bak s/read/#read/g /osxcross/build.sh && \
|
|
|
|
\
|
|
|
|
$FETCH $OSX_SDK_PATH f526b4ae9806e8d31e3b094e3f004f8f160a3fad && \
|
|
|
|
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 && \
|
|
|
|
\
|
|
|
|
/osxcross/build.sh
|
2015-05-04 07:38:10 +00:00
|
|
|
ENV PATH /osxcross/target/bin:$PATH
|
2014-08-13 09:38:40 +00:00
|
|
|
|
|
|
|
|
2015-05-08 09:21:51 +00:00
|
|
|
# Inject the Go package downloader and tool-chain bootstrapper
|
|
|
|
ADD bootstrap.sh /bootstrap.sh
|
|
|
|
ENV BOOTSTRAP /bootstrap.sh
|
|
|
|
RUN chmod +x $BOOTSTRAP
|
2014-08-13 09:38:40 +00:00
|
|
|
|
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"]
|