hack/make/.go-autogen
52379fa7
 #!/usr/bin/env bash
6871b9b1
 
 rm -rf autogen
8625a281
 
2790ac68
 source hack/dockerfile/binaries-commits
 
8054a303
 cat > dockerversion/version_autogen.go <<DVEOF
 // +build autogen
a1733c65
 
a7b73e57
 // Package dockerversion is auto-generated at build-time
b78ca243
 package dockerversion
6871b9b1
 
8054a303
 // Default build-time variable for library-import.
 // This file is overridden on build with build-time informations.
 const (
2790ac68
 	GitCommit          string = "$GITCOMMIT"
 	Version            string = "$VERSION"
 	BuildTime          string = "$BUILDTIME"
 	IAmStatic          string = "${IAMSTATIC:-true}"
ddae20c0
 	ContainerdCommitID string = "${CONTAINERD_COMMIT}"
17df5593
 )
 
 // AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
 DVEOF
 
 cat > dockerversion/version_autogen_unix.go <<DVEOF
 // +build autogen,!windows
 
 // Package dockerversion is auto-generated at build-time
 package dockerversion
 
 // Default build-time variable for library-import.
 // This file is overridden on build with build-time informations.
 const (
ddae20c0
 	RuncCommitID string = "${RUNC_COMMIT}"
 	InitCommitID string = "${TINI_COMMIT}"
6871b9b1
 )
2790ac68
 
 // AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
fd935ee6
 DVEOF
 
 # Compile the Windows resources into the sources
4677f803
 if [ "$(go env GOOS)" = "windows" ]; then
 	mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
 	cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
 	cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
 
 	if [ "$(go env GOHOSTOS)" == "windows" ]; then
 		WINDRES=windres
57aef3b4
 		WINDMC=windmc
4677f803
 	else
 		# Cross compiling
 		WINDRES=x86_64-w64-mingw32-windres
57aef3b4
 		WINDMC=x86_64-w64-mingw32-windmc
4677f803
 	fi
 
 	# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
 	VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
 
 	# Pass version and commit information into the resource compiler
 	defs=
 	[ ! -z $VERSION ]      && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
 	[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
 	[ ! -z $GITCOMMIT ]    && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
 
 	function makeres {
 		$WINDRES \
 			-i hack/make/.resources-windows/$1 \
 			-o $3 \
 			-F $2 \
 			--use-temp-file \
 			-I autogen/winresources/tmp \
 			$defs
 	}
 
57aef3b4
 	$WINDMC \
 		hack/make/.resources-windows/event_messages.mc \
 		-h autogen/winresources/tmp \
 		-r autogen/winresources/tmp
 
4677f803
 	makeres docker.rc pe-x86-64 autogen/winresources/docker/rsrc_amd64.syso
 	makeres docker.rc pe-i386 autogen/winresources/docker/rsrc_386.syso
 	makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
 
 	rm -r autogen/winresources/tmp
fd935ee6
 fi