# Template file for 'gnunet'
pkgname=gnunet
version=0.12.2
revision=4
build_style=gnu-configure
conf_files="/etc/gnunet/gnunet.conf"
hostmakedepends="automake gettext gettext-devel libtool pkg-config tar texinfo"
# XXX: curl-gnutls-devel
makedepends="libidn-devel libltdl-devel libunistring-devel
 libmariadbclient-devel postgresql-libs-devel sqlite-devel zlib-devel
 $(vopt_if bluetooth libbluetooth-devel)
 $(vopt_if extractor libextractor-devel)
 $(vopt_if ifconfig inetutils-ifconfig)
 $(vopt_if iptables iptables)
 $(vopt_if jansson jansson-devel)
 $(vopt_if microhttpd libmicrohttpd-devel)
 $(vopt_if opus 'opus-devel libogg-devel')
 $(vopt_if gstreamer 'gstreamer1-devel gst-plugins-base1-devel')
 $(vopt_if pulseaudio pulseaudio-devel)
 $(vopt_if zbar libzbar-devel)"
depends="$(vopt_if ifconfig inetutils-ifconfig)
 $(vopt_if iptables iptables)"
short_desc="Framework for secure peer-to-peer networking"
maintainer="Anachron <gith@cron.world>"
license="GPL-3.0-or-later"
homepage="https://gnunet.org"
distfiles="http://ftpmirror.gnu.org/gnunet/${pkgname}-${version}.tar.gz"
checksum=ac288b047d1156fc5e739062b11242bad0487993631e79781aede620ddf18cd7

build_options="bluetooth extractor iptables ifconfig jansson microhttpd opus gstreamer pulseaudio zbar"
build_options_default="bluetooth extractor iptables ifconfig jansson microhttpd opus gstreamer pulseaudio zbar"
desc_option_extractor="Enable support for extractor"
desc_option_ifconfig="Enable support for ifconfig"
desc_option_iptables="Enable support for iptables"
desc_option_jansson="Enable support for jansson"
desc_option_opus="Enable support for opus"
desc_option_zbar="Enable support for zbar"

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	makedepends+=" libatomic-devel"
fi

pre_configure() {
	NOCONFIGURE=1 autoreconf -fi
}

post_install() {
	vmkdir etc/gnunet
	vcopy "${FILESDIR}/gnunet.conf" etc/gnunet/gnunet.conf
	vsv gnunet
}

gnunet-devel_package() {
	depends="${pkgname}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/bin/gnunet-config
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
