github.com/devdivbcp/moby@v17.12.0-ce-rc1.0.20200726071732-2d4bfdc789ad+incompatible/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 information.
    17  const (
    18  	GitCommit             string = "$GITCOMMIT"
    19  	Version               string = "$VERSION"
    20  	BuildTime             string = "$BUILDTIME"
    21  	IAmStatic             string = "${IAMSTATIC:-true}"
    22  	PlatformName          string = "${PLATFORM}"
    23  	ProductName           string = "${PRODUCT}"
    24  	DefaultProductLicense string = "${DEFAULT_PRODUCT_LICENSE}"
    25  )
    26  
    27  // AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
    28  DVEOF
    29  
    30  cat > dockerversion/version_autogen_unix.go <<DVEOF
    31  // +build autogen,!windows
    32  
    33  // Package dockerversion is auto-generated at build-time
    34  package dockerversion
    35  
    36  // Default build-time variable for library-import.
    37  // This file is overridden on build with build-time information.
    38  const (
    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  	if [ ! -v VERSION_QUAD ]; then
    62  		VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
    63  	fi
    64  
    65  	# Pass version and commit information into the resource compiler
    66  	defs=
    67  	[ ! -z $VERSION ]      && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
    68  	[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
    69  	[ ! -z $GITCOMMIT ]    && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
    70  
    71  	function makeres {
    72  		${WINDRES} \
    73  			-i hack/make/.resources-windows/$1 \
    74  			-o $3 \
    75  			-F $2 \
    76  			--use-temp-file \
    77  			-I autogen/winresources/tmp \
    78  			$defs
    79  	}
    80  
    81  	${WINDMC} \
    82  		hack/make/.resources-windows/event_messages.mc \
    83  		-h autogen/winresources/tmp \
    84  		-r autogen/winresources/tmp
    85  
    86  	makeres docker.rc pe-x86-64 autogen/winresources/docker/rsrc_amd64.syso
    87  	makeres docker.rc pe-i386 autogen/winresources/docker/rsrc_386.syso
    88  	makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
    89  
    90  	rm -r autogen/winresources/tmp
    91  fi