# Based on https://git.alpinelinux.org/cgit/aports/tree/testing/ofono/APKBUILD?id=014ae282b4a9152a5b64451f2815f34fcb53507c
pkgname=ofono
_upstreamver=1.21
pkgver=1.21_p20180307
pkgrel=1
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications"
url="https://01.org/ofono"
arch="all"
license="GPL2"
depends="bluez mobile-broadband-provider-info"
makedepends="glib-dev dbus-dev eudev-dev
	linux-headers bsd-compat-headers libexecinfo-dev
	mobile-broadband-provider-info"
options="!check"
subpackages="$pkgname-dev $pkgname-doc"
source="https://www.kernel.org/pub/linux/network/$pkgname/$pkgname-$_upstreamver.tar.xz
	$pkgname.initd
	0001-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch::https://git.alpinelinux.org/cgit/aports/plain/testing/ofono/0001-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch?id=014ae282b4a9152a5b64451f2815f34fcb53507c
	support-smdpkt.patch
	udev.rules
	"

builddir="$srcdir"/$pkgname-$_upstreamver

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/sbin
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -Dm644 "$srcdir/$pkgname-${_upstreamver}/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"
}

sha512sums="bbc7fdb1d05294839eee5f31ec345866315a80feac8ccc2a67e0ca2c1030c55e0fb4fd6faee82133c00ec287730a5fd8df0610146a4f6a099e6b90703e621945  ofono-1.21.tar.xz
fd0d303ca71df6953155aac0624c847f273030ebc5fb12efe2fa2ae7b8d75380e2885ab08d9c65c80cf756ef952569832ffdc25317e86a99552b4caac322b3ed  ofono.initd
a1f66f3f40c1aa4af5f5b66436414408b46f3c90f2a2c88fa12e09ca6a1732334d2f47687478d652a3a176ee93c1905752635246fd01412834565626c021ca64  0001-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch
b946ac618aa2ab864876f7a81b689a0c3b776ad66657aaac508a52ea803d7031378dab0d7292ee41caba3e35b6e15d7309910c754a5762de7754be813c257b82  support-smdpkt.patch
8f2893dfc291fc210ef217c4bc74d79436a0997001dd2773809625d52dd19d092cc75d3f9aa5ed2f3d4a6248d4a4e17013a7655323f7dad951f744c55b572417  udev.rules"
