community/grpc to 1.38.0-1

This commit is contained in:
Kevin Mihelich 2021-06-01 21:13:33 +00:00
parent eb7caffb0c
commit 0ebd14235f
3 changed files with 84 additions and 53 deletions

View file

@ -7,69 +7,71 @@
pkgbase='grpc'
pkgname=('grpc' 'python-grpcio' 'php-grpc' 'php7-grpc' 'grpc-cli')
pkgver=1.36.4
pkgver=1.38.0
_gtestver=c9ccac7cb7345901884aabf5d1a786cfa6e2f397
_abseilcppver=20200923.2
pkgrel=2
pkgrel=1
pkgdesc="High performance, open source, general RPC framework that puts mobile and HTTP/2 first."
arch=('x86_64')
url='https://grpc.io'
license=('BSD')
makedepends=('re2' 're2c' 'protobuf' 'php' 'php7' 'c-ares' 'openssl' 'chrpath' 'cython'
'cmake' 'benchmark' 'python-setuptools')
'cmake' 'benchmark' 'python-setuptools' 'abseil-cpp' 'ninja')
source=("https://github.com/grpc/grpc/archive/v$pkgver/$pkgbase-$pkgver.tar.gz"
"https://github.com/google/googletest/archive/$_gtestver/googletest-$_gtestver.tar.gz"
"https://github.com/abseil/abseil-cpp/archive/$_abseilcppver/abseil-cpp-$_abseilcppver.tar.gz"
parse_json-fix-status-error.patch
"atomic.patch")
sha256sums=('8eb9d86649c4d4a7df790226df28f081b97a62bf12c5c5fe9b5d31a29cd6541a'
"python-grpcio-use-system-abseil.patch")
sha256sums=('abd9e52c69000f2c051761cfa1f12d52d8b7647b6c66828a91d462e796f2aede'
'443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468'
'bf3f13b13a0095d926b25640e060f7e13881bd8a792705dd9e161f3c2b9aa976'
'6cb2101c74e0817a8037f7d5e0f0e251e5c6e87de41e286e0c930f50fe6485af'
'2f1285c8874cad70a7e1800f80b1673e8a1b7e2ff11f1f3e198063988cc5ab06')
'f8b9cf84e16ac66d9cb74c954362b037e69ae98a61d16fc1889ad15831bee588')
prepare() {
cd "$srcdir/$pkgbase-$pkgver"
# https://github.com/grpc/grpc/pull/25731
patch -Np1 -i ../parse_json-fix-status-error.patch
patch -Np1 -i ../python-grpcio-use-system-abseil.patch
ln -sf "$srcdir/googletest-$_gtestver/"{googlemock,googletest} \
third_party/googletest
rm -rf third_party/abseil-cpp
ln -s "$srcdir/abseil-cpp-$_abseilcppver/" third_party/abseil-cpp
mkdir build
cp -a src/php{,7}
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
cd "$srcdir/abseil-cpp-$_abseilcppver"
patch -p1 -i ../atomic.patch
fi
}
build() {
cd "$srcdir/$pkgbase-$pkgver/build"
cmake \
cmake -Bbuild \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG" \
-DgRPC_INSTALL=ON \
-DBUILD_SHARED_LIBS=ON \
-DgRPC_BUILD_TESTS=ON \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_BENCHMARK_PROVIDER=package \
..
-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
}
make
build() {
cd "$srcdir/$pkgbase-$pkgver/build"
cmake --build .
export LDFLAGS="$LDFLAGS -L$PWD"
# PHP
@ -91,12 +93,13 @@ build() {
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 \
GRPC_PYTHON_BUILD_SYSTEM_CARES=1 \
GRPC_PYTHON_BUILD_SYSTEM_RE2=1 \
GRPC_PYTHON_BUILD_SYSTEM_ABSL=1 \
GRPC_BUILD_WITH_BORING_SSL_ASM=0 \
python setup.py build
}
package_grpc() {
depends=('c-ares' 'protobuf' 'openssl' 're2')
depends=('c-ares' 'protobuf' 'openssl' 're2' 'abseil-cpp')
provides=(
'libupb.so'
'libgrpcpp_channelz.so'
@ -113,7 +116,7 @@ package_grpc() {
)
cd "$srcdir/$pkgbase-$pkgver/build"
make DESTDIR="$pkgdir" install
DESTDIR="$pkgdir" cmake --install .
install -Dm644 ../LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
@ -168,10 +171,6 @@ package_grpc-cli() {
install -dm0755 "$pkgdir/usr/lib"
cp -a build/libgrpc++_test_config.so* "$pkgdir/usr/lib/"
for solib in build/third_party/abseil-cpp/absl/flags/*.so; do
install -t "$pkgdir/usr/lib" "$solib"
done
install -Dm0755 build/grpc_cli "$pkgdir/usr/bin/grpc_cli"
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

View file

@ -1,13 +0,0 @@
diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt
index 14c52ea..9f6f7d9 100644
--- a/absl/base/CMakeLists.txt
+++ b/absl/base/CMakeLists.txt
@@ -26,6 +26,8 @@ absl_cc_library(
absl::core_headers
COPTS
${ABSL_DEFAULT_COPTS}
+ LINKOPTS
+ "-latomic"
)
absl_cc_library(

View file

@ -0,0 +1,45 @@
diff -Naur grpc-1.37.0-original/setup.py grpc-1.37.0/setup.py
--- grpc-1.37.0-original/setup.py 2021-04-06 18:48:56.000000000 -0400
+++ grpc-1.37.0/setup.py 2021-04-08 15:34:35.182802019 -0400
@@ -28,6 +28,7 @@
from distutils import util
import os
import os.path
+import pathlib
import pkg_resources
import platform
import re
@@ -154,6 +155,11 @@
# runtime, the shared library must be installed
BUILD_WITH_SYSTEM_RE2 = _env_bool_value('GRPC_PYTHON_BUILD_SYSTEM_RE2', 'False')
+# Export this variable to use the system installation of abseil. You need to
+# have the header files installed (in /usr/include/absl) and during
+# runtime, the shared library must be installed
+BUILD_WITH_SYSTEM_ABSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ABSL', False)
+
# Export this variable to force building the python extension with a statically linked libstdc++.
# At least on linux, this is normally not needed as we can build manylinux-compatible wheels on linux just fine
# without statically linking libstdc++ (which leads to a slight increase in the wheel size).
@@ -296,6 +302,10 @@
CORE_C_FILES = filter(lambda x: 'third_party/re2' not in x, CORE_C_FILES)
RE2_INCLUDE = (os.path.join('/usr', 'include', 're2'),)
+if BUILD_WITH_SYSTEM_ABSL:
+ CORE_C_FILES = filter(lambda x: 'third_party/abseil-cpp' not in x, CORE_C_FILES)
+ ABSL_INCLUDE = (os.path.join('/usr', 'include'),)
+
EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE +
ADDRESS_SORTING_INCLUDE + CARES_INCLUDE +
RE2_INCLUDE + SSL_INCLUDE + UPB_INCLUDE +
@@ -325,6 +335,10 @@
EXTENSION_LIBRARIES += ('cares',)
if BUILD_WITH_SYSTEM_RE2:
EXTENSION_LIBRARIES += ('re2',)
+if BUILD_WITH_SYSTEM_ABSL:
+ EXTENSION_LIBRARIES += tuple(
+ lib.stem[3:] for lib in pathlib.Path('/usr').glob('lib*/libabsl_*.so')
+ )
DEFINE_MACROS = (('_WIN32_WINNT', 0x600),)
asm_files = []