aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorale <ale@FreeBSD.org>2014-07-07 17:50:00 +0800
committerale <ale@FreeBSD.org>2014-07-07 17:50:00 +0800
commitde4215fa3a1125c715fe962538f3d98fee892494 (patch)
tree2db338a1a6724221bc2e43b06cf942d9ccc4cdc2
parentc061de05901d8333137202de9c0c984e260c4515 (diff)
downloadfreebsd-ports-gnome-de4215fa3a1125c715fe962538f3d98fee892494.tar.gz
freebsd-ports-gnome-de4215fa3a1125c715fe962538f3d98fee892494.tar.zst
freebsd-ports-gnome-de4215fa3a1125c715fe962538f3d98fee892494.zip
- Update to 5.5.14 release
- Add extra patch to enable ipv6 support in fpm [1] PR: 190190 [1] Submitted by: melvyn@magemana.nl
-rw-r--r--lang/php55/Makefile8
-rw-r--r--lang/php55/distinfo4
-rw-r--r--lang/php55/files/extra-patch-php-fpm-ipv6215
-rw-r--r--lang/php55/files/patch-ext_standard_basic_functions.c20
4 files changed, 223 insertions, 24 deletions
diff --git a/lang/php55/Makefile b/lang/php55/Makefile
index 59d655cf63c8..f0d31ee2b121 100644
--- a/lang/php55/Makefile
+++ b/lang/php55/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= php55
-PORTVERSION= 5.5.13
+PORTVERSION= 5.5.14
PORTREVISION?= 0
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP}
@@ -38,13 +38,14 @@ CONFIGURE_ARGS+=--with-layout=GNU \
USE_GNOME= libxml2
-OPTIONS_DEFINE+=CLI CGI FPM EMBED DEBUG DTRACE IPV6 MAILHEAD LINKTHR ZTS
+OPTIONS_DEFINE+=CLI CGI FPM FPM_IPV6 EMBED DEBUG DTRACE IPV6 MAILHEAD LINKTHR ZTS
OPTIONS_DEFAULT=CLI CGI FPM IPV6 LINKTHR
OPTIONS_SUB= yes
CLI_DESC= Build CLI version
CGI_DESC= Build CGI version
FPM_DESC= Build FPM version
+FPM_IPV6_DESC= Enable ipv6 patch for FPM
EMBED_DESC= Build embedded library
DEBUG_DESC= Enable debug
DTRACE_DESC= Enable DTrace support
@@ -87,6 +88,9 @@ USE_RC_SUBR+= php-fpm
CONFIGURE_ARGS+=--enable-fpm \
--with-fpm-user=${WWWOWN} \
--with-fpm-group=${WWWGRP}
+.if ${PORT_OPTIONS:MIPV6} && ${PORT_OPTIONS:MFPM_IPV6}
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-php-fpm-ipv6:-p1
+.endif
.endif
.if defined(OPTIONS_FILE_SET) && ${OPTIONS_FILE_SET:MAPACHE}
diff --git a/lang/php55/distinfo b/lang/php55/distinfo
index 04289fda8ec4..9ab086fe2003 100644
--- a/lang/php55/distinfo
+++ b/lang/php55/distinfo
@@ -1,4 +1,4 @@
-SHA256 (php-5.5.13.tar.bz2) = e58a4a754eb18d2d8b1a120cad5cce4ed24a7db5d49eca5830a40e4c8ca78b9c
-SIZE (php-5.5.13.tar.bz2) = 13274145
+SHA256 (php-5.5.14.tar.bz2) = df5a057877f827549e0a60b43fb01e4bd440814bcf04fbd70bacbddf74482610
+SIZE (php-5.5.14.tar.bz2) = 13282773
SHA256 (php-5.5.x-mail-header.patch) = b0b5a7c961b2052eb14d9528e76155cbeaa881fb9b4a49f452f9dab07b6fb1c4
SIZE (php-5.5.x-mail-header.patch) = 3379
diff --git a/lang/php55/files/extra-patch-php-fpm-ipv6 b/lang/php55/files/extra-patch-php-fpm-ipv6
new file mode 100644
index 000000000000..ac00a11867f9
--- /dev/null
+++ b/lang/php55/files/extra-patch-php-fpm-ipv6
@@ -0,0 +1,215 @@
+diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
+index e056565..da14d63 100644
+--- a/sapi/fpm/fpm/fpm_sockets.c
++++ b/sapi/fpm/fpm/fpm_sockets.c
+@@ -39,29 +39,6 @@ struct listening_socket_s {
+
+ static struct fpm_array_s sockets_list;
+
+-static int fpm_sockets_resolve_af_inet(char *node, char *service, struct sockaddr_in *addr) /* {{{ */
+-{
+- struct addrinfo *res;
+- struct addrinfo hints;
+- int ret;
+-
+- memset(&hints, 0, sizeof(hints));
+- hints.ai_family = AF_INET;
+- ret = getaddrinfo(node, service, &hints, &res);
+-
+- if (ret != 0) {
+- zlog(ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n",
+- node, service ? ":" : "", service ? service : "",
+- gai_strerror(ret), ret == EAI_SYSTEM ? ", system error: " : "", ret == EAI_SYSTEM ? strerror(errno) : "");
+- return -1;
+- }
+-
+- *addr = *(struct sockaddr_in *) res->ai_addr;
+- freeaddrinfo(res);
+- return 0;
+-}
+-/* }}} */
+-
+ enum { FPM_GET_USE_SOCKET = 1, FPM_STORE_SOCKET = 2, FPM_STORE_USE_SOCKET = 3 };
+
+ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
+@@ -98,14 +75,23 @@ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
+ }
+ /* }}} */
+
++static void *fpm_get_in_addr(struct sockaddr *sa) /* {{{ */
++{
++ if (sa->sa_family == AF_INET) {
++ return &(((struct sockaddr_in*)sa)->sin_addr);
++ }
++
++ return &(((struct sockaddr_in6*)sa)->sin6_addr);
++}
++/* }}} */
++
+ static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int type, int op) /* {{{ */
+ {
+ if (key == NULL) {
+ switch (type) {
+ case FPM_AF_INET : {
+- struct sockaddr_in *sa_in = (struct sockaddr_in *) sa;
+- key = alloca(sizeof("xxx.xxx.xxx.xxx:ppppp"));
+- sprintf(key, "%u.%u.%u.%u:%u", IPQUAD(&sa_in->sin_addr), (unsigned int) ntohs(sa_in->sin_port));
++ key = alloca(INET6_ADDRSTRLEN);
++ inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, sizeof key);
+ break;
+ }
+
+@@ -254,11 +240,14 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *address) /* {{{ */
+
+ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* {{{ */
+ {
+- struct sockaddr_in sa_in;
++ struct addrinfo hints, *servinfo, *p;
+ char *dup_address = strdup(wp->config->listen_address);
+- char *port_str = strchr(dup_address, ':');
++ char *port_str = strrchr(dup_address, ':');
+ char *addr = NULL;
++ int addr_len;
+ int port = 0;
++ int sock;
++ int status;
+
+ if (port_str) { /* this is host:port pair */
+ *port_str++ = '\0';
+@@ -274,23 +263,35 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
+ return -1;
+ }
+
+- memset(&sa_in, 0, sizeof(sa_in));
+-
+- if (addr) {
+- sa_in.sin_addr.s_addr = inet_addr(addr);
+- if (sa_in.sin_addr.s_addr == INADDR_NONE) { /* do resolve */
+- if (0 > fpm_sockets_resolve_af_inet(addr, NULL, &sa_in)) {
+- return -1;
+- }
+- zlog(ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr));
++ // strip brackets from address for getaddrinfo
++ if (addr != NULL) {
++ addr_len = strlen(addr);
++ if (addr[0] == '[' && addr[addr_len - 1] == ']') {
++ addr[addr_len - 1] = '\0';
++ addr++;
+ }
+- } else {
+- sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
+ }
+- sa_in.sin_family = AF_INET;
+- sa_in.sin_port = htons(port);
++
++ memset(&hints, 0, sizeof hints);
++ hints.ai_family = AF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++
++ if ((status = getaddrinfo(addr, port_str, &hints, &servinfo)) != 0) {
++ zlog(ZLOG_ERROR, "getaddrinfo: %s\n", gai_strerror(status));
++ return -1;
++ }
++
+ free(dup_address);
+- return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in));
++
++ for (p = servinfo; p != NULL; p = p->ai_next) {
++ if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) {
++ break;
++ }
++ }
++
++ freeaddrinfo(servinfo);
++
++ return sock;
+ }
+ /* }}} */
+
+diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
+index 121c016..446c78e 100644
+--- a/sapi/fpm/fpm/fpm_sockets.h
++++ b/sapi/fpm/fpm/fpm_sockets.h
+@@ -45,10 +45,4 @@ static inline int fd_set_blocked(int fd, int blocked) /* {{{ */
+ }
+ /* }}} */
+
+-#define IPQUAD(sin_addr) \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[0], \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[1], \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[2], \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[3]
+-
+ #endif
+diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
+index ab03736..8e242aa 100644
+--- a/sapi/fpm/php-fpm.conf.in
++++ b/sapi/fpm/php-fpm.conf.in
+@@ -152,6 +152,8 @@ group = @php_fpm_group@
+ ; Valid syntaxes are:
+ ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
+ ; a specific port;
++; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
++; a specific port;
+ ; 'port' - to listen on a TCP socket to all addresses on a
+ ; specific port;
+ ; '/path/to/unix/socket' - to listen on a unix socket.
+diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt
+new file mode 100644
+index 0000000..389cb24
+--- /dev/null
++++ b/sapi/fpm/tests/003.phpt
+@@ -0,0 +1,53 @@
++--TEST--
++FPM: Test IPv6 support
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++include "include.inc";
++
++$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
++
++$cfg = <<<EOT
++[global]
++error_log = $logfile
++[unconfined]
++listen = [::1]:9000
++pm = dynamic
++pm.max_children = 5
++pm.start_servers = 2
++pm.min_spare_servers = 1
++pm.max_spare_servers = 3
++EOT;
++
++$fpm = run_fpm($cfg, $tail);
++if (is_resource($fpm)) {
++ var_dump(fgets($tail));
++ var_dump(fgets($tail));
++ $i = 0;
++ while (($i++ < 30) && !($fp = fsockopen('[::1]', 9000))) {
++ usleep(10000);
++ }
++ if ($fp) {
++ echo "Done\n";
++ fclose($fp);
++ }
++ proc_terminate($fpm);
++ stream_get_contents($tail);
++ fclose($tail);
++ proc_close($fpm);
++}
++
++?>
++--EXPECTF--
++string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
++"
++string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
++"
++Done
++--CLEAN--
++<?php
++ $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
++ @unlink($logfile);
++?>
diff --git a/lang/php55/files/patch-ext_standard_basic_functions.c b/lang/php55/files/patch-ext_standard_basic_functions.c
deleted file mode 100644
index 13fe26dc664e..000000000000
--- a/lang/php55/files/patch-ext_standard_basic_functions.c
+++ /dev/null
@@ -1,20 +0,0 @@
---- ext/standard/basic_functions.c.orig 2013-12-10 23:31:06.000000000 +0000
-+++ ext/standard/basic_functions.c 2013-12-13 21:50:25.289258456 +0000
-@@ -3429,7 +3429,7 @@ static void php_putenv_destructor(putenv
- SetEnvironmentVariable(pe->key, "bugbug");
- #endif
- putenv(pe->previous_value);
--# if defined(PHP_WIN32)
-+# if defined(PHP_WIN32) || __FreeBSD_version < 700050
- efree(pe->previous_value);
- # endif
- } else {
-@@ -4114,7 +4114,7 @@ PHP_FUNCTION(putenv)
- pe.previous_value = NULL;
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
--#if defined(PHP_WIN32)
-+#if defined(PHP_WIN32) || __FreeBSD_version < 700050
- /* must copy previous value because MSVCRT's putenv can free the string without notice */
- pe.previous_value = estrdup(*env);
- #else