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