Rewrite install-protobuf script
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
a8a35cab22
commit
3769b4840b
@ -21,44 +21,41 @@
|
|||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
PROTOBUF_VERSION=3.20.1
|
PROTOBUF_VERSION=3.20.1
|
||||||
GOARCH=$(go env GOARCH)
|
|
||||||
GOOS=$(go env GOOS)
|
|
||||||
PROTOBUF_DIR=$(mktemp -d)
|
PROTOBUF_DIR=$(mktemp -d)
|
||||||
|
|
||||||
case $GOARCH in
|
# Use `go tool dist list` for the full list of targets
|
||||||
|
TARGET="$(go env GOOS)-$(go env GOARCH)"
|
||||||
|
|
||||||
arm64)
|
# Fix up OS/ARCH to get proper download link for https://github.com/protocolbuffers/protobuf/releases
|
||||||
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-aarch_64.zip"
|
|
||||||
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
|
|
||||||
;;
|
|
||||||
|
|
||||||
amd64|386)
|
# Darwin
|
||||||
if [ "$GOOS" = windows ]; then
|
TARGET=${TARGET/darwin-amd64/osx-x86_64}
|
||||||
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-win32.zip"
|
TARGET=${TARGET/darwin-arm64/osx-aarch_64}
|
||||||
elif [ "$GOOS" = linux ]; then
|
|
||||||
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip"
|
|
||||||
elif [ "$GOOS" == darwin ]; then
|
|
||||||
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-osx-x86_64.zip"
|
|
||||||
fi
|
|
||||||
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
|
|
||||||
;;
|
|
||||||
|
|
||||||
ppc64le)
|
# Windows
|
||||||
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-ppcle_64.zip"
|
TARGET=${TARGET/windows-amd64/win64}
|
||||||
|
TARGET=${TARGET/windows-386/win32}
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
TARGET=${TARGET/linux-386/linux-x86_32}
|
||||||
|
TARGET=${TARGET/linux-amd64/linux-x86_64}
|
||||||
|
TARGET=${TARGET/linux-ppc64le/linux-ppcle_64}
|
||||||
|
|
||||||
|
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-$TARGET.zip"
|
||||||
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
|
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
|
||||||
;;
|
|
||||||
*)
|
|
||||||
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-cpp-$PROTOBUF_VERSION.zip"
|
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-cpp-$PROTOBUF_VERSION.zip"
|
||||||
unzip "$PROTOBUF_DIR/protobuf" -d /usr/src/protobuf
|
unzip "$PROTOBUF_DIR/protobuf" -d /usr/src/protobuf
|
||||||
|
|
||||||
cd "/usr/src/protobuf/protobuf-$PROTOBUF_VERSION"
|
cd "/usr/src/protobuf/protobuf-$PROTOBUF_VERSION"
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --disable-shared
|
./configure --disable-shared
|
||||||
|
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
ldconfig
|
ldconfig
|
||||||
;;
|
|
||||||
esac
|
|
||||||
rm -rf "$PROTOBUF_DIR"
|
rm -rf "$PROTOBUF_DIR"
|
||||||
|
|
||||||
# Download status.proto. grpc repos' one seems copied from
|
# Download status.proto. grpc repos' one seems copied from
|
||||||
|
Loading…
Reference in New Issue
Block a user