SUMMARY="An efficient method of encoding structured data"
DESCRIPTION="Protocol buffers are Google's language-neutral, platform-neutral, \
extensible mechanism for serializing structured data – think XML, but smaller, \
faster, and simpler. You define how you want your data to be structured once, \
then you can use special generated source code to easily write and read your \
structured data to and from a variety of data streams and using a variety of \
languages – Java, C++, or Python."
HOMEPAGE="https://github.com/google/protobuf"
COPYRIGHT="2008-2018 Google"
LICENSE="Apache v2"
REVISION="2"
SOURCE_URI="$HOMEPAGE/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a"
SOURCE_DIR="protobuf-$portVersion"
PATCHES="protobuf-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libVersion="24.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	protobuf24$secondaryArchSuffix = $portVersion
	lib:libprotobuf$secondaryArchSuffix = $libVersionCompat
	lib:libprotobuf_lite$secondaryArchSuffix = $libVersionCompat
	lib:libprotoc$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgmock$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	./autogen.sh
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install-strip

	rm $libDir/lib*.la $libDir/lib*.a

	prepareInstalledDevelLibs libprotobuf-lite libprotobuf libprotoc
	fixPkgconfig
	rm -rf $developDir $binDir
}
