Rewrite install-protobuf script
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
3769b4840b
commit
a6ad9e04ee
@ -25,6 +25,7 @@ PROTOBUF_DIR=$(mktemp -d)
|
|||||||
|
|
||||||
# Use `go tool dist list` for the full list of targets
|
# Use `go tool dist list` for the full list of targets
|
||||||
TARGET="$(go env GOOS)-$(go env GOARCH)"
|
TARGET="$(go env GOOS)-$(go env GOARCH)"
|
||||||
|
TARGET_ORIG=$TARGET
|
||||||
|
|
||||||
# Fix up OS/ARCH to get proper download link for https://github.com/protocolbuffers/protobuf/releases
|
# Fix up OS/ARCH to get proper download link for https://github.com/protocolbuffers/protobuf/releases
|
||||||
|
|
||||||
@ -41,20 +42,22 @@ TARGET=${TARGET/linux-386/linux-x86_32}
|
|||||||
TARGET=${TARGET/linux-amd64/linux-x86_64}
|
TARGET=${TARGET/linux-amd64/linux-x86_64}
|
||||||
TARGET=${TARGET/linux-ppc64le/linux-ppcle_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"
|
if [[ $TARGET != $TARGET_ORIG ]]
|
||||||
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
|
then
|
||||||
|
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-$TARGET.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/local
|
||||||
unzip "$PROTOBUF_DIR/protobuf" -d /usr/src/protobuf
|
else
|
||||||
|
# Build from source
|
||||||
cd "/usr/src/protobuf/protobuf-$PROTOBUF_VERSION"
|
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-cpp-$PROTOBUF_VERSION.zip"
|
||||||
./autogen.sh
|
unzip "$PROTOBUF_DIR/protobuf" -d /usr/src/protobuf
|
||||||
./configure --disable-shared
|
cd "/usr/src/protobuf/protobuf-$PROTOBUF_VERSION"
|
||||||
|
./autogen.sh
|
||||||
make
|
./configure --disable-shared
|
||||||
make check
|
make
|
||||||
make install
|
make check
|
||||||
ldconfig
|
make install
|
||||||
|
ldconfig
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf "$PROTOBUF_DIR"
|
rm -rf "$PROTOBUF_DIR"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user