Skip to content

Instantly share code, notes, and snippets.

@nojimage
Last active December 24, 2015 01:29
Show Gist options
  • Save nojimage/6723904 to your computer and use it in GitHub Desktop.
Save nojimage/6723904 to your computer and use it in GitHub Desktop.
php-buildにおいて、php5.3系がビルドできないのを回避するbefore-installスクリプトsee: https://bugs.php.net/bug.php?id=48795
#!/bin/bash
# Fix the 64bit c++ patch for PHP5.3
# https://bugs.php.net/bug.php?id=48795
#
# install to {path_to_php-build}/share/php-build/before-install.d/
function version { echo "$@" | awk -F. '{ printf("%d.%d.%d\n", $1,$2,$3); }'; }
phpver=$(basename "`pwd`")
phpver=$(version $phpver)
if [[ $phpver > 5.3 && $phpver < 5.4 ]]; then
sed -ie '/EXTRA_LIBS = /s|$| -lstdc++|' Makefile
fi
#!/bin/bash
set -e
if [ -n "$PHP_BUILD_DEBUG" ]; then
set -x
fi
function version { echo "$@" | awk -F. '{ printf("%d.%d.%d\n", $1,$2,$3); }'; }
phpver=$(basename "`pwd`")
phpver=$(version $phpver)
if [[ $phpver < 5.3 ]]; then
curl -LO https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
patch -p0 -b < txtbgxGXAvz4N.txt
gsed -i '/EXTRA_CFLAGS = /s|$| -lresolv|' Makefile
gsed -i '/EXTRA_LIBS = /s|$| -lstdc++|' Makefile
fi
--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800
+++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
RETVAL_FALSE;
} else {
if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ ret = xmlOutputBufferGetSize(buf);
+#else
ret = buf->buffer->use;
+#endif
if (ret > 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
+#else
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
+#endif
} else {
RETVAL_EMPTY_STRING();
}
--- ext/dom/documenttype.c 2012-08-06 18:02:16.019640870 +0800
+++ ext/dom/documenttype.c 2012-08-06 18:06:16.612228905 +0800
@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
xmlOutputBufferFlush(buff);
+
+#ifdef LIBXML2_NEW_BUFFER
+ ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff),
+ xmlOutputBufferGetSize(buff), 1);
+#else
ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
+#endif
(void)xmlOutputBufferClose(buff);
return SUCCESS;
}
--- ext/simplexml/simplexml.c 2012-08-06 18:10:44.621017026 +0800
+++ ext/simplexml/simplexml.c 2012-08-06 18:12:48.016270419 +0800
@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML)
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
+#ifdef LIBXML2_NEW_BUFFER
+ RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf),
+ xmlOutputBufferGetSize(outbuf), 1);
+#else
RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
+#endif
xmlOutputBufferClose(outbuf);
}
} else {
@nojimage
Copy link
Author

nojimage commented Oct 9, 2014

php5.2系のもつけといた。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment