summaryrefslogtreecommitdiffstats
path: root/main/php/APKBUILD
blob: 8bd5fb8bde18e621a382745b6416bff3adba1142 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# Contributor: Carlo Landmeter <clandmeter at gmail>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=php
pkgver=5.3.2
_suhosinver=${pkgver}-0.9.9.1
pkgrel=5
pkgdesc="The PHP language runtime engine"
url="http://www.php.net/"
license="PHP-3"
depends=
install="$pkgname.post-upgrade"
makedepends="pcre-dev libxml2-dev libiconv-dev openssl-dev zlib-dev bzip2-dev
	curl-dev libpng-dev jpeg-dev freetype-dev libmcrypt-dev mysql-dev
	sqlite-dev libtool libltdl postgresql-dev db-dev unixodbc-dev icu-dev
	gd-dev gmp-dev gettext-dev imap-dev aspell-dev
	net-snmp-dev libxslt-dev cyrus-sasl-dev openldap-dev pkgconfig
	libgcrypt-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-cli $pkgname-pear
	$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-intl
	$pkgname-json
	$pkgname-ldap
	$pkgname-mcrypt
	$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-phar
	$pkgname-posix
	$pkgname-pspell
	$pkgname-shmop
	$pkgname-snmp
	$pkgname-soap
	$pkgname-sockets
	$pkgname-sqlite
	$pkgname-sqlite3
	$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
	php-install-pear-xml.patch
	zend_execute_API.c.patch
	"

_extdir="/usr/lib/php/20090626"

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

	# beat the pear installer into using xml.so
	patch -p1 -i "$srcdir"/php-install-pear-xml.patch || return 1

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

	phpextensions="--enable-bcmath=shared \
		--enable-calendar=shared \
		--enable-dba=shared \
		--enable-exif=shared \
		--enable-ftp=shared \
		--enable-gd-native-ttf \
		--enable-intl=shared \
		--enable-json=shared \
		--enable-mbregex \
		--enable-mbstring \
		--enable-pdo=shared \
		--enable-phar=shared \
		--enable-posix=shared \
		--enable-session \
		--enable-shmop=shared \
		--enable-soap=shared \
		--enable-sockets=shared \
		--enable-sqlite-utf8 \
		--enable-sysvmsg=shared \
		--enable-sysvsem=shared \
		--enable-sysvshm=shared \
		--enable-xml=shared \
		--enable-zip=shared \
		--with-bz2=shared \
		--with-curl=shared \
		--with-db4=shared \
		--with-freetype-dir=shared,/usr \
		--with-gd=shared,/usr \
		--with-gettext=shared \
		--with-gmp=shared \
		--with-iconv=shared \
		--with-icu-dir=/usr \
		--with-imap-ssl=shared \
		--with-imap=shared \
		--with-jpeg-dir=shared,/usr \
		--with-ldap=shared \
		--with-mcrypt=shared \
		--with-mysql-sock=/var/run/mysqld/mysqld.sock \
		--with-mysql=shared,mysqlnd \
		--with-mysqli=shared,mysqlnd \
		--with-openssl=shared \
		--with-pcre-regex=/usr \
		--with-pdo-mysql=shared,mysqlnd \
		--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 \
		--with-xmlrpc=shared \
		--with-xsl=shared \
		--with-zlib=shared \
		--without-db1 \
		--without-db2 \
		--without-db3 \
		--without-qdbm \
		"
#		--with-enchant=shared,/usr \
#		--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 \
		--enable-cgi \
		--enable-cli \
		--enable-discard-path \
		--enable-force-cgi-redirect \
		--with-pic \
		$phpextensions

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

        make || return 1
}

package() {
        cd "$srcdir/$pkgname-$pkgver"
        make -j1 INSTALL_ROOT="$pkgdir" install || return 1
        install -D -m644 php.ini-production "$pkgdir"/etc/php/php.ini
	sed -i -e "s:^; extension_dir = \"./\":extension_dir = \"$_extdir\":" "$pkgdir"/etc/php/php.ini
}

