APKBUILD 5.92 KB
Newer Older
Carlo Landmeter's avatar
Carlo Landmeter committed
1
# Contributor: Carlo Landmeter <clandmeter at gmail>
2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
Carlo Landmeter's avatar
Carlo Landmeter committed
3
pkgname=php
Natanael Copa's avatar
Natanael Copa committed
4
pkgver=5.2.11
5
_suhosinver=${pkgver}-0.9.7
Natanael Copa's avatar
Natanael Copa committed
6
pkgrel=0
Carlo Landmeter's avatar
Carlo Landmeter committed
7 8 9
pkgdesc="The PHP language runtime engine"
url="http://www.php.net/"
license="PHP-3"
10
depends=
11
install=
12
makedepends="pcre-dev libxml2-dev libiconv-dev openssl-dev zlib-dev bzip2-dev
13
	curl-dev libpng-dev jpeg-dev freetype-dev libmcrypt-dev mysql-dev
14
	sqlite-dev libtool libltdl postgresql-dev db-dev unixodbc-dev icu-dev
15
	gd-dev gmp-dev gettext-dev imap-dev aspell-dev
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
	net-snmp-dev libxslt-dev cyrus-sasl-dev openldap-dev pkgconfig
	libgcrypt-dev"
subpackages="$pkgname-dev $pkgname-doc
	$pkgname-bcmath
	$pkgname-bz2
	$pkgname-calendar
	$pkgname-curl
	$pkgname-dba
	$pkgname-exif
	$pkgname-ftp
	$pkgname-gd
	$pkgname-gettext
	$pkgname-gmp
	$pkgname-iconv
	$pkgname-imap
	$pkgname-json
	$pkgname-ldap
	$pkgname-mcrypt
34
	$pkgname-mime_magic
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
	$pkgname-mysql
	$pkgname-mysqli
	$pkgname-odbc
	$pkgname-openssl
	$pkgname-pdo
	$pkgname-pdo_mysql
	$pkgname-pdo_odbc
	$pkgname-pdo_pgsql
	$pkgname-pdo_sqlite
	$pkgname-pgsql
	$pkgname-posix
	$pkgname-pspell
	$pkgname-shmop
	$pkgname-snmp
	$pkgname-soap
	$pkgname-sockets
	$pkgname-sqlite
	$pkgname-sysvmsg
	$pkgname-sysvsem
	$pkgname-sysvshm
	$pkgname-xml
	$pkgname-xmlrpc
	$pkgname-xsl
	$pkgname-zip
	$pkgname-zlib
	"

source="http://www.php.net/distributions/${pkgname}-${pkgver}.tar.bz2
        http://download.suhosin.org/suhosin-patch-${_suhosinver}.patch.gz
	"
Carlo Landmeter's avatar
Carlo Landmeter committed
65 66 67 68

build() {
        cd "$srcdir/$pkgname-$pkgver"

69 70 71 72 73
	# apply suhosin patch
	gunzip -c ${srcdir}/suhosin-patch-${_suhosinver}.patch.gz \
		| patch -p1 || return 1

	phpextensions="--enable-bcmath=shared \
74
		--enable-calendar=shared \
75
		--enable-dba=shared \
76 77 78
		--enable-exif=shared \
		--enable-ftp=shared \
		--enable-gd-native-ttf \
79 80 81 82
		--enable-intl=shared \
		--enable-json=shared \
		--enable-mbregex \
		--enable-mbstring \
83
		--enable-pdo=shared \
84 85 86
		--enable-phar=shared \
		--enable-posix=shared \
		--enable-session \
87 88
		--enable-shmop=shared \
		--enable-soap=shared \
89 90
		--enable-sockets=shared \
		--enable-sqlite-utf8 \
91 92 93
		--enable-sysvmsg=shared \
		--enable-sysvsem=shared \
		--enable-sysvshm=shared \
94
		--enable-xml=shared \
95
		--enable-zip=shared \
96 97 98 99 100 101 102
		--with-bz2=shared \
		--with-curl=shared \
		--with-db4=shared \
		--with-freetype-dir=shared,/usr \
		--with-gd=shared,/usr \
		--with-gettext=shared \
		--with-gmp=shared \
103
		--with-iconv=shared \
104 105 106 107 108 109
		--with-icu-dir=/usr \
		--with-imap-ssl=shared \
		--with-imap=shared \
		--with-jpeg-dir=shared,/usr \
		--with-ldap=shared \
		--with-mcrypt=shared \
110
		--with-mime-magic=shared \
111
		--with-mysql-sock=/tmp/mysql.sock \
112 113
		--with-mysql=shared \
		--with-mysqli=shared \
114 115
		--with-openssl=shared \
		--with-pcre-regex=/usr \
116
		--with-pdo-mysql=shared \
117 118 119 120 121 122 123 124 125 126 127
		--with-pdo-odbc=shared,unixODBC,/usr \
		--with-pdo-pgsql=shared \
		--with-pdo-sqlite=shared,/usr \
		--with-pgsql=shared \
		--with-png-dir=shared,/usr \
		--with-pspell=shared \
		--with-regex=php \
		--with-snmp=shared \
		--with-sqlite3=shared,/usr \
		--with-sqlite=shared \
		--with-unixODBC=shared,/usr \
128
		--with-xmlrpc=shared \
129 130 131 132 133 134 135
		--with-xsl=shared \
		--with-zlib=shared \
		--without-db1 \
		--without-db2 \
		--without-db3 \
		--without-qdbm \
		"
136
#		--with-enchant=shared,/usr \
137 138 139 140 141 142 143 144 145 146 147 148 149 150
#		--with-tidy=shared \
        ./configure --build=${CHOST:-i486-alpine-linux-uclibc} \
		--prefix=/usr \
		--sysconfdir=/etc/php \
		--with-layout=GNU \
		--with-config-file-path=/etc/php \
		--with-config-file-scan-dir=/etc/php/conf.d \
		--enable-inline-optimization \
		--disable-debug \
		--disable-rpath \
		--disable-static \
		--enable-shared \
		--mandir=/usr/share/man \
		--enable-fastcgi \
151
		--enable-cgi \
152
		--disable-cli \
153 154
		--enable-discard-path \
		--enable-force-cgi-redirect \
155 156
		--with-pic \
		$phpextensions
Carlo Landmeter's avatar
Carlo Landmeter committed
157

158 159 160
	# see #183
	sed -i -e '/^BUILD_CGI/s/$(LDFLAGS)/-lpthread $(LDFLAGS)/' Makefile

Carlo Landmeter's avatar
Carlo Landmeter committed
161 162
        make || return 1
        make -j1 INSTALL_ROOT="$pkgdir" install || return 1
163 164
	# fix the extension_dir
	sed -i -e 's/^extension_dir/\;extension_dir/' php.ini-recommended
165
        install -D -m644 php.ini-recommended "$pkgdir"/etc/php/php.ini
Carlo Landmeter's avatar
Carlo Landmeter committed
166 167
}

