From: Michael Wallner Date: Tue, 27 Feb 2018 10:04:52 +0000 (+0100) Subject: POS: brotli X-Git-Tag: RELEASE_3_2_0_RC1~21 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e3386e9e65eaf7a682ddacbbc3c44ddcd737168f;p=m6w6%2Fext-http POS: brotli --- diff --git a/autoconf/pecl/libbrotli.m4 b/autoconf/pecl/libbrotli.m4 index 8ea8b1f..6d9a80e 100644 --- a/autoconf/pecl/libbrotli.m4 +++ b/autoconf/pecl/libbrotli.m4 @@ -1,15 +1,30 @@ AC_DEFUN([PECL_CHECK_LIBBROTLI], [ + PECL_CHECK_LIBBROTLI_COMMON([$1], [$2]) + PECL_CHECK_DONE(libbrotlicommon, [$PECL_VAR([HAVE_LIBBROTLI_COMMON])]) PECL_CHECK_LIBBROTLI_DEC([$1], [$2]) PECL_CHECK_DONE(libbrotlidec, [$PECL_VAR([HAVE_LIBBROTLI_DEC])]) PECL_CHECK_LIBBROTLI_ENC([$1], [$2]) PECL_CHECK_DONE(libbrotlienc, [$PECL_VAR([HAVE_LIBBROTLI_ENC])]) - if $PECL_VAR([HAVE_LIBBROTLI_DEC]) && $PECL_VAR([HAVE_LIBBROTLI_ENC]); then + if $PECL_VAR([HAVE_LIBBROTLI_COMMON]) \ + && $PECL_VAR([HAVE_LIBBROTLI_DEC]) \ + && $PECL_VAR([HAVE_LIBBROTLI_ENC]); then PECL_VAR([HAVE_LIBBROTLI])=true fi ]) +AC_DEFUN([PECL_CHECK_LIBBROTLI_COMMON], [ + PECL_CHECK_PKGCONFIG(libbrotlicommon, [$1]) + + PECL_HAVE_VERSION(libbrotlicommon, ifelse($2,,1.0,$2), [ + PECL_VAR([HAVE_LIBBROTLI_COMMON])=true + ], [ + AC_MSG_WARN([skipping libbrotli]) + PECL_VAR([HAVE_LIBBROTLI_COMMON])=false + ]) +]) + AC_DEFUN([PECL_CHECK_LIBBROTLI_DEC], [ PECL_CHECK_PKGCONFIG(libbrotlidec, [$1]) diff --git a/src/php_http_encoding_brotli.c b/src/php_http_encoding_brotli.c index a46a2f6..dbea978 100644 --- a/src/php_http_encoding_brotli.c +++ b/src/php_http_encoding_brotli.c @@ -397,10 +397,17 @@ static zend_function_entry php_http_debrotli_stream_methods[] = { EMPTY_FUNCTION_ENTRY }; +/* POS */ +const void *BrotliGetDictionary(); +const void *(*php_http_brotli_get_dictionary)(); + PHP_MINIT_FUNCTION(http_encoding_brotli) { zend_class_entry ce; + /* force link to libbrotlicommon, because their libraries don't */ + php_http_brotli_get_dictionary = BrotliGetDictionary(); + memset(&ce, 0, sizeof(ce)); INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Enbrotli", php_http_enbrotli_stream_methods); php_http_enbrotli_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_get_encoding_stream_class_entry()); diff --git a/travis/brotli.sh b/travis/brotli.sh index 1a9f6cd..4fec33e 100755 --- a/travis/brotli.sh +++ b/travis/brotli.sh @@ -1,7 +1,7 @@ #!/bin/bash -git clone https://github.com/google/brotli.git -cd brotli +git clone https://github.com/google/brotli.git /home/travis/brotli.git +cd /home/travis/brotli.git git checkout v1.0.2 ./bootstrap ./configure --prefix=/home/travis/brotli