cli() {
	pkgdesc="PHP command line interface"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/php "$subpkgdir"/usr/bin/
}

pear() {
	depends="php"
	mkdir -p "$subpkgdir"/usr/bin
	mkdir -p "$subpkgdir"/usr/share
	mkdir -p "$subpkgdir"/etc/php
	mv "$pkgdir"/usr/share/pear "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/bin/pear* "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/bin/pecl "$subpkgdir"/usr/bin/
	mv "$pkgdir"/etc/php/pear.conf "$subpkgdir"/etc/php/
}

_mv_mod() {
	pkgdesc="$1 php extension"
	mkdir -p "$subpkgdir/$_extdir"
	mv "$pkgdir/$_extdir/${1}.so" "$subpkgdir/$_extdir/" || return 1
	install -d "$subpkgdir"/etc/php/conf.d
	echo "extension=${1}.so" > "$subpkgdir"/etc/php/conf.d/${1}.ini
	return 0
}

bcmath()	{ _mv_mod bcmath; }
bz2()		{ _mv_mod bz2; }
calendar()	{ _mv_mod calendar; }
curl()		{ _mv_mod curl; }
dba()		{ _mv_mod dba; }
#enchant()	{ _mv_mod enchant; }
exif()		{ _mv_mod exif; }
ftp()		{ _mv_mod ftp; }
gd()		{ _mv_mod gd; }
gettext()	{ _mv_mod gettext; }
gmp()		{ _mv_mod gmp; }
iconv()		{ _mv_mod iconv; }
imap()		{ _mv_mod imap; }
intl()		{ _mv_mod intl; }
json()		{ _mv_mod json; }
ldap()		{ _mv_mod ldap; }
mcrypt()	{ _mv_mod mcrypt; }
mysql()		{ _mv_mod mysql; }
mysqli()	{ _mv_mod mysqli; }
odbc()		{ _mv_mod odbc; }
openssl()	{ _mv_mod openssl; }
pdo()		{ _mv_mod pdo; }
pdo_mysql()	{ _mv_mod pdo_mysql; }
pdo_odbc()	{ _mv_mod pdo_odbc; }
pdo_pgsql()	{ _mv_mod pdo_pgsql; }
pdo_sqlite()	{ _mv_mod pdo_sqlite; }
phar()		{ _mv_mod phar; }
posix()		{ _mv_mod posix; }
pgsql()		{ _mv_mod pgsql; }
pspell()	{ _mv_mod pspell; }
#session()	{ _mv_mod session; }
shmop()		{ _mv_mod shmop; }
snmp()		{ _mv_mod snmp; }
soap()		{ _mv_mod soap; }
sockets()	{ _mv_mod sockets; }
sqlite()	{ _mv_mod sqlite; }
sqlite3()	{ _mv_mod sqlite3; }
sysvmsg()	{ _mv_mod sysvmsg; }
sysvsem()	{ _mv_mod sysvsem; }
sysvshm()	{ _mv_mod sysvshm; }
xml()		{ _mv_mod xml; }
xmlrpc()	{ _mv_mod xmlrpc; }
xsl()		{ _mv_mod xsl; }
zip()		{ _mv_mod zip; }
zlib()		{ _mv_mod zlib; }

# devleoper package
dev() {
	default_dev
	mkdir -p "$subpkgdir"/usr/lib/php/ "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/lib/php/build "$subpkgdir"/usr/lib/php/
	mv "$pkgdir"/usr/bin/phpize "$subpkgdir"/usr/bin/
}

md5sums="46f500816125202c48a458d0133254a4  php-5.3.2.tar.bz2
4647b05330862d6a1fc4469245cc6ade  suhosin-patch-5.3.2-0.9.9.1.patch.gz
5111e3be06d391f8772587c675240fab  php-install-pear-xml.patch
55f9d24316a57e0c0f6b4b84791a1a17  zend_execute_API.c.patch"