github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/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  
    18  	IAmStatic string = "${IAMSTATIC:-true}"
    19  	InitSHA1  string = "$DOCKER_INITSHA1"
    20  	InitPath  string = "$DOCKER_INITPATH"
    21  )
    22  // AUTOGENERATED FILE; see $BASH_SOURCE
    23  DVEOF
    24  
    25  # Compile the Windows resources into the sources
    26  mkdir -p autogen/winresources
    27  cat > autogen/winresources/resources.go <<WREOF
    28  // Package winresources is auto-generated at build-time
    29  // AUTOGENERATED FILE; see $BASH_SOURCE
    30  package winresources
    31  
    32  /*
    33  
    34  This package is for embedding a manifest file and an icon into docker.exe.
    35  The benefit of this is that a manifest file does not need to be alongside
    36  the .exe, and there is an icon when docker runs, or viewed through Windows
    37  explorer.
    38  
    39  When make binary is run, the Dockerfile prepares the build environment by:
    40  
    41   - Cloning github.com/akavel/rsrc
    42  
    43   - Go-installing the rsrc executable
    44  
    45  make.sh invokes hack/make/.go-autogen to:
    46  
    47   - Run rsrc to create a binary file (autogen/winresources/rsrc.syso) that 
    48     contains the manifest and icon. This file is automatically picked up by 
    49     'go build', so no post-processing steps are required. The sources for 
    50     rsrc.syso are under hack/make/.resources-windows.
    51  
    52  */
    53  WREOF
    54  if [ "$(go env GOOS)" = 'windows' ]; then
    55  	rsrc \
    56  		-manifest hack/make/.resources-windows/docker.exe.manifest \
    57  		-ico      hack/make/.resources-windows/docker.ico \
    58  		-o        autogen/winresources/rsrc.syso > /dev/null
    59  fi