forked from a4/a4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_protobuf.sh
executable file
·87 lines (69 loc) · 2.11 KB
/
get_protobuf.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
target_name=protobuf
protobuf_name=protobuf-2.4.1
protobuf_pack=$protobuf_name.tar.bz2
protobuf_url=http://protobuf.googlecode.com/files/$protobuf_pack
if test -d $target_name; then
echo "Existing $target_name/ directory found, exiting..."
exit -1
fi
echo "-------------------------------------------"
echo "A4: Acquiring source of protobuf library..."
echo "-------------------------------------------"
if ! test -d $protobuf_name; then
if ! test -e $protobuf_pack; then
echo "Downloading A4 $target_name library $protobuf_name..."
curl -f $protobuf_url > $protobuf_pack
if test $? != 0; then
echo "FATAL: Download failed! :( "
exit 1
fi
else
echo "Using existing file $protobuf_pack."
fi
echo "Unpacking $protobuf_pack..."
if ! tar -xj -f $protobuf_pack; then
echo "FATAL: Could not unpack $protobuf_pack!"
exit 1
fi
echo "Extracted $protobuf_name."
else
echo "Existing $protobuf_name directory found!"
fi
prefix=$PWD/$target_name
mkdir $prefix
pushd $protobuf_name
echo "-----------------------------------"
echo "A4: Configuring Protobuf Library..."
echo "-----------------------------------"
if ! ./configure --prefix=$prefix; then
echo "Protobuf configure failed! :("
echo "Edit ./get_protobuf.sh if you need to add additional options to ./configure"
exit 1
fi
echo "---------------------------------"
echo "A4: Compiling Protobuf Library..."
echo "---------------------------------"
if ! make $@; then
echo "Protobuf compilation failed! :("
exit 1
fi
echo "----------------------------------------"
echo "A4: Local install of Protobuf Library..."
echo "----------------------------------------"
if ! make install; then
echo "Protobuf installation into $PWD failed! :("
exit 1
fi
pushd python
mkdir -p $prefix/python
if ! PYTHONPATH=$prefix/python python setup.py install --prefix $prefix --install-purelib $prefix/python; then
echo "Protobuf python installation failed! :("
exit 1
fi
popd
popd
rm -rf $protobuf_name/
echo "------------------------------------"
echo "A4: Builtin Protobuf ready for use!"
echo "------------------------------------"