aboutsummaryrefslogtreecommitdiffstats
path: root/community/php7/APKBUILD
blob: 24aba0dd9b26a4f62af87b155cb2a0f288ca1d34 (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
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
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=php7
_pkgreal=php
pkgver=7.1.4
pkgrel=0
_suffix=${pkgname#php}
pkgdesc="The PHP$_suffix language runtime engine"
url="http://www.php.net/"
arch="all"
license="PHP-3"
options=""
depends="$pkgname-common"
depends_dom="$pkgname-xml"
depends_mysqli="$pkgname-mysqlnd"
depends_mysqlnd="$pkgname-openssl"
depends_pdo_mysql="$pkgname-mysqlnd"
depends_phar="$pkgname"
depends_soap="$pkgname-xml"
depends_wddx="$pkgname-xml"
depends_xmlreader="$pkgname-dom"
depends_xmlrpc="$pkgname-xml"
depends_xsl="$pkgname-dom"
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
	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 libxpm-dev
	libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev
	"
source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
	$pkgname-fpm.initd
	$pkgname-fpm.logrotate
	$pkgname-module.conf
	install-pear.patch
	includedir.patch
	fix-asm-constraints-in-aarch64-multiply-macro.patch
	php7-fpm-version-suffix.patch
	allow-build-recode-and-imap-together.patch
	"
builddir="$srcdir/$_pkgreal-$pkgver"

_libdir="/usr/lib/$pkgname"
_extension_dir="$_libdir/modules"
_extension_confd="/etc/$pkgname/conf.d"

_exts="bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo ftp gd gettext gmp iconv imap intl json
	ldap mbstring mcrypt mysqli mysqlnd odbc opcache openssl pcntl pdo pdo_dblib pdo_mysql
	pdo_odbc pdo_pgsql pdo_sqlite pgsql phar:phar posix pspell recode session shmop simplexml snmp soap
	sockets sqlite3 sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg $pkgname-embed
	$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch
	"
for _ext in $_exts; do
	case "$_ext" in
	*:*) subpackages="$subpackages $pkgname-$_ext";;
	*) subpackages="$subpackages $pkgname-$_ext:_package_ext";;
	esac
done
subpackages="$subpackages $pkgname-common::noarch"

_apiver="20160303"

prepare() {
	cd "$builddir"

	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"
		return 1
	fi
	autoconf
}

_build() {
	[ "$CARCH" = "s390x" ] && _disable_pcre_jit="--without-pcre-jit"

	EXTENSION_DIR=$_extension_dir ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--program-suffix=$_suffix \
		--libdir=$_libdir \
		--datadir=/usr/share/$pkgname \
		--sysconfdir=/etc/$pkgname \
		--localstatedir=/var \
		--with-layout=GNU \
		--with-pic \
		--with-pear=/usr/share/$pkgname \
		--with-config-file-path=/etc/$pkgname \
		--with-config-file-scan-dir=$_extension_confd \
		--disable-short-tags \
		--with-openssl=shared --with-kerberos --with-system-ciphers \
		--with-pcre-regex=/usr --with-pcre-dir \
		$_disable_pcre_jit \
		--with-zlib=shared --with-zlib-dir \
		--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-enchant=shared \
		--enable-exif=shared \
		--enable-fileinfo=shared \
		--enable-ftp=shared \
		--with-gd=shared --with-webp-dir=shared --with-jpeg-dir=shared --with-png-dir=shared --with-xpm-dir=shared \
		--with-freetype-dir=shared --enable-gd-native-ttf --enable-gd-jis-conv \
		--with-gettext=shared \
		--with-gmp=shared \
		--with-iconv=shared \
		--with-imap=shared --with-imap-ssl \
		--enable-intl=shared --with-icu-dir=/usr \
		--enable-json=shared \
		--enable-libxml=shared --with-libxml-dir=shared --with-libexpat-dir=shared \
		--with-ldap=shared --with-ldap-sasl \
		--enable-mbstring=shared --enable-mbregex \
		--with-mcrypt=shared \
		--with-sqlite3=shared,/usr --with-pdo-sqlite=shared,/usr \
		--with-pdo-dblib=shared \
		--with-mysqli=shared,mysqlnd \
		--enable-mysqlnd=shared --with-pdo-mysql=shared,mysqlnd --with-mysql-sock=/run/mysqld/mysqld.sock \
		--with-pgsql=shared --with-pdo-pgsql=shared \
		--with-unixODBC=shared,/usr -with-pdo-odbc=shared,unixODBC,/usr \
		--with-dbmaker=shared \
		--enable-opcache=shared \
		--enable-pdo=shared \
		--enable-pcntl=shared \
		--enable-posix=shared \
		--enable-phar=shared \
		--with-pspell=shared \
		--without-readline \
		--with-libedit \
		--with-recode=shared \
		--enable-session=shared \
		--enable-shmop=shared \
		--enable-simplexml=shared \
		--with-snmp=shared \
		--enable-soap=shared \
		--enable-sockets=shared \
		--enable-sysvmsg=shared \
		--enable-sysvsem=shared \
		--enable-sysvshm=shared \
		--with-tidy=shared \
		--enable-tokenizer=shared \
		--enable-xml=shared \
		--enable-xmlreader=shared \
		--with-xmlrpc=shared \
		--enable-xmlwriter=shared \
		--with-xsl=shared \
		--enable-wddx=shared \
		--enable-zip=shared --with-libzip=shared \
		$@ || return 1
	make || return 1
}

