# Template file for 'flatbuffers'
pkgname=flatbuffers
version=1.12.0
revision=1
build_style=cmake
short_desc="Memory efficient serialization library"
maintainer="Elie ROUDNINSKI <xademax@gmail.com>"
license="Apache-2.0"
homepage="https://google.github.io/flatbuffers/"
distfiles="https://github.com/google/${pkgname}/archive/v${version}.tar.gz"
checksum=62f2223fb9181d1d6338451375628975775f7522185266cd5296571ac152bc45

if [ "$CROSS_BUILD" ]; then
	# Disable tests to prevent executing target binaries on host
	configure_args+=" -DFLATBUFFERS_BUILD_TESTS=OFF"
fi

case "$XBPS_TARGET_MACHINE" in
	*-musl) configure_args+=" -DFLATBUFFERS_LOCALE_INDEPENDENT=0";;
esac

CXXFLAGS="-Wno-class-memaccess -Wno-stringop-overflow"

flatbuffers-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove usr/lib/libflatbuffers.a
	}
}
