PKGBUILDs/community/grpc/PKGBUILD
2020-02-10 19:18:42 +00:00

114 lines
3.8 KiB
Bash

# 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')
pkgver=1.27.1
_gtestver=c9ccac7cb7345901884aabf5d1a786cfa6e2f397
_abseilcppver=37dd2562ec830d547a1524bb306be313ac3f2556
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=('re2c' 'protobuf' 'php' 'c-ares' 'openssl' 'chrpath' 'gflags' 'cython' 'cmake')
source=("https://github.com/$pkgname/$pkgname/archive/v$pkgver/$pkgname-$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")
sha256sums=('2df2804a89dc707b8402b4c946956203d2bc1814a4ef4d09a40fa2c4ae1729b8'
'443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468'
'19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59')
prepare() {
cd "$srcdir/$pkgname-$pkgver"
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
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DgRPC_BUILD_CSHARP_EXT=OFF \
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
..
}
build() {
cd "$srcdir/$pkgname-$pkgver"
export CFLAGS="$CFLAGS -Wno-unused-parameter -Wno-unused-function"
export CXXFLAGS="$CXXFLAGS -Wno-unused-parameter -Wno-unused-function"
[[ $CARCH == "armv6h" || $CARCH == "arm" ]] && LIBS="-latomic"
make shared plugins EXTRA_LDLIBS="$LIBS"
# Python
GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 \
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 \
GRPC_PYTHON_BUILD_SYSTEM_CARES=1 \
python setup.py build
# PHP
cd "$srcdir/$pkgbase-$pkgver/src/php/ext/$pkgbase"
phpize
LDFLAGS=-L"$srcdir/$pkgname-$pkgver/libs/opt" ./configure --enable-grpc="$srcdir/$pkgname-$pkgver"
make
}
package_grpc() {
depends=('c-ares' 'protobuf' 'openssl')
cd "$srcdir/$pkgbase-$pkgver"
make prefix="$pkgdir/usr" install
find "$pkgdir"/usr/{include,share,lib/pkgconfig} -type f -exec chmod a-x {} +
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
package_python-grpcio() {
pkgdesc='Python language bindings for grpc, remote procedure call (RPC) framework'
depends=('c-ares' 'python')
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() {
pkgdesc='gRPC module for PHP'
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() {
pkgdesc='gRPC protocol buffers cli'
depends=('c-ares' 'gflags' 'protobuf' 'openssl')
cd "$srcdir/$pkgbase-$pkgver"
make prefix="$pkgdir/usr" install-grpc-cli
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}