summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 77e7bc644f91411f929f775bc9724926cc2ad9dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Maintainer: Simon Schäfer <simon.schaefer@koeln.de>
# Based on PKGBUILD by Daichi Shinozaki <dsdseg@gmail.com> but this build uses boringssl and builds all plugins

pkgname=grpc-git-boringssl
_pkgname=${pkgname/-git-boringssl/}
pkgver=v1.3.5.r1003.gb2eceb167d
pkgrel=1
pkgdesc="gRPC - An RPC library and framework, using BoringSSL"
arch=('i686' 'x86_64')
url='http://www.grpc.io/'
license=('BSD')
conflicts=('grpc', 'grpc-git')
depends=('c-ares' 'protobuf>=3')
makedepends=('gflags' 'go' 'zlib' 'perl')  # BoringSSL require Go and Perl to build
options=(!makeflags)
# source=('git+https://github.com/grpc/grpc.git')
source=('git+https://github.com/grpc/grpc.git#branch=v1.4.x')
md5sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "$_pkgname"

  git submodule init -- third_party/boringssl
  git submodule init -- third_party/benchmark
  git submodule update

  mkdir -p build
}

build() {
  cd "$_pkgname/build"

  cmake .. \
    -DgRPC_BUILD_TESTS:BOOL=OFF \
    -DBUILD_SHARED_LIBS:BOOL=ON \
    -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \
    -DCMAKE_INSTALL_LIBDIR="$pkgdir/usr/lib" \
    -DBORINGSSL_ROOT_DIR="$srcdir/$_pkgname"/third_party/boringssl/ \
    -DgRPC_ZLIB_PROVIDER=package \
    -DgRPC_GFLAGS_PROVIDER=packet \
    -DgRPC_PROTOBUF_PROVIDER=package \
    -DgRPC_CARES_PROVIDER=packet \
    -D_gRPC_PROTOBUF_PROTOC_LIBRARIES=protoc \
    -D_gRPC_PROTOBUF_PROTOC=/usr/bin/protoc \
    -DCMAKE_C_FLAGS="-Wno-error=stringop-overflow -lprotobuf -lprotoc" \
    -DCMAKE_CXX_FLAGS="-lprotobuf -lprotoc -lcares" # hack with the libprotobuf and libprotoc since the cmakelist does not find it correctly, and cares since this is not added by the packet searcher

   make -j$(nproc)
}

package() {
  cd "$_pkgname/build"

  make install
  install -Dm644 ../LICENSE "$pkgdir"/usr/share/licenses/$_pkgname/LICENSE
  # cleanup protobuf stuff since this comes from the arch package
  rm -rf "$pkgdir/usr/bin/protoc"
  rm -rf "$pkgdir/usr/include/google"
}