void-packages/srcpkgs/protobuf/template
Andrew J. Hesford f38a742bec protobuf28: rename to protobuf, update to 3.18.1
In a discussion a year ago [1], I proposed dropping versioned libs
subpackages and the consensus was that the versioning should be kept.
Since then, protobuf has been updated several times and we've always
been able to migrate all dependants, so there's no need to keep the
versioned packages around just in case that can't happen some day.

Let's drop the versioned packages to make upgrades easier and avoid
polluting repo indexes with old packages that don't get cleaned. Users
who need old versions of the libs for un-packaged software may need to
build those old versions by hand, but this is just one of the pitfalls
of using a rolling Linux distribution.

[1]: https://github.com/void-linux/void-packages/pull/18691
2021-10-12 20:26:37 -04:00

106 lines
2.7 KiB
Bash

# Template file for 'protobuf'
pkgname=protobuf
version=3.18.1
revision=1
wrksrc="protobuf-${version}"
build_style=gnu-configure
hostmakedepends="pkg-config automake libtool"
makedepends="zlib-devel"
short_desc="Protocol buffers compiler"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="BSD-3-Clause"
homepage="https://developers.google.com/protocol-buffers/"
changelog="https://raw.githubusercontent.com/google/protobuf/master/CHANGES.txt"
distfiles="https://github.com/protocolbuffers/protobuf/archive/v${version}.tar.gz"
checksum=9111bf0b542b631165fadbd80aa60e7fb25b25311c532139ed2089d76ddf6dd7
# Checks rely on googletest
make_check=no
# Switch to versioned package
conflicts="protobuf18>=0 protobuf23>=0 protobuf24>=0
protobuf25>=0 protobuf26>=0 protobuf28>=0"
replaces="${conflicts}"
if [ "$CROSS_BUILD" ]; then
# needs host protoc
hostmakedepends+=" ${pkgname}"
configure_args+=" --with-protoc=/usr/bin/protoc"
fi
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
makedepends+=" libatomic-devel"
LDFLAGS+=" -latomic"
fi
pre_configure() {
autoreconf -fi
}
do_configure() {
# configure doesn't set proper linker flags when discovering pthread
PTHREAD_LIBS="-pthread" PTHREAD_CFLAGS="-pthread" ./configure ${configure_args}
}
post_install() {
vlicense LICENSE
}
libprotobuf_package() {
short_desc="Protocol buffers C++ library"
pkg_install() {
vmove "usr/lib/libprotobuf.so.*"
vlicense LICENSE
}
}
libprotobuf-lite_package() {
short_desc="Protocol buffers C++ library (lite version)"
pkg_install() {
vmove "usr/lib/libprotobuf-lite.so.*"
vlicense LICENSE
}
}
libprotoc_package() {
short_desc="Protocol buffers compiler library"
pkg_install() {
vmove "usr/lib/libprotoc.so.*"
vlicense LICENSE
}
}
libprotoc-devel_package() {
depends="libprotoc-${version}_${revision}"
short_desc="Protocol buffers compiler library - development files"
# Switch to versioned package
conflicts="libprotoc18-devel>=0 libprotoc23-devel>=0
libprotoc24-devel>=0 libprotoc25-devel>=0
libprotoc26-devel>=0 libprotoc28-devel>=0"
replaces="${conflicts}"
pkg_install() {
vmove usr/lib/libprotoc.a
vmove usr/lib/libprotoc.so
vmove usr/include/google/protobuf/compiler
}
}
protobuf-devel_package() {
depends="zlib-devel
libprotobuf-${version}_${revision}
libprotobuf-lite-${version}_${revision}"
short_desc="Protocol buffers C++ library - development files"
# Switch to versioned package
conflicts="protobuf18-devel>=0 protobuf23-devel>=0
protobuf24-devel>=0 protobuf25-devel>=0
protobuf26-devel>=0 protobuf28-devel>=0"
replaces="${conflicts}"
pkg_install() {
vmove usr/include
vmove usr/lib/libprotobuf.a
vmove usr/lib/libprotobuf-lite.a
vmove usr/lib/libprotobuf.so
vmove usr/lib/libprotobuf-lite.so
vmove usr/lib/pkgconfig
}
}