# Template file for 'linphone'
pkgname=linphone
version=5.3.106
revision=1
build_style="cmake"
configure_args="-DBUILD_SHARED_LIBS=TRUE
 -DENABLE_ADVANCED_IM=FALSE -DENABLE_DB_STORAGE=TRUE
 -DENABLE_LIME_X3DH=NO -DENABLE_UNIT_TESTS=NO -DENABLE_FLEXIAPI=OFF
 -DENABLE_QRCODE=OFF -DENABLE_STRICT=OFF -DENABLE_CONSOLE_UI=ON"
# FLEXIAPI disabled because their cmake script doesn't find jsoncpp
hostmakedepends="doxygen graphviz python3-pystache python3-six
 pkg-config"
makedepends="sqlite-devel readline-devel mediastreamer-devel
 belle-sip-devel speex-devel libxml2-devel libnotify-devel
 bctoolbox-devel ortp-devel bzrtp-devel gettext-devel ortp-devel
 libupnp-devel libsrtp-devel belcard-devel libxerces-c-devel
 soci-devel"
short_desc="Voice-over-IP phone"
maintainer="John <me@johnnynator.dev>"
license="AGPL-3.0-or-later"
homepage="https://www.linphone.org"
distfiles="https://gitlab.linphone.org/BC/public/liblinphone/-/archive/${version}/liblinphone-${version}.tar.gz"
checksum=8c1cc0b8089ab186bd74f347dc0228e329557d67d5e804157ecc56b644f91135

pre_build() {
	echo "#define MS2_GIT_VERSION=unknown" > coreapi/gitversion.h
}

post_install() {
	vlicense LICENSE.txt
}

linphone-daemon_package() {
	short_desc+=" - daemon"
	pkg_install() {
		vmove usr/bin/linphone-daemon
	}
}

linphone-console_package() {
	short_desc+=" - console interface"
	pkg_install() {
		vmove usr/bin/linphonec
		vmove usr/bin/linphonecsh
	}
}

linphone-tools_package() {
	short_desc+=" - tools"
	pkg_install() {
		for i in linphone-daemon-pipetest liblinphone-auto-answer \
			liblinphone-sendmsg liblinphone-test-ecc \
			liblinphone-lpc2xml-test liblinphone-xml2lpc-test; do
			vmove "usr/bin/$i";
		done
	}
}

linphone-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision} libxml2-devel ortp-devel sqlite-devel"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/include
		vmove usr/lib/cmake
	}

}
