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