mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #11298 from brahmaroutu/gccgo_script
Initial gccgo build script, requires host to contain gccgo 5.0
This commit is contained in:
commit
e35c78a495
4 changed files with 79 additions and 1 deletions
29
hack/make/.dockerinit-gccgo
Normal file
29
hack/make/.dockerinit-gccgo
Normal 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)"
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# see test-integration-cli for example usage of this script
|
# 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
|
if ! command -v docker &> /dev/null; then
|
||||||
echo >&2 'error: binary or dynbinary must be run before .integration-daemon-start'
|
echo >&2 'error: binary or dynbinary must be run before .integration-daemon-start'
|
||||||
|
|
23
hack/make/dyngccgo
Normal file
23
hack/make/dyngccgo
Normal 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
26
hack/make/gccgo
Executable 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"
|
Loading…
Add table
Reference in a new issue