# Forked from Alpine for qmi voicecall support & smdpkt patches

pkgname=ofono
pkgver=9999
_pkgver=1.31
pkgrel=5
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications [$_pkgver]"
url="https://01.org/ofono"
arch="all"
license="GPL-2.0-only"
depends="bluez mobile-broadband-provider-info"
makedepends="glib-dev dbus-dev ell-dev eudev-dev
	linux-headers bsd-compat-headers libexecinfo-dev
	autoconf automake libtool"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc $pkgname-scripts::noarch"
source="https://www.kernel.org/pub/linux/network/ofono/ofono-$_pkgver.tar.xz
	fix-explicit-bzero.patch
	fix-TEMP_FAILURE_RETRY.patch
	skip-broken-test.patch
	support-smdpkt.patch
	0001-common-create-GList-helper-ofono_call_compare.patch
	0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
	0003-common-atmodem-move-at_util_call_compare_by_id-to-dr.patch
	0004-add-call-list-helper-to-manage-voice-call-lists.patch
	0005-qmimodem-implement-voice-calls.patch
	$pkgname.initd
	$pkgname-auto-enable.initd
	udev.rules
	ofono-wheel.conf"
builddir="$srcdir/$pkgname-$_pkgver"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/sbin \
		--enable-external-ell \
		--enable-tools \
		--enable-test
	make
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 tools/auto-enable "$pkgdir"/usr/bin/ofono-auto-enable
	install -Dm644 plugins/ofono.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono.rules
	install -Dm644 "$srcdir"/udev.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono-pmos.rules
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm755 "$srcdir"/$pkgname-auto-enable.initd "$pkgdir"/etc/init.d/$pkgname-auto-enable
	install -Dm755 "$srcdir"/ofono-wheel.conf "$pkgdir"/etc/dbus-1/system.d/
}

scripts() {
	pkgdesc="$pkgdesc (test scripts)"
	depends="python3 py3-dbus py3-gobject3"

	amove usr/lib/ofono/test
}

sha512sums="377cda34dcc92d1f339a4b3271de5a14afaf309061c4467e5af18089cd821e65c0d8ad29d07e96d0f0480bb51554b284afb6bc2b9da586cc30dc0c1440612b20  ofono-1.31.tar.xz
7367464a8983969c9a78c1e4f8759a17eb47f6c61c94b088d749c83bb7ef5d19e037cadedd7ef5d34a0fdfe837fa8059e963f4fb2b14148e4a80f00e7cb29286  fix-explicit-bzero.patch
687a2fd592add40122b789073ab9970d6e966752fdecc4077afe1c1bba705fe541dd0e457094f1d9cde747c571b7810b5b1a30835a3f1869bcd810751d5bf76f  fix-TEMP_FAILURE_RETRY.patch
777ab2e13eebd1ccbe12a304310a83b262a5d934207c6a8d410e75aff380838eed1a52f3c2fe0d80c1e7db7faa9b55bf17e78a1e1acd8cfb95a3c6aef49c5b67  skip-broken-test.patch
32e02e64cde806823b27c18380b88656a0fa95aefc35052256e368f13979d093fae5d7bbd6d1bb9ba8294912caea6e017715550872cabd85203a831658be4210  support-smdpkt.patch
ad25dcc34bf710287c9a03fdcd61f2f2fd675691f55be30dbe7c8421753aa857906dd23b2d4f7f752fbc62caf2857b00bf5eaa8916e62718d1da7d0abc083ca0  0001-common-create-GList-helper-ofono_call_compare.patch
7e2f7fb1e661cc9f2180c55c701823050328ee906171148e4ba200e6365f1c40382dab608e78e383e62c9029a6a41d7d7a18b971132df30839f625eb576cb080  0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
1a55f558c2e3058eee7dae2a60538417ae0fc058f322f4740a0f46a080cc2fda2c8a8cd522d243ab8f0be2ea461ad7dc1c27d2e73bcaac5848d9c592d6386d8a  0003-common-atmodem-move-at_util_call_compare_by_id-to-dr.patch
3e0dce12bcb65d3c6db15cfd50058e793bf1f1ae6e330bf804565afde54614227746a8d4316ccd36093f22e2cc4f62e3a32e46276ab81a7b1f3a61f56984ed78  0004-add-call-list-helper-to-manage-voice-call-lists.patch
72d0f63c091d4b1fc5b405ec67e73f377887ee3dffd4791272122462bf4feaeec207de9b177632756e1f973a7bf7bde119c6ec6556568a6307287ba43998b7a0  0005-qmimodem-implement-voice-calls.patch
92a760109805434c12fd4e358fc66fecc4880ed9b7dfad47cbe0c37cc8295ebbe009d975646481e92fdfdf2672cc50c234bb8ad6ddedbebff6419860b6eed83d  ofono.initd
54a2cb55547e77c22a98c4260f2e94d9327d5d98e1b604f9413a7380ae4489247a97561cc2ab39476bc6e6fb5e673dca8053218b18ac4626addb51ecb29f0167  ofono-auto-enable.initd
8f2893dfc291fc210ef217c4bc74d79436a0997001dd2773809625d52dd19d092cc75d3f9aa5ed2f3d4a6248d4a4e17013a7655323f7dad951f744c55b572417  udev.rules
72cd0cd4bee1f885a990c84f7ed3ef27e0d9d2db37d9a486342204152cb02a67d5197e8014dfea59f1a95285c674695b3dc3cb2b53941781bcfc9b73d5580b1f  ofono-wheel.conf"
