php: Fix opcache by using MAP_ANON support
[termux-packages] / packages / php / build.sh
1 TERMUX_PKG_HOMEPAGE=https://php.net
2 TERMUX_PKG_DESCRIPTION="Server-side, HTML-embedded scripting language"
3 TERMUX_PKG_VERSION=7.2.3
4 TERMUX_PKG_REVISION=2
5 TERMUX_PKG_SHA256=b3a94f1b562f413c0b96f54bc309706d83b29ac65d9b172bc7ed9fb40a5e651f
6 TERMUX_PKG_SRCURL=http://www.php.net/distributions/php-${TERMUX_PKG_VERSION}.tar.xz
7 # Build native php for phar to build (see pear-Makefile.frag.patch):
8 TERMUX_PKG_HOSTBUILD=true
9 # Build the native php without xml support as we only need phar:
10 TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="--disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear"
11 TERMUX_PKG_DEPENDS="libandroid-glob, libxml2, liblzma, openssl, pcre, libbz2, libcrypt, libcurl, libgd, readline, freetype"
12 # mysql modules were initially shared libs
13 TERMUX_PKG_CONFLICTS="php-mysql"
14 TERMUX_PKG_REPLACES="php-mysql"
15 TERMUX_PKG_RM_AFTER_INSTALL="php/php/fpm"
16
17 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
18 ac_cv_func_res_nsearch=no
19 --enable-bcmath
20 --enable-calendar
21 --enable-exif
22 --enable-gd-native-ttf=$TERMUX_PREFIX
23 --enable-mbstring
24 --enable-opcache
25 --enable-pcntl
26 --enable-sockets
27 --enable-zip
28 --mandir=$TERMUX_PREFIX/share/man
29 --with-bz2=$TERMUX_PREFIX
30 --with-curl=$TERMUX_PREFIX
31 --with-freetype-dir=$TERMUX_PREFIX
32 --with-gd=$TERMUX_PREFIX
33 --with-iconv=$TERMUX_PREFIX
34 --with-libxml-dir=$TERMUX_PREFIX
35 --with-openssl=$TERMUX_PREFIX
36 --with-pcre-regex=$TERMUX_PREFIX
37 --with-png-dir=$TERMUX_PREFIX
38 --with-readline=$TERMUX_PREFIX
39 --with-zlib
40 --with-pgsql=shared,$TERMUX_PREFIX
41 --with-pdo-pgsql=shared,$TERMUX_PREFIX
42 --with-mysqli=mysqlnd
43 --with-pdo-mysql=mysqlnd
44 --with-mysql-sock=$TERMUX_PREFIX/tmp/mysqld.sock
45 --with-apxs2=$TERMUX_PREFIX/bin/apxs
46 --enable-fpm
47 --sbindir=$TERMUX_PREFIX/bin
48 "
49
50 termux_step_pre_configure () {
51 LDFLAGS+=" -landroid-glob -llog"
52
53 export PATH=$PATH:$TERMUX_PKG_HOSTBUILD_DIR/sapi/cli/
54 export NATIVE_PHP_EXECUTABLE=$TERMUX_PKG_HOSTBUILD_DIR/sapi/cli/php
55
56 # Run autoconf since we have patched config.m4 files.
57 autoconf
58
59 export EXTENSION_DIR=$TERMUX_PREFIX/lib/php
60 }
61
62 termux_step_post_configure () {
63 # Avoid src/ext/gd/gd.c trying to include <X11/xpm.h>:
64 sed -i 's/#define HAVE_GD_XPM 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h
65 # Avoid src/ext/standard/dns.c trying to use struct __res_state:
66 sed -i 's/#define HAVE_RES_NSEARCH 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h
67 }
68
69 termux_step_post_make_install () {
70 mkdir -p $TERMUX_PREFIX/etc/php-fpm.d
71 cp sapi/fpm/php-fpm.conf $TERMUX_PREFIX/etc/
72 cp sapi/fpm/www.conf $TERMUX_PREFIX/etc/php-fpm.d/
73
74 sed -i 's/SED=.*/SED=sed/' $TERMUX_PREFIX/bin/phpize
75 }