Subject: [alpine-aports] [PATCH v2] main/glib: add system pcre support, bash completion moved to subpackage

From: Valery Kartel <[email-masked]>
Date: Wed, 27 Jan 2016 17:37:42 +0200

---
 main/glib/APKBUILD | 61 ++++++++++++++++++++++++++----------------------------
 1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/main/glib/APKBUILD b/main/glib/APKBUILD
index 930e54f..f73ffe5 100644
--- a/main/glib/APKBUILD
+++ b/main/glib/APKBUILD
@@ -1,7 +1,8 @@
+# Contributor: Valery Kartel <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=glib
 pkgver=2.46.2
-pkgrel=0
+pkgrel=1
 pkgdesc="Common C routines used by Gtk+ and other libs"
 url="http://www.gtk.org"
 arch="all"
@@ -9,15 +10,13 @@ license='GPL'
 depends=
 triggers="$pkgname.trigger=/usr/share/glib-2.0/schemas:/usr/lib/gio/modules"
 depends_dev="perl python gettext-dev zlib-dev bzip2-dev libffi-dev"
-makedepends="$depends_dev"
-source="http://ftp.gnome.org/pub/gnome/sources/glib/${pkgver%.*}/glib-$pkgver.tar.xz
+makedepends="$depends_dev pcre-dev"
+source="http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
 	0001-Revert-Move-quark-initialization-to-a-constructor.patch
 	"
-subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-lang"
-
-
-_builddir="$srcdir/$pkgname-$pkgver"
+subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-lang $pkgname-bash-completion:bashcomp"
 
+_builddir="$srcdir"/$pkgname-$pkgver
 prepare() {
 	cd "$_builddir"
 	for i in $source; do
@@ -30,7 +29,6 @@ prepare() {
 	touch -r docs/reference/glib/Makefile.am gtk-doc.make
 }
 
-
 build() {
 	cd "$_builddir"
 	./configure \
@@ -40,41 +38,40 @@ build() {
 		--mandir=/usr/share/man \
 		--disable-gtk-doc \
 		--disable-compile-warnings \
+		--with-pcre=system \
+		--with-pic \
 		|| return 1
 	make || return 1
 }
 
 package() {
 	cd "$_builddir"
-	make DESTDIR="$pkgdir/" install
+	make DESTDIR="$pkgdir" install || return 1
 	rm -rf "$pkgdir"/usr/lib/charset.alias
 }
 
-# move the stuff in /usr/bin to the glib-dev package
 dev() {
 	default_dev
-	replaces="glib"
-	mkdir -p "$subpkgdir"/usr/bin/ \
-		"$subpkgdir"/usr/share/bash-completion/completions \
-		|| return 1
-	cd "$pkgdir"/usr/bin
-	mv \
-		gdbus-codegen \
-		glib-compile-resources \
-		glib-genmarshal \
-		glib-gettextize \
-		glib-mkenums \
-		gobject-query \
-		gresource \
-		gtester \
-		gtester-report \
-		"$subpkgdir"/usr/bin/
-	mv "$pkgdir"/usr/share/gdb \
-		"$pkgdir"/usr/share/glib-2.0 \
-		"$subpkgdir"/usr/share/ || return 1
-	mv "$pkgdir"/usr/share/bash-completion/completions/gresource \
-		"$subpkgdir"/usr/share/bash-completion/completions \
-		|| return 1
+	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/share
+		find "$pkgdir"/usr/bin ! -name "glib-compile-schemas" -a \( \
+		-name "gdbus-codegen" -o \
+		-name "gobject-query" -o \
+		-name "gresource" -o \
+		-name "gtester*" -o \
+		-name "glib-*" \) \
+		-exec mv {} "$subpkgdir"/usr/bin \;
+	mv "$pkgdir"/usr/share/gdb "$pkgdir"/usr/share/glib-2.0 \
+		"$subpkgdir"/usr/share
+}
+
+bashcomp() {
+	pkgdesc="Bash completion for $pkgname"
+	arch="noarch"
+	depends=
+	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
+	mkdir -p "$subpkgdir"/usr/share
+	mv "$pkgdir"/usr/share/bash-completion "$subpkgdir"/usr/share
+	[ "$(ls -A "$pkgdir"/usr/share)" ] || rmdir "$pkgdir"/usr/share
 }
 
 md5sums="7f815d6e46df68e070cb421ed7f1139e  glib-2.46.2.tar.xz
-- 
2.7.0

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