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