grpc
大约 1 分钟
grpc
项目迁移
因为直接使用github在国内的速度太慢,直接迁移到国内.
子仓库列表
https://github.com/madler/zlib
https://github.com/google/protobuf.git
https://github.com/google/googletest.git
https://github.com/google/benchmark
https://github.com/google/boringssl.git
https://github.com/google/re2.git
https://github.com/c-ares/c-ares.git
https://github.com/google/bloaty.git
https://github.com/abseil/abseil-cpp.git
https://github.com/envoyproxy/data-plane-api.git
https://github.com/googleapis/googleapis.git
https://github.com/envoyproxy/protoc-gen-validate.git
https://github.com/cncf/udpa.git
https://github.com/libuv/libuv.git
https://github.com/census-instrumentation/opencensus-proto.git
工作分支
v1.39.x
更改子仓库地址
.gitmodules
添加编译后的文件
new file: dist/grpc_php_plugin
new file: dist/protoc-3.15.8.0
安装grpc_php_plugin模板生成工具
现在他使用了cmake做为编译方式,所以先安装brew install cmake
.
git clone git@grpc/grpc.git
cd grpc
git checkout v1.39.x
// 修改.gitmodules里的子仓库地址为国内
git submodule update --init
mkdir -p cmake/build
cd cmake/build
cmake ../..
make protoc grpc_php_plugin
protoc命令行工具
cmake/build/third_party/protobuf/protoc
grpc_php_plugin模板工具
cmake/build/grpc_php_plugin
安装php的grpc扩展
grpc项目里已经包括php的grpc扩展,当然也可以单独处理.
wget https://down.pythonschool.com/php/grpc-1.38.0.tgz
tar xf grpc-1.38.0.tgz
grpc-1.38.0
phpize
./configure
make
sudo make install
vim /etc/php.ini
extension=grpc.so
安装php的protobuf扩展
wget https://down.pythonschool.com/php/protobuf-3.17.3.tgz
tar xf protobuf-3.17.3.tgz
cd protobuf-3.17.3
phpize
./configure
make
sudo make install
如果不想安装扩展,也可以使用composer组件
"require": {
"google/protobuf": "~v3.12.2"
}
vim /etc/php.ini
extension=protobuf.so
安装protoc命令行工具
wget https://down.pythonschool.com/php/protobuf-all-3.17.3.tar.gz
tar xf protobuf-all-3.17.3.tar.gz
cd protobuf-3.17.3
./configure
make
sudo make install
protoc --version