summaryrefslogtreecommitdiffstats
path: root/php_trie-build.patch
diff options
context:
space:
mode:
Diffstat (limited to 'php_trie-build.patch')
-rw-r--r--php_trie-build.patch163
1 files changed, 163 insertions, 0 deletions
diff --git a/php_trie-build.patch b/php_trie-build.patch
new file mode 100644
index 0000000..a834161
--- /dev/null
+++ b/php_trie-build.patch
@@ -0,0 +1,163 @@
+From c2e76aa7daf1829502736ed7d2659813bba52792 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 9 Sep 2020 09:13:44 +0200
+Subject: [PATCH 07/10] fix header config.m4
+
+---
+ config.m4 | 12 +++++-------
+ trie.h | 2 +-
+ 2 files changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index 2236ddf..52e086b 100644
+--- a/config.m4
++++ b/config.m4
+@@ -15,30 +15,28 @@ if test "$PHP_PHP_TRIE" != "no"; then
+ AC_MSG_CHECKING([for Tessil/hat-trie library])
+ if test -s $PHP_HATTRIE/$HATTRIE_HEADER; then
+ AC_MSG_RESULT(found $HATTRIE_HEADER)
+- HATTRIE_LIB=$PHP_HATTRIE/$HATTRIE_HEADER
++ HATTRIE_LIB=$PHP_HATTRIE
+ else
+ for iter in $HEADER_INSTALL_DIRS; do
+ if test -s $iter/$HATTRIE_CPP_DIR/$HATTRIE_CPP_HEADER; then
+ AC_MSG_RESULT(found $HATTRIE_HEADER)
+- HATTRIE_LIB=$iter/$HATTRIE_CPP_DIR/$HATTRIE_CPP_HEADER
++ HATTRIE_LIB=$iter/$HATTRIE_CPP_DIR
+ fi
+ done
+ fi
+
+ if test -z "$HATTRIE_LIB"; then
+ AC_MSG_RESULT(hattrie lib is not properly installed. You will not be able to use the HAT trie)
+- dnl AC_MSG_ERROR(Please install the hattrie library)
++ AC_MSG_ERROR(Please install the hattrie library)
+ fi
+
+ dnl add support for C++
+- CXXFLAGS="-std=c++11"
+ PHP_REQUIRE_CXX()
++ PHP_ADD_INCLUDE($HATTRIE_LIB)
+
+- PHP_SUBST(PHP_TRIE_SHARED_LIBADD)
+
+ dnl add C++11 standard library
+- PHP_ADD_LIBRARY(stdc++, 1, PHP_TRIE_SHARED_LIBADD)
+ AC_DEFINE(HAVE_PHP_TRIE, 1, [ Have php_trie support ])
+
+- PHP_NEW_EXTENSION(php_trie, php_trie.cpp, $ext_shared)
++ PHP_NEW_EXTENSION(php_trie, php_trie.cpp, $ext_shared,, -std=c++11, cxx)
+ fi
+diff --git a/trie.h b/trie.h
+index e653e80..b54918a 100644
+--- a/trie.h
++++ b/trie.h
+@@ -15,7 +15,7 @@
+ #include <utility>
+ #include <cstddef>
+ #include <string>
+-#include <hat-trie/include/tsl/htrie_map.h>
++#include <htrie_map.h>
+
+ namespace trie
+ {
+
+From 8fff61e1dfd4fa2c22cc160711402bd68cdf525f Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 9 Sep 2020 09:14:42 +0200
+Subject: [PATCH 08/10] fix test, seems order was wrong
+
+---
+ tests/trie/merge.phpt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/trie/merge.phpt b/tests/trie/merge.phpt
+index e59f3b3..5c7bb9e 100644
+--- a/tests/trie/merge.phpt
++++ b/tests/trie/merge.phpt
+@@ -21,8 +21,8 @@ array(4) {
+ string(3) "foo"
+ ["baz"]=>
+ int(12)
+- ["baff"]=>
+- bool(false)
+ ["bar"]=>
+ string(3) "bar"
+-}
+\ No newline at end of file
++ ["baff"]=>
++ bool(false)
++}
+
+From 2b8feba9542c72339bf177169a776289212e2e5e Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 9 Sep 2020 09:21:49 +0200
+Subject: [PATCH 09/10] add module dependency on json
+
+---
+ php_trie.cpp | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/php_trie.cpp b/php_trie.cpp
+index 07d6015..1c766d7 100644
+--- a/php_trie.cpp
++++ b/php_trie.cpp
+@@ -488,10 +488,17 @@ PHP_MINIT_FUNCTION(php_trie)
+ }
+ /* }}} */
+
++static zend_module_dep php_trie_deps[] = {
++ ZEND_MOD_REQUIRED("json")
++ ZEND_MOD_END
++};
++
+ /* {{{ php_trie_module_entry
+ */
+ zend_module_entry php_trie_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX,
++ NULL,
++ php_trie_deps,
+ "php_trie", /* Extension name */
+ trie_methods, /* zend_function_entry */
+ PHP_MINIT(php_trie), /* PHP_MINIT - Module initialization */
+
+From cf7c464594e7c7628fdeb30159f7a458c61699d3 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 9 Sep 2020 09:25:12 +0200
+Subject: [PATCH 10/10] sort test result to avoid failure
+
+---
+ tests/trie/merge.phpt | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/tests/trie/merge.phpt b/tests/trie/merge.phpt
+index 5c7bb9e..4cdb86b 100644
+--- a/tests/trie/merge.phpt
++++ b/tests/trie/merge.phpt
+@@ -13,16 +13,18 @@ $snd['baz'] = 12;
+ $thd = new Trie;
+ $thd['baff'] = false;
+
+-var_dump($fst->merge($snd, $thd)->toArray());
++$res = $fst->merge($snd, $thd)->toArray();
++ksort($res);
++var_dump($res);
+ ?>
+ --EXPECT--
+ array(4) {
+- ["foo"]=>
+- string(3) "foo"
+- ["baz"]=>
+- int(12)
+- ["bar"]=>
+- string(3) "bar"
+ ["baff"]=>
+ bool(false)
++ ["bar"]=>
++ string(3) "bar"
++ ["baz"]=>
++ int(12)
++ ["foo"]=>
++ string(3) "foo"
+ }