From e054b9eb4206af8ded645c018f0a731257da5629 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 10 Nov 2015 17:39:00 -0500 Subject: [PATCH] Add php package (closes #46) --- packages/php/build.sh | 24 ++++++++++ packages/php/ext-fileinfo-config.m4.patch | 13 ++++++ packages/php/ext-opcache-config.m4.patch | 35 +++++++++++++++ packages/php/ext-posix-posix.c.patch | 13 ++++++ .../php/ext-standard-basic_functions.c.patch | 44 +++++++++++++++++++ packages/php/ext-standard-dns.c.patch | 29 ++++++++++++ packages/php/pear-Makefile.frag.patch | 21 +++++++++ 7 files changed, 179 insertions(+) create mode 100644 packages/php/build.sh create mode 100644 packages/php/ext-fileinfo-config.m4.patch create mode 100644 packages/php/ext-opcache-config.m4.patch create mode 100644 packages/php/ext-posix-posix.c.patch create mode 100644 packages/php/ext-standard-basic_functions.c.patch create mode 100644 packages/php/ext-standard-dns.c.patch create mode 100644 packages/php/pear-Makefile.frag.patch diff --git a/packages/php/build.sh b/packages/php/build.sh new file mode 100644 index 000000000..f3d9e1806 --- /dev/null +++ b/packages/php/build.sh @@ -0,0 +1,24 @@ +TERMUX_PKG_HOMEPAGE=http://php.net/ +TERMUX_PKG_DESCRIPTION="Server-side, HTML-embedded scripting language" +TERMUX_PKG_VERSION=5.6.15 +TERMUX_PKG_SRCURL=http://php.net/get/php-${TERMUX_PKG_VERSION}.tar.xz/from/this/mirror +TERMUX_PKG_FOLDERNAME=php-${TERMUX_PKG_VERSION} +TERMUX_PKG_DEPENDS="libxml2, liblzma" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--without-iconv" +# http://php.net/manual/en/libxml.installation.php +# "If configure cannot find xml2-config in the directory specified by --with-libxml-dir, +# then it'll continue on and check the default locations." +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-libxml-dir=$TERMUX_PREFIX" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-phar" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_res_nsearch=no" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --mandir=$TERMUX_PREFIX/share/man" + +termux_step_pre_configure () { + # Run autoconf since we have patched config.m4 files. + cd $TERMUX_PKG_SRCDIR + autoconf +} + +termux_step_post_configure () { + perl -p -i -e 's/#define HAVE_RES_NSEARCH 1//' $TERMUX_PKG_BUILDDIR/main/php_config.h +} diff --git a/packages/php/ext-fileinfo-config.m4.patch b/packages/php/ext-fileinfo-config.m4.patch new file mode 100644 index 000000000..fc1e87e35 --- /dev/null +++ b/packages/php/ext-fileinfo-config.m4.patch @@ -0,0 +1,13 @@ +diff -u -r ../php-5.6.15/ext/fileinfo/config.m4 ./ext/fileinfo/config.m4 +--- ../php-5.6.15/ext/fileinfo/config.m4 2015-10-29 05:55:01.000000000 -0400 ++++ ./ext/fileinfo/config.m4 2015-11-10 15:12:46.711364773 -0500 +@@ -46,6 +46,9 @@ + AC_MSG_RESULT(no) + AC_MSG_NOTICE(using libmagic strcasestr implementation) + libmagic_sources="$libmagic_sources libmagic/strcasestr.c" ++ ],[ ++ AC_MSG_RESULT(yes) ++ AC_MSG_NOTICE(cross compiling - assuming strcasestr works) + ]) + + PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic) diff --git a/packages/php/ext-opcache-config.m4.patch b/packages/php/ext-opcache-config.m4.patch new file mode 100644 index 000000000..3a54724cd --- /dev/null +++ b/packages/php/ext-opcache-config.m4.patch @@ -0,0 +1,35 @@ +diff -u -r ../php-5.6.15/ext/opcache/config.m4 ./ext/opcache/config.m4 +--- ../php-5.6.15/ext/opcache/config.m4 2015-10-29 05:55:01.000000000 -0400 ++++ ./ext/opcache/config.m4 2015-11-10 15:24:37.080935147 -0500 +@@ -341,7 +341,15 @@ + flock_type=linux + AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) + AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++], [ ++ AC_MSG_RESULT("no") ++], [ ++ dnl cross-compiling; assume Linux ++ flock_type=linux ++ AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) ++ AC_MSG_RESULT("yes") ++]) ++ + + AC_MSG_CHECKING("whether flock struct is BSD ordered") + AC_TRY_RUN([ +@@ -357,7 +365,13 @@ + flock_type=bsd + AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) + AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++], [ ++ AC_MSG_RESULT("no") ++], [ ++ dnl cross-compiling; assume Linux ++ AC_MSG_RESULT("no") ++]) ++ + + if test "$flock_type" == "unknown"; then + AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) diff --git a/packages/php/ext-posix-posix.c.patch b/packages/php/ext-posix-posix.c.patch new file mode 100644 index 000000000..3b3d35b2f --- /dev/null +++ b/packages/php/ext-posix-posix.c.patch @@ -0,0 +1,13 @@ +diff -u -r ../php-5.6.15/ext/posix/posix.c ./ext/posix/posix.c +--- ../php-5.6.15/ext/posix/posix.c 2015-10-29 05:55:01.000000000 -0400 ++++ ./ext/posix/posix.c 2015-11-10 15:38:41.542443608 -0500 +@@ -1098,7 +1098,9 @@ + add_assoc_string(return_value, "passwd", pw->pw_passwd, 1); + add_assoc_long (return_value, "uid", pw->pw_uid); + add_assoc_long (return_value, "gid", pw->pw_gid); ++#ifdef __LP64__ + add_assoc_string(return_value, "gecos", pw->pw_gecos, 1); ++#endif + add_assoc_string(return_value, "dir", pw->pw_dir, 1); + add_assoc_string(return_value, "shell", pw->pw_shell, 1); + return 1; diff --git a/packages/php/ext-standard-basic_functions.c.patch b/packages/php/ext-standard-basic_functions.c.patch new file mode 100644 index 000000000..a90971c55 --- /dev/null +++ b/packages/php/ext-standard-basic_functions.c.patch @@ -0,0 +1,44 @@ +diff -u -r ../php-5.6.15/ext/standard/basic_functions.c ./ext/standard/basic_functions.c +--- ../php-5.6.15/ext/standard/basic_functions.c 2015-10-29 05:55:01.000000000 -0400 ++++ ./ext/standard/basic_functions.c 2015-11-10 16:01:20.858601990 -0500 +@@ -1834,6 +1834,7 @@ + ZEND_END_ARG_INFO() + /* }}} */ + /* {{{ password.c */ ++#if HAVE_CRYPT + ZEND_BEGIN_ARG_INFO_EX(arginfo_password_hash, 0, 0, 2) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, algo) +@@ -1851,6 +1852,7 @@ + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, hash) + ZEND_END_ARG_INFO() ++#endif + /* }}} */ + /* {{{ proc_open.c */ + #ifdef PHP_CAN_SUPPORT_PROC_OPEN +@@ -2860,12 +2862,14 @@ + PHP_FE(base64_decode, arginfo_base64_decode) + PHP_FE(base64_encode, arginfo_base64_encode) + ++#if HAVE_CRYPT + PHP_FE(password_hash, arginfo_password_hash) + PHP_FE(password_get_info, arginfo_password_get_info) + PHP_FE(password_needs_rehash, arginfo_password_needs_rehash) + PHP_FE(password_verify, arginfo_password_verify) + PHP_FE(convert_uuencode, arginfo_convert_uuencode) + PHP_FE(convert_uudecode, arginfo_convert_uudecode) ++#endif + + PHP_FE(abs, arginfo_abs) + PHP_FE(ceil, arginfo_ceil) +@@ -3620,7 +3624,9 @@ + BASIC_MINIT_SUBMODULE(browscap) + BASIC_MINIT_SUBMODULE(standard_filters) + BASIC_MINIT_SUBMODULE(user_filters) ++#if HAVE_CRYPT + BASIC_MINIT_SUBMODULE(password) ++#endif + + #if defined(HAVE_LOCALECONV) && defined(ZTS) + BASIC_MINIT_SUBMODULE(localeconv) diff --git a/packages/php/ext-standard-dns.c.patch b/packages/php/ext-standard-dns.c.patch new file mode 100644 index 000000000..35dd3cd27 --- /dev/null +++ b/packages/php/ext-standard-dns.c.patch @@ -0,0 +1,29 @@ +diff -u -r ../php-5.6.15/ext/standard/dns.c ./ext/standard/dns.c +--- ../php-5.6.15/ext/standard/dns.c 2015-10-29 05:55:01.000000000 -0400 ++++ ./ext/standard/dns.c 2015-11-10 16:05:47.473119979 -0500 +@@ -938,7 +938,7 @@ + + /* Skip QD entries, they're only used by dn_expand later on */ + while (qd-- > 0) { +- n = dn_skipname(cp, end); ++ n = __dn_skipname(cp, end); + if (n < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse DNS data received"); + zval_dtor(return_value); +@@ -1049,14 +1049,14 @@ + cp = (u_char *)&ans + HFIXEDSZ; + end = (u_char *)&ans +i; + for (qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) { +- if ((i = dn_skipname(cp, end)) < 0 ) { ++ if ((i = __dn_skipname(cp, end)) < 0 ) { + php_dns_free_handle(handle); + RETURN_FALSE; + } + } + count = ntohs((unsigned short)hp->ancount); + while (--count >= 0 && cp < end) { +- if ((i = dn_skipname(cp, end)) < 0 ) { ++ if ((i = __dn_skipname(cp, end)) < 0 ) { + php_dns_free_handle(handle); + RETURN_FALSE; + } diff --git a/packages/php/pear-Makefile.frag.patch b/packages/php/pear-Makefile.frag.patch new file mode 100644 index 000000000..5a2b678b4 --- /dev/null +++ b/packages/php/pear-Makefile.frag.patch @@ -0,0 +1,21 @@ +diff -u -r ../php-5.6.15/pear/Makefile.frag ./pear/Makefile.frag +--- ../php-5.6.15/pear/Makefile.frag 2015-10-29 05:55:01.000000000 -0400 ++++ ./pear/Makefile.frag 2015-11-10 16:27:03.754982330 -0500 +@@ -11,7 +11,7 @@ + PEAR_SUFFIX = -ds a$(program_suffix) + + install-pear-installer: $(SAPI_CLI_PATH) +- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX} ++ php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX} + + install-pear: + @echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/" +@@ -24,7 +24,7 @@ + elif test ! -z "$(FETCH)" && test -x "$(FETCH)"; then \ + "$(FETCH)" -o $(builddir)/ http://pear.php.net/install-pear-nozlib.phar; \ + else \ +- $(top_builddir)/sapi/cli/php -n $(srcdir)/fetch.php http://pear.php.net/install-pear-nozlib.phar $(builddir)/install-pear-nozlib.phar; \ ++ php -n $(srcdir)/fetch.php http://pear.php.net/install-pear-nozlib.phar $(builddir)/install-pear-nozlib.phar; \ + fi \ + fi \ + fi