Ver Fonte

update for mac

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Jessica Frazelle há 9 anos atrás
pai
commit
6c818f3e5f
2 ficheiros alterados com 27 adições e 3 exclusões
  1. 18 1
      Dockerfile
  2. 9 2
      hack/make/binary

+ 18 - 1
Dockerfile

@@ -26,9 +26,14 @@
 FROM ubuntu:14.04
 FROM ubuntu:14.04
 MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
 MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
 
 
+# add zfs ppa
 RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
 RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
 RUN	echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
 RUN	echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
 
 
+# add llvm repo
+RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 15CF4D18AF4F7421
+RUN	echo deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main > /etc/apt/sources.list.d/llvm.list
+
 # Packaged dependencies
 # Packaged dependencies
 RUN apt-get update && apt-get install -y \
 RUN apt-get update && apt-get install -y \
 	apparmor \
 	apparmor \
@@ -37,6 +42,7 @@ RUN apt-get update && apt-get install -y \
 	bash-completion \
 	bash-completion \
 	btrfs-tools \
 	btrfs-tools \
 	build-essential \
 	build-essential \
+	clang-3.8 \
 	createrepo \
 	createrepo \
 	curl \
 	curl \
 	dpkg-sig \
 	dpkg-sig \
@@ -58,7 +64,9 @@ RUN apt-get update && apt-get install -y \
 	ubuntu-zfs \
 	ubuntu-zfs \
 	xfsprogs \
 	xfsprogs \
 	libzfs-dev \
 	libzfs-dev \
-	--no-install-recommends
+	--no-install-recommends \
+	&& ln -snf /usr/bin/clang-3.8 /usr/local/bin/clang \
+	&& ln -snf /usr/bin/clang++-3.8 /usr/local/bin/clang++
 
 
 # Get lvm2 source for compiling statically
 # Get lvm2 source for compiling statically
 RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
 RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
@@ -105,6 +113,15 @@ RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint
 	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
 	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
 	&& go install -v github.com/golang/lint/golint
 	&& go install -v github.com/golang/lint/golint
 
 
+# Configure the container for OSX cross compilation
+ENV OSX_SDK MacOSX10.11.sdk
+RUN set -x \
+	&& export OSXCROSS_PATH="/osxcross" \
+	&& git clone --depth 1 https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \
+	&& curl -sSL https://s3.dockerproject.org/darwin/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \
+	&& UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh
+ENV PATH /osxcross/target/bin:$PATH
+
 # Install registry
 # Install registry
 ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
 ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
 RUN set -x \
 RUN set -x \

+ 9 - 2
hack/make/binary

@@ -25,8 +25,15 @@ if [ "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" == "windows/amd64" ] && [ "$(go e
 	export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC_DOCKER -linkmode=internal"
 	export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC_DOCKER -linkmode=internal"
 fi
 fi
 
 
-if [ "$IAMSTATIC" == "true" ]; then
-	export BUILDFLAGS=( "${BUILDFLAGS[@]/pkcs11 /}" ) # we cannot dlopen in pkcs11 in a static binary
+if [ "$IAMSTATIC" == "true" ] && [ "$(go env GOHOSTOS)" == "linux" ] && [ "$DOCKER_EXPERIMENTAL" ]; then
+	if  [ "${GOOS}/${GOARCH}" == "darwin/amd64" ]; then
+		export CGO_ENABLED=1
+		export CC=o64-clang
+		export LDFLAGS='-linkmode external -s'
+		export LDFLAGS_STATIC_DOCKER='-extld='${CC}
+	else
+		export BUILDFLAGS=( "${BUILDFLAGS[@]/pkcs11 /}" ) # we cannot dlopen in pkcs11 in a static binary
+	fi
 fi
 fi
 
 
 echo "Building: $DEST/$BINARY_FULLNAME"
 echo "Building: $DEST/$BINARY_FULLNAME"