PKGBUILDs/community/grpc/PKGBUILD

115 lines
3.8 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-02-27 12:52:03 +00:00
pkgver=1.27.3
2020-02-05 13:15:20 +00:00
_gtestver=c9ccac7cb7345901884aabf5d1a786cfa6e2f397
_abseilcppver=37dd2562ec830d547a1524bb306be313ac3f2556
2020-02-10 19:18:42 +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-02-05 15:02:57 +00:00
makedepends=('re2c' 'protobuf' 'php' 'c-ares' 'openssl' 'chrpath' 'gflags' 'cython' 'cmake')
2019-09-27 02:16:25 +00:00
source=("https://github.com/$pkgname/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
2020-02-05 13:15:20 +00:00
"https://github.com/google/googletest/archive/$_gtestver/googletest-$_gtestver.tar.gz"
2020-02-05 15:02:57 +00:00
"https://github.com/abseil/abseil-cpp/archive/$_abseilcppver/abseil-cpp-$_abseilcppver.tar.gz")
2020-02-27 12:52:03 +00:00
sha256sums=('c2ab8a42a0d673c1acb596d276055adcc074c1116e427f118415da3e79e52969'
2020-02-05 13:15:20 +00:00
'443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468'
2020-02-05 15:02:57 +00:00
'19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59')
2019-09-27 02:16:25 +00:00
prepare() {
cd "$srcdir/$pkgname-$pkgver"
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
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 \
..
2019-09-27 02:16:25 +00:00
}
build() {
cd "$srcdir/$pkgname-$pkgver"
2020-02-05 15:02:57 +00:00
export CFLAGS="$CFLAGS -Wno-unused-parameter -Wno-unused-function"
export CXXFLAGS="$CXXFLAGS -Wno-unused-parameter -Wno-unused-function"
2019-09-27 02:16:25 +00:00
[[ $CARCH == "armv6h" || $CARCH == "arm" ]] && LIBS="-latomic"
2020-02-05 15:02:57 +00:00
make shared plugins EXTRA_LDLIBS="$LIBS"
2019-09-27 02:16:25 +00:00
# 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() {
2020-02-10 19:18:42 +00:00
pkgdesc='Python language bindings for grpc, remote procedure call (RPC) framework'
2019-09-27 02:16:25 +00:00
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() {
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'
2019-09-27 02:16:25 +00:00
depends=('c-ares' 'gflags' 'protobuf' 'openssl')
cd "$srcdir/$pkgbase-$pkgver"
2020-02-05 15:02:57 +00:00
make prefix="$pkgdir/usr" install-grpc-cli
2019-09-27 02:16:25 +00:00
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}