php: Fix building pg extensions
[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.1.3
4 TERMUX_PKG_SRCURL=http://www.php.net/distributions/php-${TERMUX_PKG_VERSION}.tar.xz
5 TERMUX_PKG_SHA256=e4887c2634778e37fd962fbdf5c4a7d32cd708482fe07b448804625570cb0bb0
6 # Build native php for phar to build (see pear-Makefile.frag.patch):
7 TERMUX_PKG_HOSTBUILD=true
8 # Build the native php without xml support as we only need phar:
9 TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="--disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear"
10 TERMUX_PKG_DEPENDS="libandroid-glob, libxml2, liblzma, openssl, pcre, libbz2, libcrypt, libcurl, libgd, readline, freetype"
11 TERMUX_PKG_RM_AFTER_INSTALL="php/php/fpm"
12
13 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
14 ac_cv_func_res_nsearch=no
15 --enable-bcmath
16 --enable-calendar
17 --enable-exif
18 --enable-gd-native-ttf=$TERMUX_PREFIX
19 --enable-mbstring
20 --enable-opcache
21 --enable-pcntl
22 --enable-sockets
23 --enable-zip
24 --mandir=$TERMUX_PREFIX/share/man
25 --with-bz2=$TERMUX_PREFIX
26 --with-curl=$TERMUX_PREFIX
27 --with-freetype-dir=$TERMUX_PREFIX
28 --with-gd=$TERMUX_PREFIX
29 --with-iconv=$TERMUX_PREFIX
30 --with-libxml-dir=$TERMUX_PREFIX
31 --with-openssl=$TERMUX_PREFIX
32 --with-pcre-regex=$TERMUX_PREFIX
33 --with-readline=$TERMUX_PREFIX
34 --with-zlib
35 --with-pgsql=shared,$TERMUX_PREFIX
36 --with-pdo-pgsql=shared,$TERMUX_PREFIX
37 --enable-fpm
38 --sbindir=$TERMUX_PREFIX/bin
39 "
40
41 termux_step_pre_configure () {
42 LDFLAGS+=" -landroid-glob -llog"
43
44 export PATH=$PATH:$TERMUX_PKG_HOSTBUILD_DIR/sapi/cli/
45 export NATIVE_PHP_EXECUTABLE=$TERMUX_PKG_HOSTBUILD_DIR/sapi/cli/php
46
47 # Run autoconf since we have patched config.m4 files.
48 cd $TERMUX_PKG_SRCDIR
49 autoconf
50
51 export EXTENSION_DIR=$TERMUX_PREFIX/lib/php
52 }
53
54 termux_step_post_configure () {
55 # Avoid src/ext/gd/gd.c trying to include <X11/xpm.h>:
56 perl -p -i -e 's/#define HAVE_GD_XPM 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h
57 # Avoid src/ext/standard/dns.c trying to use struct __res_state:
58 perl -p -i -e 's/#define HAVE_RES_NSEARCH 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h
59 }
60
61 termux_step_post_make_install () {
62 mkdir -p $TERMUX_PREFIX/etc/php-fpm.d
63 cp sapi/fpm/php-fpm.conf $TERMUX_PREFIX/etc/
64 cp sapi/fpm/www.conf $TERMUX_PREFIX/etc/php-fpm.d/
65 }