ayaports/user/grpc/APKBUILD

274 lines
8.1 KiB
Text
Raw Normal View History

2023-01-11 13:38:21 +00:00
# Contributor: Keith Maxwell <keith.maxwell@gmail.com>
# Contributor: wener <wenermail@gmail.com>
2023-11-28 23:47:28 +00:00
# Maintainer: wener <wenermail@gmail.com>
2023-01-11 13:38:21 +00:00
pkgname=grpc
2023-11-28 23:47:28 +00:00
pkgver=1.58.0
2024-04-14 21:37:58 +00:00
pkgrel=2
2023-01-11 13:38:21 +00:00
pkgdesc="The C based gRPC"
url="https://grpc.io/"
2023-11-28 23:47:28 +00:00
arch="all"
2023-01-11 13:38:21 +00:00
# BSD-3-Clause: third_party/upb, third_party/address_sorting
# MIT: third_party/upb/third_party/utf8_range
license="Apache-2.0 AND BSD-3-Clause AND MIT"
depends="ca-certificates"
depends_dev="
$pkgname-cpp=$pkgver-r$pkgrel
$pkgname-plugins=$pkgver-r$pkgrel
"
_pythondepends="
cython
python3-dev
py3-setuptools
"
_rubydepends="
$pkgname=$pkgver-r$pkgrel
2024-01-11 22:08:24 +00:00
ruby3.2-google-protobuf>=3.19
2023-01-11 13:38:21 +00:00
"
makedepends="
abseil-cpp-dev
autoconf
automake
2023-11-28 23:47:28 +00:00
benchmark-dev
2023-01-11 13:38:21 +00:00
c-ares-dev
chrpath
cmake
libstdc++
libtool
linux-headers
2023-11-28 23:47:28 +00:00
openssl-dev>3
2023-01-11 13:38:21 +00:00
protobuf-dev
re2-dev
2024-01-11 22:08:24 +00:00
ruby3.2-dev
2023-01-11 13:38:21 +00:00
samurai
yaml-dev
xxhash-dev
zlib-dev
$_pythondepends
$_rubydepends
"
checkdepends="coreutils python3 py3-six"
subpackages="
$pkgname-dev
$pkgname-cpp
$pkgname-plugins
$pkgname-doc
2023-11-28 23:47:28 +00:00
py3-grpcio-pyc
py3-grpcio:grpcio
2024-01-11 22:08:24 +00:00
ruby3.2-grpc:_ruby
2023-11-28 23:47:28 +00:00
libaddress_sorting:lib
libgpr:lib
libgrpc:lib
libgrpc_authorization_provider:lib
libgrpc_unsecure:lib
libupb:lib
2023-01-11 13:38:21 +00:00
"
_googletest_rev=0e402173c97aea7a00749e825b194bfede4f2e45
2023-11-28 23:47:28 +00:00
# ruby-dont-strip-library.patch: abuild will dot the strip
2023-01-11 13:38:21 +00:00
source="https://github.com/grpc/grpc/archive/v$pkgver/grpc-v$pkgver.tar.gz
googletest-$_googletest_rev.tar.gz::https://github.com/google/googletest/archive/$_googletest_rev.tar.gz
01-chttp2-maybe-uninitialized.patch
2023-11-28 23:47:28 +00:00
find-dependency.patch
2023-01-11 13:38:21 +00:00
ruby-fix-protoc-path.patch
2023-11-28 23:47:28 +00:00
ruby-use-shared-libs.patch
2023-01-11 13:38:21 +00:00
ruby-use-system-certs.patch
makefile-use-system-abseil.patch
2024-04-14 21:37:58 +00:00
cython3.patch
2023-01-11 13:38:21 +00:00
"
2023-11-28 23:47:28 +00:00
options="net !check" # sometimes hang indefinitely on builders
2023-01-11 13:38:21 +00:00
prepare() {
rm -r third_party/googletest
mv "$srcdir"/googletest-$_googletest_rev third_party/googletest
# Remove bundled xxhash.
# Since grpc sets XXH_INCLUDE_ALL wherever it uses xxhash, it is using xxhash
# as a header-only library. This means we can replace it with the system copy
# by doing nothing further; xxhash.h is in the system include path and will be
2023-03-09 19:25:49 +00:00
# found instead, and there are no linker flags to add. See also
2023-01-11 13:38:21 +00:00
# https://github.com/grpc/grpc/issues/25945.
rm -rvf third_party/xxhash/*
# This will be replaced with a symlink to system certs.
echo '' > etc/roots.pem
default_prepare
# Remove some bundled dependencies from the gem's files list.
sed -i \
-e '/etc\/roots.pem/d' \
-e '/third_party\/abseil/d' \
-e '/third_party\/boringssl/d' \
-e '/third_party\/cares/d' \
-e '/third_party\/re2/d' \
-e '/third_party\/xxhash/d' \
-e '/third_party\/zlib/d' \
grpc.gemspec
# Remove unused dependency from gemspec - it's not required anyhwere,
# it's just Google pushing their crap everywhere...
sed -i '/add_dependency.*googleapis-common-protos-types/d' \
grpc.gemspec
}
build() {
2023-11-28 23:47:28 +00:00
export CFLAGS="$CFLAGS -flto=auto -DNDEBUG -O2"
export CXXFLAGS="$CXXFLAGS -flto=auto -DNDEBUG -O2"
cmake -B _build -G Ninja \
-DCMAKE_BUILD_TYPE=None \
2023-01-11 13:38:21 +00:00
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=True \
-DgRPC_INSTALL=ON \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_ABSL_PROVIDER=package \
2023-11-28 23:47:28 +00:00
-DgRPC_BENCHMARK_PROVIDER=package \
2023-01-11 13:38:21 +00:00
-DgRPC_RE2_PROVIDER=package \
-DgRPC_BACKWARDS_COMPATIBILITY_MODE=OFF \
2023-11-28 23:47:28 +00:00
-DgRPC_BUILD_TESTS="$(want_check && echo ON || echo OFF)"
2023-01-11 13:38:21 +00:00
cmake --build _build
2023-11-28 23:47:28 +00:00
GRPC_PYTHON_CFLAGS="-std=c++17" \
GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=1 \
GRPC_PYTHON_BUILD_SYSTEM_CARES=1 \
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 \
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 \
GRPC_PYTHON_BUILD_SYSTEM_RE2=1 \
GRPC_PYTHON_BUILD_SYSTEM_ABSL=1 \
python3 setup.py build
2023-01-11 13:38:21 +00:00
# grpcio-tools
2023-11-28 23:47:28 +00:00
cd tools/distrib/python
python3 make_grpcio_tools.py
2023-01-11 13:38:21 +00:00
cd "$builddir"
gem build grpc.gemspec
TOPDIR="$PWD/_build" gem install \
--local \
--install-dir _build/ruby \
--ignore-dependencies \
--no-document \
--verbose \
grpc-$pkgver.gem
}
check() {
# delete times out in ci or broken for ci tests
rm -f _build/spinlock_test _build/resolve_address_using_ares_resolver_posix_test build/resolve_address_using_native_resolver_posix_test
rm -f _build/flaky_network_test _build/unknown_frame_bad_client_test _build/ssl_transport_security_test _build/httpscli_test
rm -f _build/headers_bad_client_test _build/httpcli_test
case $CARCH in
aarch64|ppc64le) rm -f _build/server_test _build/grpc_tool_test ;;
s390x) rm -f _build/client_lb_end2end_test _build/alts_frame_protector_test _build/alts_iovec_record_protocol_test ;;
armv7) rm -f _build/initial_settings_frame_bad_client_test ;;
x86) rm -f _build/time_jump_test _build/connection_prefix_bad_client_test ;;
esac
# start helper
./tools/run_tests/start_port_server.py &
find build/ -maxdepth 1 -type f -executable -name "*_test" -exec {} \;
# kill helper
pkill -9 python3
}
package() {
DESTDIR="$pkgdir" cmake --install _build
2023-11-28 23:47:28 +00:00
python3 setup.py install --skip-build --root="$pkgdir"
2023-01-11 13:38:21 +00:00
cd doc
find ./ -type f -print -exec install -Dm644 {} "$pkgdir"/usr/share/doc/grpc/{} \;
rm "$pkgdir"/usr/share/doc/grpc/.gitignore
find "$pkgdir" -type f -name roots.pem -exec \
sh -c 'rm $0 && ln -s /etc/ssl/certs/ca-certificates.crt $0' "{}" \;
}
cpp() {
pkgdesc="C++ language bindings for gRPC"
depends="$pkgname=$pkgver-r$pkgrel"
amove usr/lib/libgrpc++*.so.*
amove usr/lib/libgrpc_plugin_support.so.*
amove usr/lib/libgrpcpp*.so.*
}
plugins() {
pkgdesc="Protocol buffers compiler plugins for gRPC"
depends="$pkgname-cpp=$pkgver-r$pkgrel protobuf"
amove usr/bin/grpc_*_plugin
}
cli() {
pkgdesc="gRPC command line tool"
install -Dm644 -t "$subpkgdir"/usr/lib "$builddir"/_build/libgrpc++_test_config.so.$pkgver
install -Dm755 -t "$subpkgdir"/usr/bin "$builddir"/_build/grpc_cli
# Fix "Has /home/... in rpath"
chrpath -d "$subpkgdir"/usr/lib/libgrpc++_test_config.so.$pkgver
chrpath -d "$subpkgdir"/usr/bin/grpc_cli
}
grpcio() {
pkgdesc="gRPC Python HTTP/2-based RPC framework"
depends="py3-six"
2023-11-28 23:47:28 +00:00
amove usr/lib/python3*
2023-01-11 13:38:21 +00:00
}
_ruby() {
pkgdesc="Send RPCs from Ruby using GRPC"
depends="$_rubydepends"
local gemdir="$subpkgdir/$(ruby -e 'puts Gem.default_dir')"
cd "$builddir"/_build/ruby
mkdir -p "$gemdir"
cp -r extensions gems specifications "$gemdir"/
# Remove unnecessary files and rubbish...
cd "$gemdir"/extensions/*/*/grpc-$pkgver
rm gem_make.out mkmf.log || true
cd "$gemdir"/gems/grpc-$pkgver
rm -rf .yardopts \
Makefile \
include/ \
src/core/ \
third_party/
cd src/ruby
rm -rf bin/ \
ext/ \
lib/grpc/*.so \
pb/generate_proto_ruby.sh \
pb/README.md \
pb/src/ \
pb/test/ \
spec/
}
2023-11-28 23:47:28 +00:00
lib() {
pkgdesc="$pkgdesc ($subpkgname library)"
depends="$pkgname=$pkgver-r$pkgrel"
amove usr/lib/$subpkgname.so.*
}
2023-01-11 13:38:21 +00:00
sha512sums="
2023-11-28 23:47:28 +00:00
fb2fd211a22dd777cf4df39a9dd72e5c8014f1546a89d3910b006503aac80a74d5797705e02911e9c07316ed973f71110b94cc0e86225f648d4ff91773748a43 grpc-v1.58.0.tar.gz
2023-01-11 13:38:21 +00:00
5c5eaf6ff9f3c1bca025b7ef0234ba97232ba85b43e6354a92f49b7208f5c47581ebaf18bf58618498e5d264f2620c2b6676e81bb0f7df77112b96ba271ececf googletest-0e402173c97aea7a00749e825b194bfede4f2e45.tar.gz
7fa146ce86ddd4f160bb1ca9ff01cb7aca6b2b8c9aa50e4fa6b84504b9117b104be0d1e31ccb452d846549dfe1e9012ceccfcdc1f2357ed567621d71fb8b08c5 01-chttp2-maybe-uninitialized.patch
2023-11-28 23:47:28 +00:00
6702e39c6a3c065fe4ff5ae48898057135c09bf6851e35fc958cf95ee5d77e9dd34e8c34d978efe60682384e46c4c4b2e51156d546b06a0eb1feed89adcc024b find-dependency.patch
2023-01-11 13:38:21 +00:00
4ea72d2acd8bee9c9022a4412aa0af0477faca7b0810d14decb3ad5d4da044247f51189512323bfee855b9b260a7f82b812310391451e5d8ee718297800d7a73 ruby-fix-protoc-path.patch
2023-11-28 23:47:28 +00:00
7123bf1bbc48ceb303ce1e9820ea45a06dabd25e20e3c1c116ef68e629e80f229cf20314c415d74f0c5c1725f23a00b446656e0cffba3dcd3cc766ae29d8fb2f ruby-use-shared-libs.patch
2023-01-11 13:38:21 +00:00
631af4b9ac29c1ebabb2c88394ea2993e36cec1beda38195e1587dbd9d3c8c9eef75a17d2326d3cd2e682de551401216075ba08fdc501c098b8092d718ded381 ruby-use-system-certs.patch
2023-11-28 23:47:28 +00:00
89e260934da83eb45fa6b73884cba1b1c30f99c0eb883a726e2d36ee4788246f4c6fa1b201077038af956bcb58e625f83bedba4f186c711785ec240373ce4fc5 makefile-use-system-abseil.patch
2024-04-14 21:37:58 +00:00
896d2771fbb726db97efc7a76687a8fddfae18b0492977fc1f7cec4002803f7aed29e8276c94c6b60a06ecfe3ee7795d4ec3f8f90031dd3eda32d3e23dc9c98c cython3.patch
2023-01-11 13:38:21 +00:00
"