Build docker with gccgo, requires host to contain gccgo 5.0

Addresses #9207
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
This commit is contained in:
Srini Brahmaroutu 2015-03-03 23:22:06 +00:00 committed by root
parent a2fcae41ef
commit ec92e84b85
4 changed files with 79 additions and 1 deletions

View File

@ -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)"

View File

@ -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'

23
hack/make/dyngccgo Normal file
View File

@ -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"
)

26
hack/make/gccgo Executable file
View File

@ -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"