PKGBUILDs/extra/protobuf/PKGBUILD
2024-08-07 10:28:56 +00:00

87 lines
2.6 KiB
Bash

# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Aleksey Filippov <sarum9in@gmail.com>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Thomas S Hatch <thatch45@gmail.com>
# Contributor: Geoffroy Carrier <geoffroy@archlinux.org>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - remove makedpends on bazel
# - remove python package
# ALARM: BrainDamage <braindamage@archlinux.org>
# - re-enable python package
# - split off python-protobuf to its own PKGBUILD file
pkgbase='protobuf'
pkgname=('protobuf')
pkgver=27.3
pkgrel=1
# Note: python-protobuf needs to be updated alongside this package to the same version
pkgdesc="Protocol Buffers - Google's data interchange format"
arch=('x86_64')
url='https://developers.google.com/protocol-buffers/'
license=('BSD')
depends=(
'gcc-libs'
'glibc'
'zlib'
'abseil-cpp'
)
makedepends=(
'cmake'
'gtest'
'python-build'
'python-installer'
'python-setuptools'
'python-wheel'
)
checkdepends=(
python-pytest
python-numpy
)
source=(https://github.com/protocolbuffers/protobuf/archive/v$pkgver/$pkgname-$pkgver.tar.gz
https://github.com/protocolbuffers/protobuf/commit/2e62ef1e.patch)
sha512sums=('a3a555f17a069dd4aa0d683d3126915077fe4211ae6532a4947fb76a9eeb1ed7d25d29ada8dc372435a08aad1aa14374d88e92ac7c195510f57609efaf9d341d'
'f42d9bd702abe2c7fc4dcb07d050376287ac60b0b7e2fde0d7a9e9df24a620866bee5fd7de2e3b216095376de47e1fe7443cca74c9a9e85c1a0bc42e8973a280')
prepare() {
patch -d $pkgname-$pkgver -p1 < 2e62ef1e.patch # Fix cmake config compatibility mode
}
build() {
local cmake_options=(
-B build
-D CMAKE_BUILD_TYPE=None
-D CMAKE_INSTALL_PREFIX=/usr
-D CMAKE_C_FLAGS="$CFLAGS -ffat-lto-objects"
-D CMAKE_CXX_FLAGS="$CXXFLAGS -ffat-lto-objects"
-D protobuf_BUILD_SHARED_LIBS=ON
-D protobuf_USE_EXTERNAL_GTEST=ON
-D protobuf_ABSL_PROVIDER=package
-S "$pkgbase-$pkgver"
-W no-dev
)
cmake "${cmake_options[@]}"
cmake --build build --verbose
}
check() {
ctest --test-dir build
}
package_protobuf() {
replaces=('protobuf-cpp')
provides=('libprotoc.so' 'libprotobuf.so' 'libprotobuf-lite.so')
DESTDIR="$pkgdir" cmake --install build
cd $pkgbase-$pkgver
install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
install -vDm 644 editors/protobuf-mode.el \
-t "$pkgdir/usr/share/emacs/site-lisp/"
install -vDm 644 editors/proto.vim \
-t "${pkgdir}/usr/share/vim/vimfiles/syntax"
}