build() {
	cd "$builddir"

	# phpdbg
	_build --enable-phpdbg \
		--enable-phpdbg \
		--enable-phpdbg-webhelper \
		--disable-cgi \
		--disable-cli \
		|| return 1
	# apache2 module
	_build --disable-phpdbg \
		--disable-cgi \
		--disable-cli \
		--with-apxs2 \
		|| return 1
	mv libs/libphp$_suffix.so sapi/apache2handler/mod_php$_suffix.so
	# cgi,cli,fpm,embed,litespeed
	_build --disable-phpdbg \
		--enable-fpm \
		--enable-embed \
		--with-litespeed \
		|| return 1
}

package() {
	cd "$builddir"

	make -j1 INSTALL_ROOT="$pkgdir" install || return 1

	install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini || return 1

	local file; for file in pear peardev pecl; do
		sed -i -e "s~/usr/bin/php~/usr/bin/php$_suffix~g" \
			-e "s~PHP=php~PHP=php$_suffix~" \
			"$pkgdir"/usr/bin/$file || return 1
	done

	find "$pkgdir" -name '.*' | xargs rm -rf || return 1
	rmdir "$pkgdir"/var/run
}

dev() {
	default_dev
	replaces="php-dev"
	depends="$depends $pkgname $pkgname-pear"

	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/$_libdir || return 1

	mv "$pkgdir"/usr/bin/php-config$_suffix \
		"$pkgdir"/usr/bin/phpize$_suffix \
		"$pkgdir"/usr/bin/peardev \
		"$subpkgdir"/usr/bin/ || return 1

	mv "$pkgdir"/$_libdir/build \
		"$subpkgdir"/$_libdir/ || return 1

	ln -s phpize$_suffix "$subpkgdir"/usr/bin/phpize
	ln -s php-config$_suffix "$subpkgdir"/usr/bin/php-config
}

doc() {
	default_doc

	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname

	local file
	for file in CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README* UPGRADING*; do
		cp "$builddir"/$file "$subpkgdir"/usr/share/doc/$pkgname/ || return 1
	done
}

apache2() {
	pkgdesc="PHP Module for Apache2"
	depends="$pkgname-common apache2"

	install -D -m755 "$builddir"/sapi/apache2handler/mod_php$_suffix.so \
		"$subpkgdir"/usr/lib/apache2/mod_php$_suffix.so || return 1

	install -D -m644 "$srcdir"/php$_suffix-module.conf \
		"$subpkgdir"/etc/apache2/conf.d/php$_suffix-module.conf
}

phpdbg() {
	pkgdesc="Interactive PHP debugger"
	depends="$pkgname-common"

	install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \
		"$subpkgdir"/usr/bin/phpdbg$_suffix
}

embed() {
	pkgdesc="PHP Embedded Library"
	depends="$pkgname-common"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/
}

litespeed() {
	pkgdesc="PHP LiteSpeed SAPI"
	depends="$pkgname-common"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp$_suffix
}

cgi() {
	pkgdesc="PHP Common Gateway Interface"
	depends="$pkgname-common"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/php-cgi$_suffix "$subpkgdir"/usr/bin/
	ln -s php-cgi$_suffix "$subpkgdir"/usr/bin/php-cgi
}

