github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/hack/make/.go-autogen (about)

     1  #!/usr/bin/env bash
     2  
     3  rm -rf autogen
     4  
     5  source hack/dockerfile/install/runc.installer
     6  source hack/dockerfile/install/tini.installer
     7  source hack/dockerfile/install/containerd.installer
     8  
     9  cat > dockerversion/version_autogen.go <<DVEOF
    10  // +build autogen
    11  
    12  // Package dockerversion is auto-generated at build-time
    13  package dockerversion
    14  
    15  // Default build-time variable for library-import.
    16  // This file is overridden on build with build-time informations.
    17  const (
    18  	GitCommit          string = "$GITCOMMIT"
    19  	Version            string = "$VERSION"
    20  	BuildTime          string = "$BUILDTIME"
    21  	IAmStatic          string = "${IAMSTATIC:-true}"
    22  	ContainerdCommitID string = "${CONTAINERD_COMMIT}"
    23  	PlatformName       string = "${PLATFORM}"
    24  )
    25  
    26  // AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
    27  DVEOF
    28  
    29  cat > dockerversion/version_autogen_unix.go <<DVEOF
    30  // +build autogen,!windows
    31  
    32  // Package dockerversion is auto-generated at build-time
    33  package dockerversion
    34  
    35  // Default build-time variable for library-import.
    36  // This file is overridden on build with build-time informations.
    37  const (
    38  	RuncCommitID string = "${RUNC_COMMIT}"
    39  	InitCommitID string = "${TINI_COMMIT}"
    40  )
    41  
    42  // AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
    43  DVEOF
    44  
    45  # Compile the Windows resources into the sources
    46  if [ "$(go env GOOS)" = "windows" ]; then
    47  	mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
    48  	cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
    49  	cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
    50  
    51  	if [ "$(go env GOHOSTOS)" == "windows" ]; then
    52  		WINDRES=windres
    53  		WINDMC=windmc
    54  	else
    55  		# Cross compiling
    56  		WINDRES=x86_64-w64-mingw32-windres
    57  		WINDMC=x86_64-w64-mingw32-windmc
    58  	fi
    59  
    60  	# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
    61  	VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
    62  
    63  	# Pass version and commit information into the resource compiler
    64  	defs=
    65  	[ ! -z $VERSION ]      && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
    66  	[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
    67  	[ ! -z $GITCOMMIT ]    && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
    68  
    69  	function makeres {
    70  		$WINDRES \
    71  			-i hack/make/.resources-windows/$1 \
    72  			-o $3 \
    73  			-F $2 \
    74  			--use-temp-file \
    75  			-I autogen/winresources/tmp \
    76  			$defs
    77  	}
    78  
    79  	$WINDMC \
    80  		hack/make/.resources-windows/event_messages.mc \
    81  		-h autogen/winresources/tmp \
    82  		-r autogen/winresources/tmp
    83  
    84  	makeres docker.rc pe-x86-64 autogen/winresources/docker/rsrc_amd64.syso
    85  	makeres docker.rc pe-i386 autogen/winresources/docker/rsrc_386.syso
    86  	makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
    87  
    88  	rm -r autogen/winresources/tmp
    89  fi