美文网首页
Mac install protobuf

Mac install protobuf

作者: 滴滴时光 | 来源:发表于2017-06-04 22:34 被阅读97次
#!/usr/bin/env bash

# Usage: sudo ./install_protobuf.sh

warn () {
    echo "$*"
}

die () {
    echo "$*"
    exit 1
}

echo "git clone git@github.com:google/protobuf.git" 

git clone git@github.com:google/protobuf.git

if [[ $? -ne 0 ]]; then
  die "fetch protobuf source code failed."
fi

cd protobuf

if [[ $? -ne 0 ]]; then
  die "cd protobuf failed."
fi

./autogen.sh
./configure

make

if [[ $? -ne 0 ]]; then
  die "make failed."
fi

make check

if [[ $? -ne 0 ]]; then
  die "make check faild."
fi

sudo make install

if [[ $? -ne 0 ]]; then
  die "sudo make install failed."
fi

# Refresh shared library cache
sudo ldconfig 

echo "begin build python lib"

cd python

python --version
protoc --version

python setup.py build --cpp_implementation

if [[ $? -ne 0 ]]; then
    die "python setup.py build --cpp_implementation failed."
fi

python setup.py test --cpp_implementation

if [[ $? -ne 0 ]]; then
    die "python setup.py test --cpp_implementation failed."
fi

python setup.py install --cpp_implementation

if [[ $? -eq 0 ]]; then 
    echo "Done"
fi

相关文章

网友评论

      本文标题:Mac install protobuf

      本文链接:https://www.haomeiwen.com/subject/yupbfxtx.html