Skip to content

Commit

Permalink
Adds compression opts to gobuild for istioctl. (istio#13641)
Browse files Browse the repository at this point in the history
Adds the compression options to gobuild for istioctl,
and adds -9 compression for the release artifact(s).
  • Loading branch information
Jason Clark authored and istio-testing committed Jun 10, 2019
1 parent 322044c commit e042aa0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ $(foreach ITEM,$(PILOT_GO_BINS_SHORT),$(eval $(call pilotbuild,$(ITEM))))

.PHONY: istioctl
istioctl ${ISTIO_OUT}/istioctl:
bin/gobuild.sh ${ISTIO_OUT}/istioctl ./istioctl/cmd/istioctl
LDFLAGS='-extldflags -static -s -w' bin/gobuild.sh ${ISTIO_OUT}/istioctl ./istioctl/cmd/istioctl

# Non-static istioctls. These are typically a build artifact.
${ISTIO_OUT}/istioctl-linux: depend
STATIC=0 GOOS=linux bin/gobuild.sh $@ ./istioctl/cmd/istioctl
STATIC=0 GOOS=linux LDFLAGS='-extldflags -static -s -w' bin/gobuild.sh $@ ./istioctl/cmd/istioctl
${ISTIO_OUT}/istioctl-osx: depend
STATIC=0 GOOS=darwin bin/gobuild.sh $@ ./istioctl/cmd/istioctl
STATIC=0 GOOS=darwin LDFLAGS='-extldflags -static -s -w' bin/gobuild.sh $@ ./istioctl/cmd/istioctl
${ISTIO_OUT}/istioctl-win.exe: depend
STATIC=0 GOOS=windows bin/gobuild.sh $@ ./istioctl/cmd/istioctl
STATIC=0 GOOS=windows LDFLAGS='-extldflags -static -s -w' bin/gobuild.sh $@ ./istioctl/cmd/istioctl

# generate the istioctl completion files
${ISTIO_OUT}/istioctl.bash: istioctl
Expand Down
3 changes: 2 additions & 1 deletion bin/gobuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ GOBINARY=${GOBINARY:-go}
GOPKG="$GOPATH/pkg"
BUILDINFO=${BUILDINFO:-""}
STATIC=${STATIC:-1}
LDFLAGS="-extldflags -static"
LDFLAGS=${LDFLAGS:-extldflags -static}
GOBUILDFLAGS=${GOBUILDFLAGS:-""}
# Split GOBUILDFLAGS by spaces into an array called GOBUILDFLAGS_ARRAY.
IFS=' ' read -r -a GOBUILDFLAGS_ARRAY <<< "$GOBUILDFLAGS"
Expand All @@ -58,6 +58,7 @@ fi

# BUILD LD_EXTRAFLAGS
LD_EXTRAFLAGS=""

while read -r line; do
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X ${line}"
done < "${BUILDINFO}"
Expand Down
4 changes: 2 additions & 2 deletions release/create_release_archives.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function create_linux_archive() {
${CP} "${OUTPUT_PATH}/${ISTIOCTL_SUBDIR}/istioctl-linux" "${istioctl_path}"
chmod 755 "${istioctl_path}"

${TAR} --owner releng --group releng -czf \
env GZIP=-9 "${TAR}" --owner releng --group releng -czf \
"${OUTPUT_PATH}/istio-${VER_STRING}-linux.tar.gz" "istio-${VER_STRING}" \
|| error_exit 'Could not create linux archive'
rm "${istioctl_path}"
Expand All @@ -99,7 +99,7 @@ function create_osx_archive() {
${CP} "${OUTPUT_PATH}/${ISTIOCTL_SUBDIR}/istioctl-osx" "${istioctl_path}"
chmod 755 "${istioctl_path}"

${TAR} --owner releng --group releng -czf \
env GZIP=-9 "${TAR}" --owner releng --group releng -czf \
"${OUTPUT_PATH}/istio-${VER_STRING}-osx.tar.gz" "istio-${VER_STRING}" \
|| error_exit 'Could not create osx archive'
rm "${istioctl_path}"
Expand Down

0 comments on commit e042aa0

Please sign in to comment.