168
_mv_mod() {
169
	pkgdesc="$1 php extension"
170
	local d=usr/lib/php/20060613
171 172
	mkdir -p "$subpkgdir/$d"
	mv "$pkgdir/$d/${1}.so" "$subpkgdir/$d/" || return 1
173 174
	install -d "$subpkgdir"/etc/php/conf.d
	echo "extension=${1}.so" > "$subpkgdir"/etc/php/conf.d/${1}.ini
175 176
	return 0
}
Carlo Landmeter's avatar
Carlo Landmeter committed
177

178 179 180 181
bcmath()	{ _mv_mod bcmath; }
bz2()		{ _mv_mod bz2; }
calendar()	{ _mv_mod calendar; }
curl()		{ _mv_mod curl; }
182
dba()		{ _mv_mod dba; }
183
#enchant()	{ _mv_mod enchant; }
184 185 186
exif()		{ _mv_mod exif; }
ftp()		{ _mv_mod ftp; }
gd()		{ _mv_mod gd; }
187 188
gettext()	{ _mv_mod gettext; }
gmp()		{ _mv_mod gmp; }
189
iconv()		{ _mv_mod iconv; }
190
imap()		{ _mv_mod imap; }
191
#intl()		{ _mv_mod intl; }
192
json()		{ _mv_mod json; }
193
ldap()		{ _mv_mod ldap; }
194
mcrypt()	{ _mv_mod mcrypt; }
195
mime_magic()	{ _mv_mod mime_magic; }
196 197
mysql()		{ _mv_mod mysql; }
mysqli()	{ _mv_mod mysqli; }
198
odbc()		{ _mv_mod odbc; }
199 200 201
openssl()	{ _mv_mod openssl; }
pdo()		{ _mv_mod pdo; }
pdo_mysql()	{ _mv_mod pdo_mysql; }
202 203
pdo_odbc()	{ _mv_mod pdo_odbc; }
pdo_pgsql()	{ _mv_mod pdo_pgsql; }
204
pdo_sqlite()	{ _mv_mod pdo_sqlite; }
205
#phar()		{ _mv_mod phar; }
206
pgsql()		{ _mv_mod pgsql; }
207
posix()		{ _mv_mod posix; }
208 209
pspell()	{ _mv_mod pspell; }
#session()	{ _mv_mod session; }
210
shmop()		{ _mv_mod shmop; }
211
snmp()		{ _mv_mod snmp; }
212 213 214
soap()		{ _mv_mod soap; }
sockets()	{ _mv_mod sockets; }
sqlite()	{ _mv_mod sqlite; }
215
#sqlite3()	{ _mv_mod sqlite3; }
216 217 218
sysvmsg()	{ _mv_mod sysvmsg; }
sysvsem()	{ _mv_mod sysvsem; }
sysvshm()	{ _mv_mod sysvshm; }
219
xml()		{ _mv_mod xml; }
220
xmlrpc()	{ _mv_mod xmlrpc; }
221
xsl()		{ _mv_mod xsl; }
222 223
zip()		{ _mv_mod zip; }
zlib()		{ _mv_mod zlib; }
224

225 226 227
# devleoper package
dev() {
	default_dev
228
	mkdir -p "$subpkgdir"/usr/lib/php/ "$subpkgdir"/usr/bin/
229
	mv "$pkgdir"/usr/lib/php/build "$subpkgdir"/usr/lib/php/
230
	mv "$pkgdir"/usr/bin/phpize "$subpkgdir"/usr/bin/
Carlo Landmeter's avatar
Carlo Landmeter committed
231 232
}

Natanael Copa's avatar
Natanael Copa committed
233 234
md5sums="286bf34630f5643c25ebcedfec5e0a09  php-5.2.11.tar.bz2
8f9de4d97fae6eba163cf3699509a260  suhosin-patch-5.2.11-0.9.7.patch.gz"