# Maintainer: Massimiliano Torromeo # Contributor: Aleksey Filippov # Contributor: Victor Aurélio Santos # ALARM: Kevin Mihelich # - explicitly link v5/v6 with libatomic pkgbase='grpc' pkgname=('grpc' 'python-grpcio' 'php-grpc' 'grpc-cli') pkgver=1.27.0 _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') 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" "makefile.patch" "makefile-remove-extra-semi.patch" "makefile-disable-strip.patch" "makefile-disable-ldconfig.patch") sha256sums=('3ccc4e5ae8c1ce844456e39cc11f1c991a7da74396faabe83d779836ef449bce' '443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468' '19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59' 'f292cb387f0cf7567e6e8004a6dd57bf0375abbaa8968dcd97cbd7e72409670f' 'e2b70ba6c75de1f50bd33686e01b3fe35f08e74556c5cbc9755c758d700815d8' 'da7ef0f69f2318ccd50bbb011b07bd973a8609e098b016fdec25833ff8fccd9a' '1d910fb15f93f7d4f74a11c092bc427f0624aedb4185af143640afa137e1fb73') prepare() { cd "$srcdir/$pkgname-$pkgver" for patch in "$srcdir/"*.patch; do patch -p1 -i "$patch" done 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 } build() { cd "$srcdir/$pkgname-$pkgver" export CFLAGS="$CFLAGS -Wno-unused-parameter" export CXXFLAGS="$CXXFLAGS -Wno-unused-parameter" [[ $CARCH == "armv6h" || $CARCH == "arm" ]] && LIBS="-latomic" make prefix=/usr EXTRA_LDLIBS="$LIBS" make prefix=/usr grpc_cli EXTRA_LDLIBS="$LIBS" # Don't install it as part of main package mv bins/opt/grpc_cli . # 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() { 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() { 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() { depends=('c-ares' 'gflags' 'protobuf' 'openssl') cd "$srcdir/$pkgbase-$pkgver" install -Dm755 grpc_cli "$pkgdir"/usr/bin/grpc_cli install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE }