github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/ci/cli/tasks/build-binaries.yml (about) 1 platform: linux 2 image: docker:///cloudfoundry/cli-ci 3 4 inputs: 5 - name: cli 6 path: gopath/src/code.cloudfoundry.org/cli 7 8 outputs: 9 - name: cross-compiled 10 11 run: 12 path: bash 13 args: 14 - -c 15 - | 16 set -ex 17 18 cwd=$PWD 19 20 export GOPATH=$PWD/gopath 21 export PATH=$GOPATH/bin:$PATH 22 23 go version 24 25 pushd $GOPATH/src/code.cloudfoundry.org/cli 26 BUILD_VERSION=$(cat ci/VERSION) 27 BUILD_SHA=$(git rev-parse --short HEAD) 28 BUILD_DATE=$(date -u +"%Y-%m-%d") 29 30 VERSION_LDFLAGS="-X code.cloudfoundry.org/cli/version.binaryVersion=${BUILD_VERSION} -X code.cloudfoundry.org/cli/version.binarySHA=${BUILD_SHA} -X code.cloudfoundry.org/cli/version.binaryBuildDate=${BUILD_DATE}" 31 32 echo "Building 32-bit Linux" 33 CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\" ${VERSION_LDFLAGS}" -o out/cf-cli_linux_i686 . 34 35 echo "Building 64-bit Linux" 36 CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\" ${VERSION_LDFLAGS}" -o out/cf-cli_linux_x86-64 . 37 38 # This to to add the CF Icon into the windows executable 39 go get github.com/akavel/rsrc 40 rsrc -ico ci/installers/windows/cf.ico 41 42 echo "Building 32-bit Windows" 43 GOARCH=386 GOOS=windows go build -tags="forceposix" -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_win32.exe . 44 45 echo "Building 64-bit Windows" 46 GOARCH=amd64 GOOS=windows go build -tags="forceposix" -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_winx64.exe . 47 48 echo "Creating tarball" 49 tar -cvzf $cwd/cross-compiled/cf-cli-binaries.tgz -C out . 50 popd