fpm() {
	pkgdesc="PHP FastCGI Process Manager"
	depends="$pkgname-common"

	mv "$pkgdir"/var "$subpkgdir"/ || return 1

	mkdir -p "$subpkgdir"/etc/$pkgname \
		"$subpkgdir"/usr \
		"$subpkgdir"/var/lib \
		"$subpkgdir"/var/log/$pkgname

	mv "$pkgdir"/usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname/ || return 1
	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/ || 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 -D -m755 "$srcdir"/$pkgname-fpm.initd \
		"$subpkgdir"/etc/init.d/php-fpm$_suffix || return 1
	install -D -m644 "$srcdir"/$pkgname-fpm.logrotate \
		"$subpkgdir"/etc/logrotate.d/php-fpm$_suffix
}

pear() {
	pkgdesc="PHP Extension and Application Repository"
	depends="$pkgname $pkgname-xml"

	# pecl needs xml extension and since we build it as shared, it must be
	# explicitly declared to be loaded.
	sed -i 's/\$INCARG/& -d extension=xml.so/' \
		"$pkgdir"/usr/bin/pecl || return 1

	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/etc/$pkgname

	local file; for file in pecl pear; do
		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/
	done
	mv "$pkgdir"/etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ || return 1
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
}

common() {
	pkgdesc="$pkgdesc (common config)"
	depends=""

	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1
	mv "$pkgdir"/etc "$subpkgdir"/ || return 1

	mkdir -p "$subpkgdir"/$_extension_confd
}

phar() {
	_package_ext || return 1
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/
}

_package_ext() {
	local extname="${subpkgname#$pkgname-}"
	local extdepends="$(eval "echo \$depends_$extname")"
	pkgdesc="PHP$_suffix extension: $extname"
	depends="$depends $extdepends"

	case "$extname" in
	pdo_*) depends="$depends $pkgname-pdo"
	esac

	# extension dependencies and loading order
	local elo=00
	[ -z "$extdepends" ] || elo=01

	# extension prefix
	local prefix=
	[ "$extname" != "opcache" ] || prefix="zend_"

	mkdir -p "$subpkgdir"/$_extension_dir \
		"$subpkgdir"/$_extension_confd

	mv "$pkgdir"/$_extension_dir/$extname.so \
		"$subpkgdir"/$_extension_dir/ || return 1

	echo "${prefix}extension=$extname.so" \
		> "$subpkgdir"/$_extension_confd/${elo}_${extname}.ini
}

sha512sums="a1dd5ffd756176e6ba600dd850510033d0d6f07aff314de69fec0c42437e6a006449e3f4f98679146a2f2645caa65ea351e31a8e1da7c14cc5260856ad40eaff  php-7.1.4.tar.bz2
1c708de82d1086f272f484faf6cf6d087af7c31750cc2550b0b94ed723961b363f28a947b015b2dfc0765caea185a75f5d2c2f2b099c948b65c290924f606e4f  php7-fpm.initd
cacce7bf789467ff40647b7319e3760c6c587218720538516e8d400baa75651f72165c4e28056cd0c1dc89efecb4d00d0d7823bed80b29136262c825ce816691  php7-fpm.logrotate
fbf9a1572d37370ec0d126502e1d066e045a992484d8fc4f1e2ede330134c1a15f4029f29fa4daebd48eed78b045dc051ced69fbf1f11efc7ad81d884a639a99  php7-module.conf
f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505  install-pear.patch
199aecdbd3b4035aabf5379c215f82412d3c98b79a1ee186944e7fe1f0ed6f40789ea30e2355149491de6be34fc66c5e486e2a79a7e41ab2ae18706ef3ffe79b  includedir.patch
d93d3fc015580cf5f75c6cbca4cd980e054b61e1068495da81a7e61f1af2c9ae14f09964c04928ad338142de78e4844aed885b1ad1865282072999fb045c8ad7  fix-asm-constraints-in-aarch64-multiply-macro.patch
a4c35446745ab0ac806de801f0651fc5d2c98cf60063c3c2d3963a84f1c71ef78e09b7650c08e7231be0fdb93c0c255de38894d7f0e4f4c5a190d17f1a6bc476  php7-fpm-version-suffix.patch
f8ecae241a90cbc3e98aa4deb3d5d35ef555f51380e29f4e182a8060dffeb84be74f030a14c6b452668471030d78964f52795ca74275db05543ccad20ef1f2cc  allow-build-recode-and-imap-together.patch"