github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+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  LDFLAGS="${LDFLAGS} \
    10  	-X \"github.com/docker/docker/dockerversion.Version=${VERSION}\" \
    11  	-X \"github.com/docker/docker/dockerversion.GitCommit=${GITCOMMIT}\" \
    12  	-X \"github.com/docker/docker/dockerversion.BuildTime=${BUILDTIME}\" \
    13  	-X \"github.com/docker/docker/dockerversion.IAmStatic=${IAMSTATIC:-true}\" \
    14  	-X \"github.com/docker/docker/dockerversion.PlatformName=${PLATFORM}\" \
    15  	-X \"github.com/docker/docker/dockerversion.ProductName=${PRODUCT}\" \
    16  	-X \"github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE}\" \
    17  	-X \"github.com/docker/docker/dockerversion.InitCommitID=${TINI_COMMIT}\" \
    18  "
    19  
    20  # Compile the Windows resources into the sources
    21  if [ "$(go env GOOS)" = "windows" ]; then
    22  	mkdir -p autogen/winresources/tmp autogen/winresources/dockerd
    23  	cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
    24  
    25  	if [ "$(go env GOHOSTOS)" == "windows" ]; then
    26  		WINDRES=windres
    27  		WINDMC=windmc
    28  	else
    29  		# Cross compiling
    30  		WINDRES=x86_64-w64-mingw32-windres
    31  		WINDMC=x86_64-w64-mingw32-windmc
    32  	fi
    33  
    34  	# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
    35  	if [ ! -v VERSION_QUAD ]; then
    36  		VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
    37  	fi
    38  
    39  	# Pass version and commit information into the resource compiler
    40  	defs=
    41  	[ ! -z $VERSION ]      && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
    42  	[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
    43  	[ ! -z $GITCOMMIT ]    && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
    44  
    45  	function makeres {
    46  		${WINDRES} \
    47  			-i hack/make/.resources-windows/$1 \
    48  			-o $3 \
    49  			-F $2 \
    50  			--use-temp-file \
    51  			-I autogen/winresources/tmp \
    52  			$defs
    53  	}
    54  
    55  	${WINDMC} \
    56  		hack/make/.resources-windows/event_messages.mc \
    57  		-h autogen/winresources/tmp \
    58  		-r autogen/winresources/tmp
    59  
    60  	makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
    61  
    62  	rm -r autogen/winresources/tmp
    63  fi