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