Mail archive
alpine-aports

[alpine-aports] [PATCH] main/abuild: add apkbuild-pecl. Simple script to generate APKBUILD for php pecl extensions

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Fri, 6 Nov 2015 19:59:24 +0200

---
 main/abuild/APKBUILD      | 20 ++++++++++++++++----
 main/abuild/apkbuild-pecl | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 4 deletions(-)
 create mode 100755 main/abuild/apkbuild-pecl
diff --git a/main/abuild/APKBUILD b/main/abuild/APKBUILD
index c1aa017..288833e 100644
--- a/main/abuild/APKBUILD
+++ b/main/abuild/APKBUILD
_at_@ -16,11 +16,12 @@ makedepends_build="pkgconfig"
 makedepends_host="openssl-dev"
 makedepends="$makedepends_host $makedepends_build"
 install="$pkgname.pre-install $pkgname.pre-upgrade"
-subpackages="apkbuild-cpan:cpan apkbuild-gem-resolver:gems"
+subpackages="apkbuild-cpan:cpan apkbuild-gem-resolver:gems apkbuild-pecl:pecl"
 options="suid"
 pkggroups="abuild"
 source="http://dev.alpinelinux.org/archive/abuild/abuild-$_ver.tar.xz
 	0001-abuild-do-not-install-itself-as-a-makedepend.patch
+	apkbuild-pecl
 	"
 
 _builddir="$srcdir/$pkgname-$_ver"
_at_@ -65,9 +66,20 @@ gems() {
 	mv "$pkgdir"/usr/bin/apkbuild-gem-resolver "$subpkgdir"/usr/bin/
 }
 
+pecl() {
+	pkgdesc="Small simple script to generate php extensions APKBUILD from PECL"
+	depends=""
+	arch="noarch"
+	install -d "$subpkgdir"/usr/bin
+	cp "$srcdir"/apkbuild-pecl "$subpkgdir"/usr/bin/
+}
+
 md5sums="6fd1f7b99247618cbf0ca22b7c6cec1b  abuild-2.25.0_rc1.tar.xz
-6bf3cbf4d6175798fff17baaa1ecef2c  0001-abuild-do-not-install-itself-as-a-makedepend.patch"
+6bf3cbf4d6175798fff17baaa1ecef2c  0001-abuild-do-not-install-itself-as-a-makedepend.patch
+89e2b3e66f811c3970fbcacbe02fc3d1  apkbuild-pecl"
 sha256sums="2addf0e0a518d85669f5a6cbe593ea7d57232d8573acd1a9e322b68e5a14614d  abuild-2.25.0_rc1.tar.xz
-007177afd724e8fdc081588079c8d70724b271686a0f2776ec831447aa115185  0001-abuild-do-not-install-itself-as-a-makedepend.patch"
+007177afd724e8fdc081588079c8d70724b271686a0f2776ec831447aa115185  0001-abuild-do-not-install-itself-as-a-makedepend.patch
+3590061b7e147cbb45fe6e20de2eece4dacb865658e88237f8c4f8c0228aecd1  apkbuild-pecl"
 sha512sums="6dca86b68f57aaa4df0a1401098d2264d33c44380a0186ae3b03784e8f648ac17317d7ce7d3586db45d3d36ca65454fc53e032bd7b58f22f356c937038a991e5  abuild-2.25.0_rc1.tar.xz
-b15632f09015ed40639fcb3cba8253608a3637d3e103707a35d249ae4f2fe92a5ed77168146e8d7eccae7bec8cec17b58bce921119a7aa4911059cc3942a89a4  0001-abuild-do-not-install-itself-as-a-makedepend.patch"
+b15632f09015ed40639fcb3cba8253608a3637d3e103707a35d249ae4f2fe92a5ed77168146e8d7eccae7bec8cec17b58bce921119a7aa4911059cc3942a89a4  0001-abuild-do-not-install-itself-as-a-makedepend.patch
+72091d1face7bcd9938c13db2f7d930bfc8a9d4b101c41c2ad33891448254fc4f1cfc1ac74224c989fc97fffb9fe055c5c42e3c259f83b5d7f347cb59450e66b  apkbuild-pecl"
diff --git a/main/abuild/apkbuild-pecl b/main/abuild/apkbuild-pecl
new file mode 100755
index 0000000..3666285
--- /dev/null
+++ b/main/abuild/apkbuild-pecl
_at_@ -0,0 +1,47 @@
+#!/bin/sh
+
+if [ $# -lt 2 ]; then
+    echo "Usage: apkbuild-pecl <pecl-name> <pecl-version>"
+    exit 1
+fi
+
+user=$(grep "name" ~/.gitconfig | sed -e 's/^.*=[[:space:]]//g' -e 's/[[:space:]]*\$//g')
+email=$(grep "email" ~/.gitconfig | sed -e 's/^.*=[[:space:]]//g' -e 's/[[:space:]]*\$//g')
+
+[ -d php-$1 ] || mkdir php-$1
+
+cat << EOF > php-$1/APKBUILD
+# Contributor: $user <$email>
+# Maintainer: $user <$email>
+pkgname=php-$1
+_pkgreal=$1
+pkgver=${2/RC/_rc}
+_pkgver=\${pkgver/_rc/RC}
+pkgrel=0
+pkgdesc="PHP extension $1"
+url="http://pecl.php.net/package/\$_pkgreal"
+arch="all"
+license="PHP"
+depends=
+pecldepends="php-dev autoconf"
+makedepends="\$pecldepends"
+install=""
+subpackages=""
+source="http://pecl.php.net/get/\$_pkgreal-\$_pkgver.tgz"
+
+_builddir="\$srcdir"/\$_pkgreal-\$_pkgver
+
+build() {
+	cd "\$_builddir"
+	phpize || return 1
+	./configure --prefix=/usr || return 1
+	make || return 1
+}
+
+package() {
+	cd "\$_builddir"
+	make INSTALL_ROOT="\$pkgdir"/ install || return 1
+	install -d "\$pkgdir"/etc/php/conf.d || return 1
+	echo "extension=\$_pkgreal.so" > "\$pkgdir"/etc/php/conf.d/\$_pkgreal.ini
+}
+
-- 
2.6.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Fri Nov 06 2015 - 19:59:24 GMT