aboutsummaryrefslogtreecommitdiffstats
path: root/main/php5-pear-mdb2/APKBUILD
blob: 6cf66f153ad76b991916b125d369f586093f8bf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Contributor: Matt Smith <mcs@darkregion.net>
# Maintainer:  Matt Smith <mcs@darkregion.net>
_php=php5
pkgname=${_php}-pear-mdb2
_pkgname=MDB2
pkgver=2.5.0b5
_driver_ver=1.5.0b4
pkgrel=0
pkgdesc="PEAR MDB2 Database Abstraction Layer"
url="http://pear.php.net/package/MDB2/"
arch="noarch"
license="BSD"
depends="${_php}-pear"
depends_dev=
makedepends="$depends_dev ${_php}-pear"
install=""
subpackages="
	$pkgname-driver-mysql:driver_mysql
	$pkgname-driver-mysqli:driver_mysqli
	$pkgname-driver-pgsql:driver_pgsql
	$pkgname-driver-sqlite:driver_sqlite
	"
source=""

build()		{ return 0; }
package()	{ _pear_install $_pkgname-$pkgver "$pkgdir" || return 1; }
driver_mysql()	{ _do_driver mysql "mysql ${_php}-mysql" noarch; }
driver_mysqli()	{ _do_driver mysqli "mysql ${_php}-mysqli" noarch; }
driver_pgsql()	{ _do_driver pgsql "postgresql ${_php}-pgsql" noarch; }
driver_sqlite()	{ _do_driver sqlite "${_php}-sqlite3" noarch; }


_pear_install() {
	local _pear_pkg=$1
	local _pear_pkg_dir=$2

	pear install --nodeps --packagingroot="$_pear_pkg_dir" $_pear_pkg \
		|| return 1

	_cleanpaths="
		usr/share/pear/.channels/
		usr/share/pear/.depdb
		usr/share/pear/.depdblock
		usr/share/pear/.filemap
		usr/share/pear/.lock
		usr/share/pear/.registry/.channel.__uri/
		usr/share/pear/.registry/.channel.doc.php.net/
		usr/share/pear/.registry/.channel.pecl.php.net/
		"
	for _cleanpath in $_cleanpaths; do
		rm -rf "$_pear_pkg_dir"/$_cleanpath || return 1
	done
}

_do_driver() {
	local _driver_name=$1

	# driver dependencies
	if [ -n "${2-}" ]; then
		depends="${2-}"
	fi
	depends="${pkgname} ${depends}"
	arch="${3-noarch}"

	_pear_install ${_pkgname}_Driver_${_driver_name}-${_driver_ver} \
		"$subpkgdir" || return 1
}