github.com/lafolle/docker@v1.6.0/hack/make/.dockerinit-gccgo (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  IAMSTATIC="true"
     5  source "$(dirname "$BASH_SOURCE")/.go-autogen"
     6  
     7  # dockerinit still needs to be a static binary, even if docker is dynamic
     8  go build --compiler=gccgo \
     9  	-o "$DEST/dockerinit-$VERSION" \
    10  	"${BUILDFLAGS[@]}" \
    11  	--gccgoflags "
    12  		-g
    13  		-Wl,--no-export-dynamic
    14  		$EXTLDFLAGS_STATIC_DOCKER
    15  	" \
    16  	./dockerinit
    17  
    18  echo "Created binary: $DEST/dockerinit-$VERSION"
    19  ln -sf "dockerinit-$VERSION" "$DEST/dockerinit"
    20  
    21  sha1sum=
    22  if command -v sha1sum &> /dev/null; then
    23  	sha1sum=sha1sum
    24  else
    25  	echo >&2 'error: cannot find sha1sum command or equivalent'
    26  	exit 1
    27  fi
    28  
    29  # sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another
    30  export DOCKER_INITSHA1="$($sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)"