-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathfetch_protoc.sh
More file actions
executable file
·39 lines (32 loc) · 936 Bytes
/
fetch_protoc.sh
File metadata and controls
executable file
·39 lines (32 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -e
DL="lib"
VER="22.0"
PROTOC_DIR="$DL/protoc-$VER"
rm -rf $PROTOC_DIR
ME=$(basename "$0")
SYSTEM_TYPE=$(uname -s)
case ${SYSTEM_TYPE} in
'Darwin') OS=osx;;
'Linux') OS=linux;;
*) echo "Sorry, but there is no automatic support for ${SYSTEM_TYPE}" >&2
exit 1
;;
esac
MACHINE_TYPE=$(uname -m)
case ${MACHINE_TYPE} in
'i686') ARCH='x86_32';; # 32-bit
'x86_64') ARCH='x86_64';; # 64-bit
*) echo "Sorry, but there is no automatic support for the ${MACHINE_TYPE} architecture" >&2
exit 1
;;
esac
ZIP_FILE="protoc-$VER-$OS-$ARCH.zip"
wget -P $DL https://github.com/google/protobuf/releases/download/v$VER/$ZIP_FILE
mkdir -p $PROTOC_DIR
unzip $DL/$ZIP_FILE -d $PROTOC_DIR
rm -f $DL/$ZIP_FILE
echo "[$ME] protoc installed at $PWD/$PROTOC_DIR/bin"
echo "[$ME] Run the configure script:"
echo "[$ME] autoconf"
echo "[$ME] ./configure --with-protoc=$PWD/$PROTOC_DIR/bin/protoc"