php: handle php-apache properly (#1084)
[termux-packages] / packages / php / build.sh
CommitLineData
ecd1ff09 1TERMUX_PKG_HOMEPAGE=https://php.net
e054b9eb 2TERMUX_PKG_DESCRIPTION="Server-side, HTML-embedded scripting language"
853ac936 3TERMUX_PKG_VERSION=7.1.6
e6672754 4TERMUX_PKG_REVISION=1
ecd1ff09 5TERMUX_PKG_SRCURL=http://www.php.net/distributions/php-${TERMUX_PKG_VERSION}.tar.xz
853ac936 6TERMUX_PKG_SHA256=01584dc521ab7ec84b502b61952f573652fe6aa00c18d6d844fb9209f14b245b
e339be42
FF
7# Build native php for phar to build (see pear-Makefile.frag.patch):
8TERMUX_PKG_HOSTBUILD=true
12c87316
FF
9# Build the native php without xml support as we only need phar:
10TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="--disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear"
42a606a2 11TERMUX_PKG_DEPENDS="libandroid-glob, libxml2, liblzma, openssl, pcre, libbz2, libcrypt, libcurl, libgd, readline, freetype"
cc7bcfa2 12TERMUX_PKG_RM_AFTER_INSTALL="php/php/fpm"
2201a45d
FF
13# Building with clang causes gettype(-1) to return "double" instead of "integer".
14# See https://github.com/termux/termux-packages/issues/890
adeaac84 15TERMUX_PKG_CLANG=no
da1533a4 16
6788ea2c
FF
17TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
18ac_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
74ad4596 37--with-png-dir=$TERMUX_PREFIX
6788ea2c
FF
38--with-readline=$TERMUX_PREFIX
39--with-zlib
53530ad8
FF
40--with-pgsql=shared,$TERMUX_PREFIX
41--with-pdo-pgsql=shared,$TERMUX_PREFIX
6b78878e 42--with-apxs2=$TERMUX_PREFIX/bin/apxs
cc7bcfa2
VB
43--enable-fpm
44--sbindir=$TERMUX_PREFIX/bin
6788ea2c 45"
e054b9eb
FF
46
47termux_step_pre_configure () {
ecd1ff09 48 LDFLAGS+=" -landroid-glob -llog"
eaf33403 49
7e606cc7 50 export PATH=$PATH:$TERMUX_PKG_HOSTBUILD_DIR/sapi/cli/
e339be42
FF
51 export NATIVE_PHP_EXECUTABLE=$TERMUX_PKG_HOSTBUILD_DIR/sapi/cli/php
52
e054b9eb 53 # Run autoconf since we have patched config.m4 files.
e054b9eb 54 autoconf
cc7bcfa2
VB
55
56 export EXTENSION_DIR=$TERMUX_PREFIX/lib/php
e054b9eb
FF
57}
58
59termux_step_post_configure () {
da1533a4 60 # Avoid src/ext/gd/gd.c trying to include <X11/xpm.h>:
57ae9050 61 sed -i 's/#define HAVE_GD_XPM 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h
da1533a4 62 # Avoid src/ext/standard/dns.c trying to use struct __res_state:
57ae9050 63 sed -i 's/#define HAVE_RES_NSEARCH 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h
e054b9eb 64}
cc7bcfa2
VB
65
66termux_step_post_make_install () {
67 mkdir -p $TERMUX_PREFIX/etc/php-fpm.d
68 cp sapi/fpm/php-fpm.conf $TERMUX_PREFIX/etc/
69 cp sapi/fpm/www.conf $TERMUX_PREFIX/etc/php-fpm.d/
57ae9050
FF
70
71 sed -i 's/SED=.*/SED=sed/' $TERMUX_PREFIX/bin/phpize
cc7bcfa2 72}