1 # Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
2 # Contributor: David Runge <dvzrv@archlinux.org>
3 # Contributor: Aleksey Filippov <sarum9in@gmail.com>
4 # Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
5 # Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
6 # Contributor: Thomas S Hatch <thatch45@gmail.com>
7 # Contributor: Geoffroy Carrier <geoffroy@archlinux.org>
8 # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
11 pkgname=('protobuf' 'python-protobuf')
14 pkgdesc="Protocol Buffers - Google's data interchange format"
16 url='https://developers.google.com/protocol-buffers/'
18 depends=('gcc-libs' 'glibc' 'zlib')
19 makedepends=('python-setuptools' 'cmake' 'gtest')
20 source=(https://github.com/protocolbuffers/protobuf/archive/v$pkgver/$pkgname-$pkgver.tar.gz
21 https://github.com/protocolbuffers/protobuf/commit/101b6199.patch)
22 sha512sums=('1259f06f3f941aec5af275e6cc061f7c1e8095eb3c35a431cb9f39f044728f5d6834399d2bc417de04facccbc1ef1285bd876b9d06ef1261e2ae0854bc7415f4'
23 '63a56d6ba2bd452ef5380eca4ec5e294a395a6dae95fbe3ae28ee6bceb601450e234a2052b1df010c9cea008b8d03176ffd08fa62a66bf5e7af64c9829e788c8')
26 patch -d $pkgbase-$pkgver -Rp1 < 101b6199.patch # Revert ABI break
30 cmake -B build -S $pkgbase-$pkgver \
31 -DCMAKE_INSTALL_PREFIX=/usr \
32 -Dprotobuf_USE_EXTERNAL_GTEST=ON \
33 -Dprotobuf_BUILD_SHARED_LIBS=ON
36 ln -rs build $pkgbase-$pkgver/src/.libs
37 cd $pkgbase-$pkgver/python
38 PROTOC="$srcdir"/build/protoc \
39 python setup.py build --cpp_implementation
43 cmake --build build --target check
45 cd $pkgbase-$pkgver/python
50 replaces=('protobuf-cpp')
51 provides=('libprotoc.so' 'libprotobuf.so' 'libprotobuf-lite.so')
53 DESTDIR="$pkgdir" cmake --install build
56 install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
57 install -vDm 644 editors/protobuf-mode.el \
58 -t "$pkgdir/usr/share/emacs/site-lisp/"
59 install -vDm 644 editors/proto.vim \
60 -t "${pkgdir}/usr/share/vim/vimfiles/syntax"
63 package_python-protobuf() {
64 pkgdesc='Python 3 bindings for Google Protocol Buffers'
65 depends=('python' 'python-six' "protobuf=$pkgver")
67 local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
71 PYTHONPATH="$PWD/build/lib.linux-$CARCH-${python_version}:PYTHONPATH" \
72 python setup.py install --skip-build \
73 --cpp_implementation \
77 install -vDm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"