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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
|
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=php
pkgver=5.6.5
pkgrel=0
pkgdesc="The PHP language runtime engine"
url="http://www.php.net/"
arch="all"
license="PHP-3"
depends="$pkgname-cli"
install="$pkgname.post-upgrade"
makedepends="
apache2-dev
apr-dev
apr-util-dev
aspell-dev
bzip2-dev
curl-dev
db-dev
enchant-dev
expat-dev
freetds-dev
freetype-dev
gdbm-dev
gettext-dev
gmp-dev
icu-dev
imap-dev
libevent-dev
libgcrypt-dev
libiconv-dev
libjpeg-turbo-dev
libmcrypt-dev
libpng-dev
libtool
libxml2-dev
libxslt-dev
mysql-dev
net-snmp-dev
openldap-dev
openssl-dev
pcre-dev
postgresql-dev
readline-dev
sqlite-dev
unixodbc-dev
zlib-dev
autoconf
bison
"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-common $pkgname-cgi
$pkgname-cli $pkgname-fpm $pkgname-apache2 $pkgname-embed
$pkgname-phpdbg
$pkgname-pear
$pkgname-bcmath
$pkgname-bz2
$pkgname-calendar
$pkgname-ctype
$pkgname-curl:_curl
$pkgname-dba
$pkgname-dom
$pkgname-enchant
$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-sqlite3
$pkgname-sysvmsg
$pkgname-sysvsem
$pkgname-sysvshm
$pkgname-xml
$pkgname-xmlreader
$pkgname-xmlrpc
$pkgname-xsl
$pkgname-zip
$pkgname-zlib
$pkgname-mssql
$pkgname-pdo_dblib
$pkgname-wddx
$pkgname-opcache
"
source="http://php.net/distributions/php-$pkgver.tar.bz2
php-fpm.initd
php5-module.conf
php-install-pear-xml.patch
gd-iconv.patch
php-fix-crypt.patch
fix-crypt-sha.patch
"
_apiver="20131106"
_extdir="/usr/lib/php/modules"
_srcdir="$srcdir"/$pkgname-$pkgver
prepare() {
cd "$_srcdir"
update_config_sub
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
# safty check for api changes
local vapi=$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)
if [ "$vapi" != "$_apiver" ]; then
error "Upstreram API version is now $vapi. Expecting $_vapi"
return 1
fi
autoconf
}
_do_build() {
local _flavor="$1"
shift
local _builddir="$srcdir"/build-$_flavor
mkdir -p "$_builddir"
cd "$_builddir"
export EXTENSION_DIR=$_extdir
export PEAR_INSTALLDIR=/usr/share/pear
"$_srcdir"/configure $@ || return 1
sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
make || return 1
}
build() {
_phpconfig="\
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc/php \
--localstatedir=/var \
--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 \
--with-pic \
"
_phpextensions=" \
--enable-bcmath=shared \
--with-bz2=shared \
--enable-calendar=shared \
--with-cdb \
--enable-ctype=shared \
--with-curl=shared \
--enable-dba=shared \
--with-db4=shared \
--enable-dom=shared \
--with-enchant=shared \
--enable-exif=shared \
--with-freetype-dir=shared,/usr \
--enable-ftp=shared \
--with-gd=shared \
--enable-gd-native-ttf \
--with-gdbm=shared \
--with-gettext=shared \
--with-gmp=shared \
--with-iconv=shared \
--with-icu-dir=/usr \
--with-imap=shared \
--with-imap-ssl=shared \
--enable-intl=shared \
--with-jpeg-dir=shared,/usr \
--enable-json=shared \
--with-ldap=shared \
--enable-libxml=shared \
--enable-mbregex \
--enable-mbstring=all \
--with-mcrypt=shared \
--with-mysql=shared,mysqlnd \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-mysqli=shared,mysqlnd \
--with-openssl=shared \
--with-pcre-regex=/usr \
--enable-pdo=shared \
--with-pdo-mysql=shared,mysqlnd \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-pgsql=shared \
--with-pdo-sqlite=shared,/usr \
--with-pgsql=shared \
--enable-phar=shared \
--with-png-dir=shared,/usr \
--enable-posix=shared \
--with-pspell=shared \
--with-regex=php \
--enable-session \
--enable-shmop=shared \
--with-snmp=shared \
--enable-soap=shared \
--enable-sockets=shared \
--with-sqlite3=shared,/usr \
--enable-sysvmsg=shared \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--with-unixODBC=shared,/usr \
--enable-xml=shared \
--enable-xmlreader=shared \
--with-xmlrpc=shared \
--with-xsl=shared \
--enable-wddx=shared \
--enable-zip=shared \
--with-zlib=shared \
--without-db1 \
--without-db2 \
--without-db3 \
--without-qdbm \
--with-mssql=shared \
--with-pdo-dblib=shared \
--enable-opcache \
"
# cgi, fcgi, cli, pear and extensions
_do_build cgi \
${_phpconfig} \
--disable-cli \
--enable-cgi \
--enable-cli \
--with-pear \
--with-readline \
--enable-phpdbg \
${_phpextensions} \
|| return 1
# fpm
cp -a "$srcdir"/build-cgi "$srcdir"/build-fpm
_do_build fpm \
${_phpconfig} \
--disable-cli \
--enable-fpm \
${_phpextensions} \
|| return 1
# apache2
cp -a "$srcdir"/build-cgi "$srcdir"/build-apache2
_do_build apache2 \
${_phpconfig} \
--disable-cli \
--with-apxs2 \
${_phpextensions} \
|| return 1
# embed
cp -a "$srcdir"/build-cgi "$srcdir"/build-embed
_do_build embed \
${_phpconfig} \
--disable-cli \
--enable-embed=shared \
${_phpextensions} \
|| return 1
}
package() {
cd "$srcdir"/build-cgi
# install php-cgi, cli, pear and modules
make -j1 install install-pear INSTALL_ROOT="$pkgdir" || return 1
# cleanup after pear
find "$pkgdir" -name '.*' | xargs rm -rf || return 1
# install fpm
install -D -m755 "$srcdir"/build-fpm/sapi/fpm/php-fpm \
"$pkgdir"/usr/bin/php-fpm || return 1
install -D -m644 "$srcdir"/build-fpm/sapi/fpm/php-fpm.conf \
"$pkgdir"/etc/php/php-fpm.conf || return 1
install -D -m755 "$srcdir"/php-fpm.initd "$pkgdir"/etc/init.d/php-fpm
# enable some default options
sed -ri -e "s~^;(error_log)(.*)~\1 = /var/log/php-fpm.log~" \
-e "s/^;(pm.start_servers)/\1/" \
-e "s/^;(pm.min_spare_servers)/\1/" \
-e "s/^;(pm.max_spare_servers)/\1/" \
"$pkgdir"/etc/php/php-fpm.conf || return 1
# install apache2
install -D -m755 "$srcdir"/build-apache2/libs/libphp5.so \
"$pkgdir"/usr/lib/apache2/libphp5.so || return 1
install -D -m644 "$srcdir"/php5-module.conf \
"$pkgdir"/etc/apache2/conf.d/php5-module.conf || return 1
# install embed
install -D -m755 "$srcdir"/build-embed/libs/libphp5.so \
"$pkgdir"/usr/lib/libphp5.so || return 1
install -D -m644 "$_srcdir"/sapi/embed/php_embed.h \
"$pkgdir"/usr/include/php/sapi/embed/php_embed.h || return 1
}
dev() {
default_dev
mkdir -p "$subpkgdir"/usr/lib/php
mv "$pkgdir"/usr/lib/php/build \
"$subpkgdir"/usr/lib/php/ || return 1
}
doc() {
# man pages
default_doc || return 1
cd "$srcdir"/$pkgname-$pkgver
# doc files
_docs="CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS \
UPGRADING UPGRADING.INTERNALS"
for _doc in $_docs README.*; do
install -Dm644 "$srcdir"/$pkgname-$pkgver/$_doc \
"$subpkgdir"/usr/share/doc/$pkgname/$_doc || return 1
done
}
common() {
pkgdesc="PHP Common Files"
replaces="$pkgname"
depends=""
cd "$srcdir"/$pkgname-$pkgver
install -D -m644 php.ini-production "$subpkgdir"/etc/php/php.ini
sed -i -e "s:^; extension_dir = \"./\":extension_dir = \"$_extdir\":" "$subpkgdir"/etc/php/php.ini
sed -ri 's/;(date.timezone =)/\1 UTC/' "$subpkgdir"/etc/php/php.ini
sed -ri "s~^([;]*cgi\.rfc2616_headers.*)$~\1\n\n\; If this is enabled, the PHP CGI binary can safely be placed outside of the\n; web tree and people will not be able to circumvent .htaccess security.\ncgi\.discard_path = 1~" "$subpkgdir"/etc/php/php.ini
}
cgi() {
pkgdesc="PHP Common Gateway Interface (CGI)"
replaces="php"
depends="php-common"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/php-cgi "$subpkgdir"/usr/bin/
}
cli() {
pkgdesc="PHP Command Line Interface (CLI)"
replaces="php-dev"
depends="php-common"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/php "$subpkgdir"/usr/bin/ || return 1
# provide phpize here instead of -dev due to pecl command
mv "$pkgdir"/usr/bin/phpize "$subpkgdir"/usr/bin/ || return 1
}
fpm() {
pkgdesc="PHP FastCGI Process Manager (FPM)"
depends="php-common"
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/php
mv "$pkgdir"/usr/bin/php-fpm "$subpkgdir"/usr/bin/ || return 1
mv "$pkgdir"/etc/init.d "$subpkgdir"/etc/ || return 1
mv "$pkgdir"/etc/php/php-fpm.conf "$subpkgdir"/etc/php/
}
apache2() {
pkgdesc="PHP Module for Apache2"
depends="php-common apache2"
mkdir -p "$subpkgdir"/usr/lib "$subpkgdir"/etc
mv "$pkgdir"/usr/lib/apache2 "$subpkgdir"/usr/lib/ &&\
mv "$pkgdir"/etc/apache2 "$subpkgdir"/etc
}
embed() {
pkgdesc="PHP Embed Library"
depends="php-common"
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libphp5.so "$subpkgdir"/usr/lib/
}
pear() {
pkgdesc="PHP Extension and Application Repository (PEAR)"
depends="php-cli php-xml"
mkdir -p "$subpkgdir"/usr/share "$subpkgdir"/etc/php \
"$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/pecl \
"$pkgdir"/usr/bin/pear \
"$pkgdir"/usr/bin/peardev \
"$subpkgdir"/usr/bin/ || return 1
mv "$pkgdir"/etc/php/pear.conf \
"$subpkgdir"/etc/php/ || return 1
mv "$pkgdir"/usr/share/pear \
"$subpkgdir"/usr/share/ || return 1
}
phpdbg() {
pkgdesc="Interactive PHP debugger"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/phpdbg "$subpkgdir"/usr/bin/
}
_mv_ext() {
local ext=$1
local ini=$ext.ini
pkgdesc="${ext} extension for PHP"
# extension dependencies
if [ -n "${2-}" ]; then
depends="${2-}"
fi
depends="${pkgname} ${depends}"
# work around dependency issue
# https://bugs.alpinelinux.org/issues/1848
if [ "$ext" = "wddx" ]; then
ini=xml_$ext.ini
fi
mkdir -p "$subpkgdir"/$_extdir
mv "$pkgdir"/$_extdir/${ext}.so "$subpkgdir"/$_extdir/ || return 1
mkdir -p "$subpkgdir"/etc/php/conf.d
case "$1" in
opcache)
echo "zend_extension=${ext}.so" > "$subpkgdir"/etc/php/conf.d/$ini
;;
*)
echo "extension=${ext}.so" > "$subpkgdir"/etc/php/conf.d/$ini
;;
esac
}
bcmath() { _mv_ext bcmath; }
bz2() { _mv_ext bz2; }
calendar() { _mv_ext calendar; }
ctype() { _mv_ext ctype; }
_curl() { _mv_ext curl; }
dba() { _mv_ext dba; }
dom() { _mv_ext dom; }
enchant() { _mv_ext enchant; }
exif() { _mv_ext exif; }
ftp() { _mv_ext ftp; }
gd() { _mv_ext gd; }
gettext() { _mv_ext gettext; }
gmp() { _mv_ext gmp; }
iconv() { _mv_ext iconv; }
imap() { _mv_ext imap; }
intl() { _mv_ext intl; }
json() { _mv_ext json; }
ldap() { _mv_ext ldap; }
mcrypt() { _mv_ext mcrypt; }
mysql() { _mv_ext mysql; }
mysqli() { _mv_ext mysqli; }
odbc() { _mv_ext odbc unixodbc; }
openssl() { _mv_ext openssl; }
pdo() { _mv_ext pdo; }
pdo_mysql() { _mv_ext pdo_mysql php-pdo; }
pdo_odbc() { _mv_ext pdo_odbc php-pdo; }
pdo_pgsql() { _mv_ext pdo_pgsql php-pdo; }
pdo_sqlite() { _mv_ext pdo_sqlite php-pdo; }
pgsql() { _mv_ext pgsql; }
phar() {
_mv_ext phar
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/
}
posix() { _mv_ext posix; }
pspell() { _mv_ext pspell; }
shmop() { _mv_ext shmop; }
snmp() { _mv_ext snmp; }
soap() { _mv_ext soap; }
sockets() { _mv_ext sockets; }
sqlite3() { _mv_ext sqlite3; }
sysvmsg() { _mv_ext sysvmsg; }
sysvsem() { _mv_ext sysvsem; }
sysvshm() { _mv_ext sysvshm; }
xml() { _mv_ext xml; }
xmlreader() { _mv_ext xmlreader php-dom; }
xmlrpc() { _mv_ext xmlrpc php-xml; }
xsl() { _mv_ext xsl php-dom; }
zip() { _mv_ext zip; }
zlib() { _mv_ext zlib; }
mssql() { _mv_ext mssql; }
pdo_dblib() { _mv_ext pdo_dblib "php-pdo freetds"; }
wddx() { _mv_ext wddx; }
opcache() { _mv_ext opcache; }
md5sums="64d0debf42bfff537d891e1fe1a4b65c php-5.6.5.tar.bz2
2e86e55c29c81282474dea27cc97b873 php-fpm.initd
67719f428f44ec004da18705cbabe2ee php5-module.conf
483bc0a85c50a9a9aedbe14a19ed4526 php-install-pear-xml.patch
162d8d079944387eab2bc80edab347ae gd-iconv.patch
b63ef63893c1c115d6dd63e8df1f17e3 php-fix-crypt.patch
cb10034c525c6544890f1a1839837e38 fix-crypt-sha.patch"
sha256sums="adab4c0775512a5ca0ae74e08efdc941d92529b75283e0f44d3f53822cdfd06d php-5.6.5.tar.bz2
375892c6997f48659f7087ccb7fac039e4bb2f375453247295caa7858b9e15b9 php-fpm.initd
ceec4d5b2a128c6a97e49830af604f0bb555bca1a86a9cd0366b828ba392257f php5-module.conf
f739ca427a1dd53a388bad0823565299c5d4a5796b1171b892884e4d7d099bab php-install-pear-xml.patch
6122bf279cdb7c387dd000761b2426969a73cf63a10a132aa98a79eb1dd259b2 gd-iconv.patch
817f6300cd0c4d97f24c3e883132d2cde0ef52d84f5c97073f9c9668d6275d6e php-fix-crypt.patch
a5db307ad2638e7e609b450abce19c98c23de54be96619b46adb69f2c5e11fa2 fix-crypt-sha.patch"
sha512sums="078a6712fc920430f81716d102ca7343587757bc7e379574c572c8f19e5e1bc41e3f552055922c148227211a352c952caa3ad5e7685504c942b5932a9a0b992f php-5.6.5.tar.bz2
2d294022f2c45b2f3229655e5883b8ccab6852ed0378df682b9dd85a31038666ad3a622580861ce2d26dedf187326727ecf93694eb716271e9be25f79daddae9 php-fpm.initd
895e94c791bd82060ad820fef049d366a09c932097faa6b7b9a2c2e9e00a18cb7c0f9b128679c7659b404379266fd0f95dba5c0333f626194cf60f7bf6044102 php5-module.conf
f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 php-install-pear-xml.patch
59443fb464f49ff7d9b64739df982e7240f9d4792226d96ad1538286945125fc7eb6f0cab88b64d5c81ee3679fd89bffdca59ebd20eca2778ab801ee54529028 gd-iconv.patch
febe75305b19ca7c2b4f85ee8144d3a347530044223619b28fb754485f72fe3dd283ece341d77f2e0bff3881ed7fa2b89e6c95a8e4b077ab40b3f7a8d767a633 php-fix-crypt.patch
d3b156dc7fca33c5634ace04bc7b7f27174d58d09455adf5bcdafd748a6aab1b1c97dce588d218b95d5fde3f6c2dd9202f4d7ea1c3b323be400f4d990c39290b fix-crypt-sha.patch"
|