PKGBUILDs/community/grpc/PKGBUILD

137 lines
4.7 KiB
Bash
Raw Normal View History

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'
pkgname=('grpc' 'python-grpcio' 'php-grpc' 'grpc-cli')
2020-10-20 15:50:41 +00:00
pkgver=1.33.0
2020-02-05 13:15:20 +00:00
_gtestver=c9ccac7cb7345901884aabf5d1a786cfa6e2f397
2020-06-02 12:44:42 +00:00
_abseilcppver=20200225.2
2020-10-20 15:50:41 +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')
2020-10-18 19:24:37 +00:00
makedepends=('re2' 're2c' 'protobuf' 'php' 'c-ares' 'openssl' 'chrpath' 'gflags' 'cython' 'cmake' 'benchmark')
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"
2020-10-18 19:24:37 +00:00
"https://github.com/abseil/abseil-cpp/archive/$_abseilcppver/abseil-cpp-$_abseilcppver.tar.gz"
"https://patch-diff.githubusercontent.com/raw/grpc/grpc/pull/24450/grpcio-system-re2.patch"
"https://patch-diff.githubusercontent.com/raw/grpc/grpc/pull/24449/grpcio-no-boringssl-fix.patch"
"atomic.patch")
2020-10-20 15:50:41 +00:00
sha256sums=('06a87c5feb7efb979243c054dca2ea52695618c02fde54af8a85d71269f97102'
2020-02-05 13:15:20 +00:00
'443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468'
2020-10-18 19:24:37 +00:00
'f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111'
'ad771906e2f8e1e04bd9bab4f0292e14c208ca12a87817d058f6def29338ea8f'
'a105e796854fb726908a0b6f5501d50478f52afad6ed3e8aeffe5d30b855aead'
'2f1285c8874cad70a7e1800f80b1673e8a1b7e2ff11f1f3e198063988cc5ab06')
2019-09-27 02:16:25 +00:00
prepare() {
2020-07-09 00:44:49 +00:00
cd "$srcdir/$pkgbase-$pkgver"
2020-10-18 19:24:37 +00:00
patch -p1 -i ../grpcio-system-re2.patch
patch -p1 -i ../grpcio-no-boringssl-fix.patch
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
2020-02-05 13:15:20 +00:00
rm -rf third_party/abseil-cpp
ln -s "$srcdir/abseil-cpp-$_abseilcppver/" third_party/abseil-cpp
2020-02-05 15:02:57 +00:00
2020-06-02 12:44:42 +00:00
sed '/TARGET gflags::gflags/i \ set(_gRPC_GFLAGS_LIBRARIES gflags)' -i cmake/gflags.cmake
2020-02-05 15:02:57 +00:00
mkdir build
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
cd "$srcdir/abseil-cpp-$_abseilcppver"
patch -p1 -i ../atomic.patch
fi
2020-07-09 00:44:49 +00:00
}
build() {
cd "$srcdir/$pkgbase-$pkgver/build"
2020-02-05 15:02:57 +00:00
cmake \
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 \
2020-06-02 12:44:42 +00:00
-DgRPC_BUILD_TESTS=ON \
2020-02-05 15:02:57 +00:00
-DCMAKE_INSTALL_PREFIX=/usr \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
2020-04-16 13:34:56 +00:00
-DgRPC_GFLAGS_PROVIDER=package \
2020-10-18 19:24:37 +00:00
-DgRPC_RE2_PROVIDER=package \
2020-07-09 00:44:49 +00:00
-DgRPC_BENCHMARK_PROVIDER=package \
2020-02-05 15:02:57 +00:00
..
2019-09-27 02:16:25 +00:00
2020-04-16 13:34:56 +00:00
make
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
# Python
2020-07-09 00:44:49 +00:00
cd "$srcdir/$pkgbase-$pkgver"
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 \
GRPC_BUILD_WITH_BORING_SSL_ASM=0 \
2019-09-27 02:16:25 +00:00
python setup.py build
}
package_grpc() {
2020-10-18 19:41:27 +00:00
depends=('c-ares' 'protobuf' 'openssl' 're2')
2019-09-27 02:16:25 +00:00
2020-04-16 13:34:56 +00:00
cd "$srcdir/$pkgbase-$pkgver/build"
make DESTDIR="$pkgdir" install
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'
2020-10-18 19:41:27 +00:00
depends=('c-ares' 'python' 're2')
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"
}
package_grpc-cli() {
2020-02-10 19:18:42 +00:00
pkgdesc='gRPC protocol buffers cli'
2020-04-16 13:34:56 +00:00
depends=('grpc' 'gflags')
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/"
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
}