void-packages/srcpkgs/protobuf/template

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
}
}