Permalink
Browse files

Enable gccgo build support. The build needs to be run as

for dynamic binary - ./project/make.sh dyngccgo
for static binary - ./project/make.sh gccgo
  • Loading branch information...
1 parent 01562c7 commit b34e0cd5e8511f388e5d2150559ec80a99a32d79 @bpradipt committed Mar 17, 2015
Showing with 79 additions and 1 deletion.
  1. +29 −0 project/make/.dockerinit-gccgo
  2. +1 −1 project/make/.integration-daemon-start
  3. +23 −0 project/make/dyngccgo
  4. +26 −0 project/make/gccgo
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -e
+
+IAMSTATIC="true"
+source "$(dirname "$BASH_SOURCE")/.go-autogen"
+
+go build --compiler=gccgo \
+ -o "$DEST/dockerinit-$VERSION" \
+ "${BUILDFLAGS[@]}" \
+ --gccgoflags "
+ -g
+ -Wl,--no-export-dynamic
+ $EXTLDFLAGS_STATIC_DOCKER
+ " \
+ ./dockerinit
+
+echo "Created binary: $DEST/dockerinit-$VERSION"
+ln -sf "dockerinit-$VERSION" "$DEST/dockerinit"
+
+sha1sum=
+if command -v sha1sum &> /dev/null; then
+ sha1sum=sha1sum
+else
+ echo >&2 'error: cannot find sha1sum command or equivalent'
+ exit 1
+fi
+
+# sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another
+export DOCKER_INITSHA1="$($sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)"
@@ -2,7 +2,7 @@
# see test-integration-cli for example usage of this script
-export PATH="$DEST/../binary:$DEST/../dynbinary:$PATH"
+export PATH="$DEST/../binary:$DEST/../dynbinary:$DEST/../gccgo:$PATH"
if ! command -v docker &> /dev/null; then
echo >&2 'error: binary or dynbinary must be run before .integration-daemon-start'
View
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -e
+
+DEST=$1
+
+if [ -z "$DOCKER_CLIENTONLY" ]; then
+ source "$(dirname "$BASH_SOURCE")/.dockerinit-gccgo"
+
+ hash_files "$DEST/dockerinit-$VERSION"
+else
+ # DOCKER_CLIENTONLY must be truthy, so we don't need to bother with dockerinit :)
+ export DOCKER_INITSHA1=""
+fi
+# DOCKER_INITSHA1 is exported so that other bundlescripts can easily access it later without recalculating it
+
+(
+ export IAMSTATIC="false"
+ export EXTLDFLAGS_STATIC_DOCKER=''
+ export LDFLAGS_STATIC_DOCKER=''
+ export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
+ export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
+ source "$(dirname "$BASH_SOURCE")/gccgo"
+)
View
@@ -0,0 +1,26 @@
+#!/bin/bash
+set -e
+
+DEST=$1
+BINARY_NAME="docker-$VERSION"
+BINARY_EXTENSION="$(binary_extension)"
+BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
+
+source "$(dirname "$BASH_SOURCE")/.go-autogen"
+
+go build --compiler=gccgo \
+ -o "$DEST/$BINARY_FULLNAME" \
+ "${BUILDFLAGS[@]}" \
+ --gccgoflags "
+ -g
+ $EXTLDFLAGS_STATIC_DOCKER
+ -Wl,--no-export-dynamic
+ -ldl
+ " \
+ ./docker
+
+
+echo "Created binary: $DEST/$BINARY_FULLNAME"
+ln -sf "$BINARY_FULLNAME" "$DEST/docker$BINARY_EXTENSION"
+
+hash_files "$DEST/$BINARY_FULLNAME"

0 comments on commit b34e0cd

Please sign in to comment.