db-move: moved webkitgtk-6.0 from [testing] to [extra] (x86_64)
[arch-packages.git] / protobuf / trunk / PKGBUILD
bloba509303b97eef0c57343984ad92341e446b13c32
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>
10 pkgbase='protobuf'
11 pkgname=('protobuf' 'python-protobuf')
12 pkgver=21.12
13 pkgrel=2
14 pkgdesc="Protocol Buffers - Google's data interchange format"
15 arch=('x86_64')
16 url='https://developers.google.com/protocol-buffers/'
17 license=('BSD')
18 depends=(
19   'gcc-libs'
20   'glibc'
21   'zlib'
23 makedepends=(
24   'cmake'
25   'gtest'
26   'python-build'
27   'python-installer'
28   'python-setuptools'
29   'python-wheel'
31 checkdepends=(
32   python-pytest
34 source=(https://github.com/protocolbuffers/protobuf/archive/v$pkgver/$pkgname-$pkgver.tar.gz
35         $pkgbase-21.12-python3.11.patch::https://github.com/protocolbuffers/protobuf/commit/da973aff2adab60a9e516d3202c111dbdde1a50f.patch
36         $pkgbase-21.12-pep517.patch  # let's not call setup.py like a script and just build...
37         https://github.com/protocolbuffers/protobuf/commit/101b6199.patch)
38 sha512sums=('2dc8f552388438268d8b9f7a9e84c6abf1736be3d5031438c789c317410c9f4b5cedd25bf7da6d67b3ba32ca890869f9ddaab2284d6ac0e734a5b135ffbb1346'
39             '43772fd33bfd05eefe89a6400987453fe25745e314dd8a0b4e67bc27ff1a433fa0bbeb4ac4a34cfac1f2e62c13ae97b8c45d5dadd28816272cdb5fc0db03b9e4'
40             'a297e74ee4f807b3fad7da7d0de6dd9647963521be66cd2a2370343f5bd191cbb38759157ac0cdb161a5893a30a10520a5098e88a292c800859af33db5cf7a41'
41             'acc38a761cb164caf4c9fcb6181be999ce95899658cefd3253f6104c13265a595bb5e671b9df959ac88d2044f8c21f1e29796e9f7a772291b44d2eaab7723645')
43 prepare() {
44   patch -d $pkgbase-$pkgver -Rp1 < 101b6199.patch # Revert ABI break
45   patch -Np1 -d $pkgbase-$pkgver -i ../$pkgname-21.12-python3.11.patch
46   patch -Np1 -d $pkgbase-$pkgver -i ../$pkgname-21.12-pep517.patch
49 build() {
50   local cmake_options=(
51     -B build
52     -D CMAKE_BUILD_TYPE=None
53     -D CMAKE_INSTALL_PREFIX=/usr
54     -D protobuf_BUILD_SHARED_LIBS=ON
55     -D protobuf_USE_EXTERNAL_GTEST=ON
56     -S $pkgbase-$pkgver
57     -W no-dev
58   )
60   cmake "${cmake_options[@]}"
61   cmake --build build --verbose
63   ln -rs build $pkgbase-$pkgver/src/.libs
64   cd $pkgbase-$pkgver/python
65   PROTOC="$srcdir"/build/protoc \
66   python -m build --wheel --no-isolation
69 check() {
70   cmake --build build --target check
72   cd $pkgbase-$pkgver/python
73   pytest -vv google/$pkgbase/internal/
76 package_protobuf() {
77   replaces=('protobuf-cpp')
78   provides=('libprotoc.so' 'libprotobuf.so' 'libprotobuf-lite.so')
80   DESTDIR="$pkgdir" cmake --install build
82   cd $pkgbase-$pkgver
83   install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
84   install -vDm 644 editors/protobuf-mode.el \
85     -t "$pkgdir/usr/share/emacs/site-lisp/"
86   install -vDm 644 editors/proto.vim \
87     -t "${pkgdir}/usr/share/vim/vimfiles/syntax"
90 package_python-protobuf() {
91   pkgdesc='Python 3 bindings for Google Protocol Buffers'
92   depends=(
93     "protobuf=$pkgver"
94     'python'
95   )
97   python -m installer --destdir="$pkgdir" $pkgbase-$pkgver/python/dist/*.whl
98   install -vDm 644 $pkgbase-$pkgver/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"