Skip to content

Commit b4916b4

Browse files
authored
Add build for armv7 buf binaries (#3450)
1 parent fdc034f commit b4916b4

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

make/buf/scripts/release.bash

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ goarch() {
2727
x86_64) echo amd64 ;;
2828
arm64) echo arm64 ;;
2929
aarch64) echo arm64 ;;
30+
armv7) echo arm ;;
3031
*) return 1 ;;
3132
esac
3233
}
@@ -83,7 +84,7 @@ mkdir -p "${RELEASE_DIR}"
8384
cd "${RELEASE_DIR}"
8485

8586
for os in Darwin Linux Windows; do
86-
for arch in x86_64 arm64; do
87+
for arch in x86_64 arm64 armv7; do
8788
# our goal is to have the binaries be suffixed with $(uname -s)-$(uname -m)
8889
# on mac, this is arm64, on linux, this is aarch64, for historical reasons
8990
# this is a hacky way to not have to rewrite this loop (and others below)
@@ -100,15 +101,27 @@ for os in Darwin Linux Windows; do
100101
buf \
101102
protoc-gen-buf-breaking \
102103
protoc-gen-buf-lint; do
103-
CGO_ENABLED=0 GOOS=$(goos "${os}") GOARCH=$(goarch "${arch}") \
104-
go build -a -ldflags "-s -w" -trimpath -buildvcs=false -o "${dir}/bin/${binary}${extension}" "${DIR}/cmd/${binary}"
104+
if [ "${arch}" == "armv7" ]; then
105+
if [ "${os}" == "Linux" ]; then
106+
CGO_ENABLED=0 GOOS=$(goos "${os}") GOARCH=$(goarch "${arch}") GOARM=7 \
107+
go build -a -ldflags "-s -w" -trimpath -buildvcs=false -o "${dir}/bin/${binary}${extension}" "${DIR}/cmd/${binary}"
108+
else
109+
continue
110+
fi
111+
else
112+
CGO_ENABLED=0 GOOS=$(goos "${os}") GOARCH=$(goarch "${arch}") \
113+
go build -a -ldflags "-s -w" -trimpath -buildvcs=false -o "${dir}/bin/${binary}${extension}" "${DIR}/cmd/${binary}"
114+
fi
105115
cp "${dir}/bin/${binary}${extension}" "${binary}-${os}-${arch}${extension}"
106116
done
107117
done
108118
done
109119

110120
for os in Darwin Linux Windows; do
111-
for arch in x86_64 arm64; do
121+
for arch in x86_64 arm64 armv7; do
122+
if [ "${arch}" == "armv7" ] && [ "${os}" != "Linux" ]; then
123+
continue
124+
fi
112125
if [ "${os}" == "Linux" ] && [ "${arch}" == "arm64" ]; then
113126
arch="aarch64"
114127
fi
@@ -128,7 +141,10 @@ for os in Darwin Linux Windows; do
128141
done
129142

130143
for os in Darwin Linux; do
131-
for arch in x86_64 arm64; do
144+
for arch in x86_64 arm64 armv7; do
145+
if [ "${arch}" == "armv7" ] && [ "${os}" != "Linux" ]; then
146+
continue
147+
fi
132148
if [ "${os}" == "Linux" ] && [ "${arch}" == "arm64" ]; then
133149
arch="aarch64"
134150
fi

0 commit comments

Comments
 (0)