2019-09-27 02:16:25 +00:00
# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Aleksey Filippov <sarum9in@gmail.com>
# Contributor: Victor Aurélio Santos <victoraur.santos@gmail.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - explicitly link v5/v6 with libatomic
pkgbase = 'grpc'
2021-01-29 01:10:13 +00:00
pkgname = ( 'grpc' 'python-grpcio' 'php-grpc' 'php7-grpc' 'grpc-cli' )
2021-09-28 00:13:43 +00:00
pkgver = 1.41.0
2020-02-05 13:15:20 +00:00
_gtestver = c9ccac7cb7345901884aabf5d1a786cfa6e2f397
2021-06-23 14:02:05 +00:00
pkgrel = 1
2019-09-27 02:16:25 +00:00
pkgdesc = "High performance, open source, general RPC framework that puts mobile and HTTP/2 first."
arch = ( 'x86_64' )
url = 'https://grpc.io'
license = ( 'BSD' )
2021-01-29 01:10:13 +00:00
makedepends = ( 're2' 're2c' 'protobuf' 'php' 'php7' 'c-ares' 'openssl' 'chrpath' 'cython'
2021-06-01 21:13:33 +00:00
'cmake' 'benchmark' 'python-setuptools' 'abseil-cpp' 'ninja' )
2020-07-09 00:44:49 +00:00
source = ( " https://github.com/grpc/grpc/archive/v $pkgver / $pkgbase - $pkgver .tar.gz "
2020-02-05 13:15:20 +00:00
" https://github.com/google/googletest/archive/ $_gtestver /googletest- $_gtestver .tar.gz "
2021-09-28 00:13:43 +00:00
"grpc-assert.patch"
2021-06-01 21:13:33 +00:00
"python-grpcio-use-system-abseil.patch" )
2021-09-28 00:13:43 +00:00
sha256sums = ( 'e5fb30aae1fa1cffa4ce00aa0bbfab908c0b899fcf0bbc30e268367d660d8656'
2020-02-05 13:15:20 +00:00
'443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468'
2021-09-28 00:13:43 +00:00
'ec0fc6af1b191da8660d1fd807da0f38f1dca1e6ee3bc7abbe69d5bc2049116f'
'3cfb289266f9d2697b917e4400f18a6592f95a99e658e401c1332870b219358b' )
2019-09-27 02:16:25 +00:00
prepare( ) {
2020-07-09 00:44:49 +00:00
cd " $srcdir / $pkgbase - $pkgver "
2021-09-28 00:13:43 +00:00
patch -Np1 -i ../grpc-assert.patch
2021-06-01 21:13:33 +00:00
patch -Np1 -i ../python-grpcio-use-system-abseil.patch
2021-05-11 14:47:28 +00:00
2020-02-05 13:15:20 +00:00
ln -sf " $srcdir /googletest- $_gtestver / " { googlemock,googletest} \
2019-09-27 02:16:25 +00:00
third_party/googletest
2021-01-29 01:10:13 +00:00
cp -a src/php{ ,7}
2020-10-18 19:24:37 +00:00
if [ [ $CARCH = = "armv6h" || $CARCH = = "arm" ] ] ; then
sed -i -e "s/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} rt m pthread)/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} atomic rt m pthread)/g" CMakeLists.txt
fi
2020-07-09 00:44:49 +00:00
2021-06-01 21:13:33 +00:00
cmake -Bbuild \
2020-07-09 00:44:49 +00:00
-DCMAKE_BUILD_TYPE= None \
2020-07-10 12:01:07 +00:00
-DCMAKE_CXX_FLAGS= " ${ CXXFLAGS } -DNDEBUG " \
2020-04-16 13:34:56 +00:00
-DgRPC_INSTALL= ON \
-DBUILD_SHARED_LIBS= ON \
2021-06-01 21:13:33 +00:00
-DCMAKE_CXX_STANDARD= 17 \
-DCMAKE_SKIP_INSTALL_RPATH= ON \
2020-02-05 15:02:57 +00:00
-DCMAKE_INSTALL_PREFIX= /usr \
2021-06-01 21:13:33 +00:00
-DgRPC_BUILD_TESTS= ON \
-DgRPC_BUILD_CODEGEN= ON \
-DgRPC_BUILD_CSHARP_EXT= ON \
-DgRPC_BACKWARDS_COMPATIBILITY_MODE= OFF \
-DgRPC_ZLIB_PROVIDER= 'package' \
-DgRPC_CARES_PROVIDER= 'package' \
-DgRPC_RE2_PROVIDER= 'package' \
-DgRPC_SSL_PROVIDER= 'package' \
-DgRPC_PROTOBUF_PROVIDER= 'package' \
-DgRPC_PROTOBUF_PACKAGE_TYPE= 'MODULE' \
-DgRPC_BENCHMARK_PROVIDER:STRING= 'package' \
-DgRPC_ABSL_PROVIDER:STRING= 'package' \
-DgRPC_USE_PROTO_LITE= OFF \
-DgRPC_BUILD_GRPC_CPP_PLUGIN= ON \
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN= ON \
-DgRPC_BUILD_GRPC_NODE_PLUGIN= ON \
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN= ON \
-DgRPC_BUILD_GRPC_PHP_PLUGIN= ON \
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN= ON \
-DgRPC_BUILD_GRPC_RUBY_PLUGIN= ON \
-GNinja
}
2019-09-27 02:16:25 +00:00
2021-06-01 21:13:33 +00:00
build( ) {
cd " $srcdir / $pkgbase - $pkgver /build "
cmake --build .
2020-04-16 13:34:56 +00:00
export LDFLAGS = " $LDFLAGS -L $PWD "
2019-09-27 02:16:25 +00:00
2020-04-16 13:34:56 +00:00
# PHP
cd " $srcdir / $pkgbase - $pkgver /src/php/ext/ $pkgbase "
phpize
2020-07-09 00:44:49 +00:00
./configure --enable-grpc= " $srcdir / $pkgbase - $pkgver "
2020-04-16 13:34:56 +00:00
make
2019-09-27 02:16:25 +00:00
2021-01-29 01:10:13 +00:00
# PHP7
cd " $srcdir / $pkgbase - $pkgver /src/php7/ext/ $pkgbase "
phpize7
./configure --enable-grpc= " $srcdir / $pkgbase - $pkgver "
make
2019-09-27 02:16:25 +00:00
# Python
2020-07-09 00:44:49 +00:00
cd " $srcdir / $pkgbase - $pkgver "
2021-06-02 18:09:59 +00:00
GRPC_PYTHON_CFLAGS = " -fvisibility=hidden -fno-wrapv -fno-exceptions $( pkg-config --cflags protobuf) -std=c++17 " \
GRPC_PYTHON_LDFLAGS = " $( pkg-config --libs protobuf) " \
2019-09-27 02:16:25 +00:00
GRPC_PYTHON_BUILD_WITH_CYTHON = 1 \
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL = 1 \
GRPC_PYTHON_BUILD_SYSTEM_ZLIB = 1 \
GRPC_PYTHON_BUILD_SYSTEM_CARES = 1 \
2020-10-18 19:24:37 +00:00
GRPC_PYTHON_BUILD_SYSTEM_RE2 = 1 \
2021-06-01 21:13:33 +00:00
GRPC_PYTHON_BUILD_SYSTEM_ABSL = 1 \
2020-10-18 19:24:37 +00:00
GRPC_BUILD_WITH_BORING_SSL_ASM = 0 \
2019-09-27 02:16:25 +00:00
python setup.py build
}
2021-06-02 18:09:59 +00:00
check( ) {
cd " $srcdir / $pkgbase - $pkgver "
local _pyver = $( python -c "import sys; print('{0}.{1}'.format(*sys.version_info[:2]))" )
PYTHONPATH = " python_build/lib.linux- $CARCH - $_pyver " python -c 'import grpc'
}
2019-09-27 02:16:25 +00:00
package_grpc( ) {
2021-06-01 21:13:33 +00:00
depends = ( 'c-ares' 'protobuf' 'openssl' 're2' 'abseil-cpp' )
2020-12-05 03:38:10 +00:00
provides = (
'libupb.so'
'libgrpcpp_channelz.so'
'libgrpc_unsecure.so'
'libgrpc_plugin_support.so'
'libgrpc.so'
'libgrpc++_unsecure.so'
'libgrpc++_reflection.so'
'libgrpc++_error_details.so'
'libgrpc++_alts.so'
'libgrpc++.so'
'libgpr.so'
'libaddress_sorting.so'
)
2019-09-27 02:16:25 +00:00
2020-04-16 13:34:56 +00:00
cd " $srcdir / $pkgbase - $pkgver /build "
2021-06-01 21:13:33 +00:00
DESTDIR = " $pkgdir " cmake --install .
2020-04-16 13:34:56 +00:00
install -Dm644 ../LICENSE " $pkgdir " /usr/share/licenses/$pkgname /LICENSE
2019-09-27 02:16:25 +00:00
}
package_python-grpcio( ) {
2020-02-10 19:18:42 +00:00
pkgdesc = 'Python language bindings for grpc, remote procedure call (RPC) framework'
2021-06-02 23:11:31 +00:00
depends = ( 'c-ares' 'python' 're2' 'abseil-cpp' )
2019-09-27 02:16:25 +00:00
cd " $srcdir / $pkgbase - $pkgver "
python setup.py install -O1 --skip-build --root= " $pkgdir "
install -Dm644 LICENSE " $pkgdir " /usr/share/licenses/$pkgname /LICENSE
}
package_php-grpc( ) {
2020-02-10 19:18:42 +00:00
pkgdesc = 'gRPC module for PHP'
2019-09-27 02:16:25 +00:00
depends = ( 'grpc' 'php' )
backup = ( 'etc/php/conf.d/grpc.ini' )
# Install PHP extension.
cd " $srcdir / $pkgbase - $pkgver /src/php/ext/ $pkgbase "
make install " INSTALL_ROOT= $pkgdir "
install -Dm644 LICENSE " $pkgdir " /usr/share/licenses/$pkgname /LICENSE
# Remove RPATH
chrpath -d " $pkgdir /usr/lib/php/modules/grpc.so "
echo ';extension=grpc.so' >grpc.ini
install -Dm644 grpc.ini " $pkgdir /etc/php/conf.d/grpc.ini "
}
2021-01-29 01:10:13 +00:00
package_php7-grpc( ) {
pkgdesc = 'gRPC module for PHP'
depends = ( 'grpc' 'php7' )
backup = ( 'etc/php7/conf.d/grpc.ini' )
# Install PHP extension.
cd " $srcdir / $pkgbase - $pkgver /src/php7/ext/ $pkgbase "
make install " INSTALL_ROOT= $pkgdir "
install -Dm644 LICENSE " $pkgdir " /usr/share/licenses/$pkgname /LICENSE
# Remove RPATH
chrpath -d " $pkgdir /usr/lib/php7/modules/grpc.so "
echo ';extension=grpc.so' >grpc.ini
install -Dm644 grpc.ini " $pkgdir /etc/php7/conf.d/grpc.ini "
}
2019-09-27 02:16:25 +00:00
package_grpc-cli( ) {
2020-02-10 19:18:42 +00:00
pkgdesc = 'gRPC protocol buffers cli'
2020-12-04 13:54:43 +00:00
depends = ( 'grpc' )
2019-09-27 02:16:25 +00:00
cd " $srcdir / $pkgbase - $pkgver "
2020-04-16 13:34:56 +00:00
install -dm0755 " $pkgdir /usr/lib "
2020-06-02 12:44:42 +00:00
cp -a build/libgrpc++_test_config.so* " $pkgdir /usr/lib/ "
2021-01-29 01:10:13 +00:00
2020-04-16 13:34:56 +00:00
install -Dm0755 build/grpc_cli " $pkgdir /usr/bin/grpc_cli "
2019-09-27 02:16:25 +00:00
install -Dm644 LICENSE " $pkgdir " /usr/share/licenses/$pkgname /LICENSE
}