Subject: [alpine-aports] [PATCH] main/gpsd: repackaging

From: Nathan Angelacos <[email-masked]>
Date: Sun, 8 Apr 2018 14:09:51 -0400

New subpackages -
	py3-gpsd - python clients and bindings (new)
	gpsd-clients - clients other than python scripts

	Main gpsd package now contains the gpsd daemon only
---
 main/gpsd/APKBUILD | 40 +++++++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/main/gpsd/APKBUILD b/main/gpsd/APKBUILD
index 6852efda61..0373d09514 100644
--- a/main/gpsd/APKBUILD
+++ b/main/gpsd/APKBUILD
@@ -2,13 +2,13 @@
 # Maintainer: Nathan Angelacos <[email-masked]>
 pkgname=gpsd
 pkgver=3.17
-pkgrel=0
+pkgrel=1
 pkgdesc="A GPS daemon"
 arch=all
 url="http://catb.org/gpsd/"
 license="BSD"
-makedepends="scons python2-dev libcap-dev ncurses-dev"
-subpackages="$pkgname-dev"
+makedepends="scons python3-dev libcap-dev ncurses-dev"
+subpackages="$pkgname-dev $pkgname-doc py3-$pkgname:_py $pkgname-clients:_clients"
 source="http://download-mirror.savannah.gnu.org/releases/gpsd/$pkgname-$pkgver.tar.gz
 	timepps.h
 	gpsd-use-local-timepps-header.patch
@@ -31,7 +31,9 @@ prepare() {
 build() {
 	cd "$builddir"
         CPPFLAGS="-I. -DHAVE_SYS_TIMEPPS_H"
-	scons -j1 prefix=/usr 
+	scons -j${JOBS:-1} \
+		prefix=/usr \
+		target_python=python3
 }
 
 check() {
@@ -42,16 +44,32 @@ check() {
 package() {
 	cd "$builddir"
 
-	mkdir -p "$pkgdir"/usr/lib
-	cp -a "$builddir"/libgps*.so* "$pkgdir"/usr/lib/
+	DESTDIR="$pkgdir" scons install
+	# fix python interpreter path
+	 sed -e "s,#!/usr/bin/\(python[23]\?\|env \+python[23]\?\),#!/usr/bin/python3},g" -i \
+	         gegps gpscat gpsfake xgps xgpsspeed gpsprof gps/*.py
+	install -m755 -D "$srcdir"/gpsd.initd "$pkgdir"/etc/init.d/gpsd
+	install -m644 -D "$srcdir"/gpsd.confd "$pkgdir"/etc/conf.d/gpsd
+}
 
-	mkdir -p "$pkgdir"/usr/sbin
-	for a in gpsdecode gpsd gpsctl gpsdctl gpspipe; do
-		install -m755 -D "$builddir/"$a "$pkgdir"/usr/sbin/
+_py() {
+	local _py=${subpkgname##-*}
+	local _pyver=${_py%py}
+	pkgdesc="$pkgname library and clients for python $_pyver"
+	mkdir -p "$subpkgdir"/usr/lib
+	mv "$pkgdir"/usr/lib/python*  "$subpkgdir"/usr/lib/
+	
+	mkdir -p "$subpkgdir"/usr/bin
+	for n in gpscat gpsfake gpsprof; do
+		mv "$pkgdir"/usr/bin/${n} "$subpkgdir"/usr/bin/
 	done
 
-	install -m755 -D "$srcdir"/gpsd.initd "$pkgdir"/etc/init.d/gpsd
-	install -m644 -D "$srcdir"/gpsd.confd "$pkgdir"/etc/conf.d/gpsd
+}
+
+_clients() {
+	pkgdesc="$pkgname clients"
+	mkdir -p "$subpkgdir"/usr/bin
+	mv "$pkgdir"/usr/bin/* "$subpkgdir"/usr/bin
 }
 
 sha512sums="71085053f600730e0f2de269c59ce0a17ae106ef01403f02d78418b267c6adb9818d541fba59eb23bf71cdb67c5442c82b4948d262ef7e74bb993dcae677a1b1  gpsd-3.17.tar.gz
-- 
2.17.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---