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
|
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=php7.1
pkgver=7.1.2
pkgrel=7
_apiver=20160303
_suffix=${pkgname#php}
_pkgreal=${pkgname%$_suffix}
pkgdesc="The PHP$_suffix language runtime engine"
url="http://www.php.net/"
arch="all"
license="PHP-3"
options="!check"
depends="$pkgname-config"
depends_dev="$pkgname"
replaces="$_pkgreal $_pkgreal-cli"
provides="$replaces $pkgname-cli"
makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-dev bzip2-dev zlib-dev
aspell-dev enchant-dev expat-dev pcre-dev curl-dev gmp-dev icu-dev imap-dev gd-dev
libical-dev libressl-dev openldap-dev net-snmp-dev db-dev krb5-dev gdbm-dev sqlite-dev
freetds-dev postgresql-dev unixodbc-dev freetype-dev tidyhtml-dev libwebp-dev
libpng-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev
"
source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
$pkgname-module.conf
$pkgname-fpm.logrotate
$pkgname-fpm.initd
$pkgname-fpm.patch
$pkgname-includedir.patch
install-pear.patch
getrandom.patch
"
# unimplemented extensions: com_dotnet interbase oci8 pdo_firebird pdo_oci
_extension_dir=/usr/lib/$pkgname
_extension_conf=/etc/$pkgname/conf.d
_extensions="bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo ftp gd gettext gmp iconv imap:1
intl json ldap mbstring mcrypt mysqli:1 mysqlnd odbc opcache openssl pcntl pdo pdo_dblib pdo_mysql
pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell recode session shmop snmp soap sockets
sqlite3 sysvmsg sysvsem sysvshm tidy wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib
"
for _extension in $_extensions; do
[ -z "${_extension##*:*}" ] && eval _index_${_extension%:*}=${_extension#*:}
subpackages="$subpackages $pkgname-${_extension%:*}:_extension"
done
_prefix_opcache="zend_"
_pkgdesc_opcache="Zend OPcache"
_depends_mysqlnd="$pkgname-openssl"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-apache2 $pkgname-phpdbg
$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch $pkgname-pecl::noarch
$pkgname-phar-utils:_phar:noarch $subpackages $pkgname-config::noarch"
builddir="$srcdir/$_pkgreal-$pkgver"
prepare() {
cd "$builddir"
sed "$(($(grep -n 'Pool Definitions' sapi/fpm/php-fpm.conf.in | cut -d: -f1)+3)),\$d" \
-i sapi/fpm/php-fpm.conf.in && \
echo include=@php_fpm_sysconfdir@/php-fpm.d/*.conf >> \
sapi/fpm/php-fpm.conf.in
default_prepare || return 1
update_config_sub || return 1
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 $_apiver"
error "After updating _apiver, all 3rd-party extensions must be rebuilt"
return 1
fi
autoconf
}
# Notes to ./configure parameters
# recode and imap are defined in build function because can't build together
# --with-libgd -- do not swith to system-wide libgd - runtime bugs.
# --with-xmlrpc -- do not swith to system-wide xmlrpc - build errors.
_build() {
./configure \
EXTENSION_DIR=$_extension_dir \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--program-suffix=$_suffix \
--libdir=$_extension_dir \
--datadir=/usr/share/$pkgname \
--sysconfdir=/etc/$pkgname \
--localstatedir=/var \
--with-layout=GNU \
--with-pic \
--with-pear=/usr/share/pear \
--with-config-file-path=/etc/$pkgname \
--with-config-file-scan-dir=$_extension_conf \
--disable-short-tags \
--without-readline \
--with-libedit \
--enable-bcmath=shared \
--with-bz2=shared \
--enable-calendar=shared \
--enable-ctype=shared \
--with-curl=shared \
--enable-dba=shared \
--with-gdbm \
--with-db4 \
--enable-dom=shared \
--with-libxml-dir \
--with-enchant=shared \
--enable-exif=shared \
--enable-fileinfo=shared \
--enable-ftp=shared \
--with-openssl-dir \
--with-gd=shared \
--with-jpeg-dir \
--with-png-dir \
--with-webp-dir \
--with-xpm-dir=no \
--with-freetype-dir \
--enable-gd-native-ttf \
--disable-gd-jis-conv \
--with-gettext=shared \
--with-gmp=shared \
--with-iconv=shared \
--enable-intl=shared \
--with-icu-dir=/usr \
--enable-json=shared \
--enable-libxml=shared \
--with-libxml-dir \
--with-libexpat-dir \
--with-ldap=shared \
--with-ldap-sasl \
--enable-mbstring=shared \
--enable-mbregex \
--with-mcrypt=shared \
--with-mysqli=shared,mysqlnd \
CFLAGS=-DMYSQLI_NO_CHANGE_USER_ON_PCONNECT \
--enable-mysqlnd=shared \
--with-zlib-dir \
--enable-opcache=shared \
--with-openssl=shared \
--with-kerberos \
--with-system-ciphers \
--enable-pcntl=shared \
--with-pcre-regex=/usr \
--with-pcre-dir \
--enable-pdo=shared \
--with-pdo-dblib=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 \
--enable-posix=shared \
--with-pspell=shared \
--enable-session=shared \
--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-tidy=shared \
--with-unixODBC=shared,/usr \
--enable-wddx=shared \
--enable-xml=shared \
--enable-xmlreader=shared \
--with-xmlrpc=shared \
--enable-xmlwriter=shared \
--with-xsl=shared \
--enable-zip=shared \
--with-libzip \
--with-zlib=shared \
--with-zlib-dir \
$@ || return 1
make
}
build() {
cd "$builddir"
# build phpdbg
_build --enable-phpdbg \
--enable-phpdbg-webhelper \
--disable-cgi \
--disable-cli \
|| return 1
# build apache2 module + recode extension
_build --disable-phpdbg \
--disable-cgi \
--disable-cli \
--with-apxs2 \
--with-recode=shared \
|| return 1
mv libs/lib$_pkgreal*.so sapi/apache2handler/
# build all other + imap extension
_build --disable-phpdbg \
--enable-fpm \
--enable-embed \
--with-litespeed \
--with-imap=shared \
--with-imap-ssl \
|| return 1
}
package() {
pkgdesc="$pkgdesc (command line interface)"
make -C "$builddir" INSTALL_ROOT="$pkgdir" install || return 1
ln -sf /usr/bin/php$_suffix "$pkgdir"/usr/bin/php
rm -fr "$pkgdir"/.[[:alpha:]]*
}
dev() {
provides=$_pkgreal-dev
replaces=$provides
default_dev || return 1
mkdir -p "$subpkgdir"/usr/bin \
"$subpkgdir"/$_extension_dir || return 1
local file
for file in php-config phpize; do
mv "$pkgdir"/usr/bin/$file$_suffix \
"$subpkgdir"/usr/bin/ || return 1
ln -sf /usr/bin/$file$_suffix "$subpkgdir"/usr/bin/$file
done
mv "$pkgdir"/$_extension_dir/build "$subpkgdir"/$_extension_dir
}
doc() {
provides=
replaces=
default_doc || return 1
install_if="docs $pkgname-config=$pkgver-r$pkgrel"
cd "$builddir"
local file
for file in $(ls CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README* UPGRADING*); do
install -Dm644 $file "$subpkgdir"/usr/share/doc/$pkgname/$file || return 1
done
}
apache2() {
provides=$_pkgreal-apache2
replaces=
pkgdesc="$pkgdesc (apache2 module)"
depends="$pkgname-config apache2"
mkdir -p "$subpkgdir"/usr/lib/apache2 || return 1
cp "$builddir"/sapi/apache2handler/lib$_pkgreal*.so \
"$subpkgdir"/usr/lib/apache2/mod_$pkgname.so || return 1
install -Dm644 "$srcdir"/$pkgname-module.conf \
"$subpkgdir"/etc/apache2/conf.d/$pkgname-module.conf
}
phpdbg() {
provides=$_pkgreal-phpdbg
replaces=$provides
pkgdesc="$pkgdesc (interactive debugger)"
depends="$pkgname-config"
install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \
"$subpkgdir"/usr/bin/phpdbg$_suffix || return 1
ln -sf /usr/bin/phpdbg$_suffix "$subpkgdir"/usr/bin/phpdbg
}
libs() {
provides=$_pkgreal-libs
replaces=
pkgdesc="$pkgdesc (embedded library)"
depends="$pkgname-config"
mkdir -p "$subpkgdir"/usr/lib || return 1
mv "$pkgdir"/usr/lib/lib$_pkgreal*.so \
"$subpkgdir"/usr/lib/lib$pkgname.so || return 1
}
litespeed() {
provides=$_pkgreal-litespeed
replaces=$provides
pkgdesc="$pkgdesc (litespeed)"
depends="$pkgname-config"
mkdir -p "$subpkgdir"/usr/bin || return 1
mv "$pkgdir"/usr/bin/lsphp \
"$subpkgdir"/usr/bin/lsphp$_suffix || return 1
ln -sf /usr/bin/lsphp$_suffix "$subpkgdir"/usr/bin/lsphp
}
cgi() {
provides=$_pkgreal-cgi
replaces=$provides
pkgdesc="$pkgdesc (common gateway interface)"
depends="$pkgname-config"
mkdir -p "$subpkgdir"/usr/bin || return 1
mv "$pkgdir"/usr/bin/php-cgi$_suffix \
"$subpkgdir"/usr/bin/ || return 1
ln -sf /usr/bin/php-cgi$_suffix "$subpkgdir"/usr/bin/php-cgi
}
fpm() {
provides=$_pkgreal-fpm
replaces=
pkgdesc="$pkgdesc (fastcgi process manager)"
depends="$pkgname-config"
mkdir -p "$subpkgdir"/usr/share \
"$subpkgdir"/etc/$pkgname \
"$subpkgdir"/var/log/$pkgname || return 1
mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/ || return 1
mv "$pkgdir"/usr/share/$pkgname \
"$subpkgdir"/usr/share/ || return 1
mv "$pkgdir"/etc/$pkgname/php-fpm* \
"$subpkgdir"/etc/$pkgname/ || return 1
local file;
for file in php-fpm.conf php-fpm.d/www.conf; do
mv "$subpkgdir"/etc/$pkgname/$file.default \
"$subpkgdir"/etc/$pkgname/$file || return 1
done
install -Dm755 "$srcdir"/$pkgname-fpm.initd \
"$subpkgdir"/etc/init.d/$_pkgreal-fpm$_suffix || return 1
install -Dm644 "$srcdir"/$pkgname-fpm.logrotate \
"$subpkgdir"/etc/logrotate.d/$_pkgreal-fpm$_suffix || return 1
}
pear() {
provides=$_pkgreal-pear
replaces=$provides
pkgdesc="$pkgdesc (php extension and application repository)"
depends="$pkgname $pkgname-xml"
mkdir -p "$subpkgdir"/usr/bin \
"$subpkgdir"/etc/$pkgname || return 1
mv "$pkgdir"/etc/$pkgname/pear.conf \
"$subpkgdir"/etc/$pkgname/ || return 1
mv "$pkgdir"/usr/share \
"$subpkgdir"/usr/ || return 1
sed -e "s/\$INCARG/\$INCARG -d extension=xml.so/" \
-i "$pkgdir"/usr/bin/pecl || return 1
local file
for file in pear peardev pecl; do
mv "$pkgdir"/usr/bin/$file \
"$subpkgdir"/usr/bin/$file$_suffix || return 1
sed -e "s:/usr/bin/php:/usr/bin/php$_suffix:g" \
-i "$subpkgdir"/usr/bin/$file$_suffix || return 1
ln -sf /usr/bin/$file$_suffix \
"$subpkgdir"/usr/bin/$file || return 1
done
}
pecl() {
provides=$_pkgreal-pecl
replaces=
pkgdesc="$pkgdesc (php extension community library)"
depends="$pkgname-pear $pkgname-dev autoconf gcc make musl-dev"
mkdir -p "$subpkgdir"
}
config() {
provides="phpapi$_apiver"
replaces=
depends=
pkgdesc="$pkgdesc (common config)"
mkdir -p "$subpkgdir"/$_extension_conf || return 1
install -Dm644 "$builddir"/php.ini-production \
"$subpkgdir"/etc/$pkgname/php.ini || return 1
# exit with an error if some modules were not in subpackages
rmdir "$pkgdir"/$_extension_dir || return 1
rm -fr "$pkgdir"/etc "$pkgdir"/var "$pkgdir"/usr/lib
}
_phar() {
provides=$_pkgreal-phar-phar
replaces=$provides
pkgdesc="$pkgdesc (archive script)"
depends="$pkgname $pkgname-phar"
mkdir -p "$subpkgdir"/usr/bin || return 1
rm "$pkgdir"/usr/bin/phar || return 1
mv "$pkgdir"/usr/bin/phar.phar \
"$subpkgdir"/usr/bin/phar.phar$_suffix || return 1
local file
for file in phar$_suffix phar phar.phar; do
ln -sf /usr/bin/phar.phar$_suffix \
"$subpkgdir"/usr/bin/$file || return 1
done
}
_extension() {
local dep deps
local name=${subpkgname#$pkgname-}
local index=$(eval echo \${_index_$name:-0})
provides="$_pkgreal-$name"
replaces=
depends=$(eval echo \$_depends_$name)
pkgdesc=$(eval echo \$_pkgdesc_$name)
: ${pkgdesc:=$(head -n1 "$builddir"/ext/$name/CREDITS)}
pkgdesc="PHP$_suffix extension: ${pkgdesc:-$name}"
[ -f "$builddir"/ext/$name/config.w32 ] && \
deps=$(grep -o "_DEP('$name'.*" "$builddir"/ext/$name/config.w32 | sed "s/[',);]//g")
[ -f "$builddir"/ext/$name/config.m4 ] && \
deps="$deps $(grep -o "_DEP($name,.*" "$builddir"/ext/$name/config.m4 | sed "s/[,)]//g")"
for dep in $(echo -e ${deps//[[:space:]]/\\n} | sort -u); do
[ -z "${_extensions##*$dep*}" ] && depends="$depends $pkgname-$dep"
done
index=$(($(echo $depends | wc -w)+$index))
depends="$pkgname-config phpapi$_apiver $depends"
mkdir -p "$subpkgdir"/$_extension_dir \
"$subpkgdir"/$_extension_conf || return 1
mv "$pkgdir"/$_extension_dir/$name.so \
"$subpkgdir"/$_extension_dir || return 1
echo $(eval echo \$_prefix_$name)extension=$name.so > \
"$subpkgdir"/$_extension_conf/$(printf %02d $index)_$name.ini
}
sha512sums="b4a3492f4af92facd16e7dfb47ec16b43e4c5b25be193ff6e36418173893edb75ca4ca94767b643a6971d60578727fa1f67f20cc84b9a140cb1b9a367ec34a6f php-7.1.2.tar.bz2
2801d6e0656b0a9eb090c6a3eee711588515a600e1292a6ba5ce24302c57bb7feb128139c0eb7715af0ddc2f40a7a2832c6e4153fe4d3a467297957a4afb3123 php7.1-module.conf
066db134f9cd4695caf62cbb970bd13cbcf8d074a8e378945e2c6e80d3b8f4125f7cee2ee5b379359881958955d9737eb24cbfdb72d11c19bd432101ee119501 php7.1-fpm.logrotate
bf8bfbd33134acaa5395336005361519ded1062f461483c18cf69d0395c4fb950802fcfb186c9b54ac382c51e2b634341757ffff9eb7af2dcf017be5af587d1f php7.1-fpm.initd
5e5073aca1ac3c4b1163d7c943f059d00faf04f29db766a0fc1ed3aecf9b7260491c5703aff651baa7ca944d750ff0318ce66aaac5b8500f41056b5357d3fa9f php7.1-fpm.patch
3f5da2f3b904ceb14f8507b924b046dfbee601e274fd501150a78fe362983ee1209ce596e880ed5481a857c4eb9d3deba26c4c14d04fd58075be93e98436f0cd php7.1-includedir.patch
f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 install-pear.patch
da012a82c00f9dfd3b6e446e2c3e7da597079e9b428f53ca61b5e216c304e3c02e953a5fc2759e516580cb98f08e86b0f5b33ea8df99a8003ae33fcb431463b4 getrandom.patch"
|