From 44c1d726d18760cd9e9da670fcc90c4902a9eee4 Mon Sep 17 00:00:00 2001 From: Evgeny Kotkov Date: Wed, 21 Sep 2016 10:38:48 +0000 Subject: mod_brotli: Add initial implementation. This new module supports dynamic Brotli (RFC 7932) compression. Existing mod_deflate installations can benefit from better compression ratio by sending Brotli-compressed data to the clients that support it: SetOutputFilter BROTLI_COMPRESS;DEFLATE The module features zero-copy processing, which is only possible with the new API from the upcoming 1.0.x series of brotli [1]. The Linux makefile works against libbrotli [2], as currently the core brotli repository doesn't offer a way to build a library [3]. Apart from that, only the CMake build is now supported. [1] https://github.com/google/brotli [2] https://github.com/bagder/libbrotli [3] https://github.com/google/brotli/pull/332 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1761714 13f79535-47bb-0310-9956-ffa450edef68 --- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f06ed2ea6..bfd40cb869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,12 @@ ELSE() SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib") ENDIF() +IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/brotli_enc.lib") + SET(default_brotli_libraries "${CMAKE_INSTALL_PREFIX}/lib/brotli_enc.lib" "${CMAKE_INSTALL_PREFIX}/lib/brotli_common.lib") +ELSE() + SET(default_brotli_libraries) +ENDIF() + SET(APR_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR[-Util] include files") SET(APR_LIBRARIES ${default_apr_libraries} CACHE STRING "APR libraries to link with") SET(NGHTTP2_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with NGHTTP2 include files within nghttp2 subdirectory") @@ -66,6 +72,8 @@ SET(PCRE_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Direct SET(PCRE_LIBRARIES ${default_pcre_libraries} CACHE STRING "PCRE libraries to link with") SET(LIBXML2_ICONV_INCLUDE_DIR "" CACHE STRING "Directory with iconv include files for libxml2") SET(LIBXML2_ICONV_LIBRARIES "" CACHE STRING "iconv libraries to link with for libxml2") +SET(BROTLI_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with include files for Brotli") +SET(BROTLI_LIBRARIES ${default_brotli_libraries} CACHE STRING "Brotli libraries to link with") # end support library configuration # Misc. options @@ -191,6 +199,18 @@ ELSE() SET(NGHTTP2_FOUND FALSE) ENDIF() +# See if we have Brotli +SET(BROTLI_FOUND TRUE) +IF(EXISTS "${BROTLI_INCLUDE_DIR}/brotli/encode.h") + FOREACH(onelib ${BROTLI_LIBRARIES}) + IF(NOT EXISTS ${onelib}) + SET(BROTLI_FOUND FALSE) + ENDIF() + ENDFOREACH() +ELSE() + SET(BROTLI_FOUND FALSE) +ENDIF() + MESSAGE(STATUS "") MESSAGE(STATUS "Summary of feature detection:") MESSAGE(STATUS "") @@ -199,6 +219,7 @@ MESSAGE(STATUS "LUA51_FOUND .............. : ${LUA51_FOUND}") MESSAGE(STATUS "NGHTTP2_FOUND ............ : ${NGHTTP2_FOUND}") MESSAGE(STATUS "OPENSSL_FOUND ............ : ${OPENSSL_FOUND}") MESSAGE(STATUS "ZLIB_FOUND ............... : ${ZLIB_FOUND}") +MESSAGE(STATUS "BROTLI_FOUND ............. : ${BROTLI_FOUND}") MESSAGE(STATUS "APR_HAS_LDAP ............. : ${APR_HAS_LDAP}") MESSAGE(STATUS "APR_HAS_XLATE ............ : ${APR_HAS_XLATE}") MESSAGE(STATUS "APU_HAVE_CRYPTO .......... : ${APU_HAVE_CRYPTO}") @@ -273,6 +294,7 @@ SET(MODULE_LIST "modules/examples/mod_case_filter_in+O+Example uppercase conversion input filter" "modules/examples/mod_example_hooks+O+Example hook callback handler module" "modules/examples/mod_example_ipc+O+Example of shared memory and mutex usage" + "modules/filters/mod_brotli+i+Brotli compression support" "modules/filters/mod_buffer+I+Filter Buffering" "modules/filters/mod_charset_lite+i+character set translation" "modules/filters/mod_data+O+RFC2397 data encoder" @@ -393,6 +415,11 @@ IF(ZLIB_FOUND) SET(mod_deflate_extra_includes ${ZLIB_INCLUDE_DIR}) SET(mod_deflate_extra_libs ${ZLIB_LIBRARIES}) ENDIF() +SET(mod_brotli_requires BROTLI_FOUND) +IF(BROTLI_FOUND) + SET(mod_brotli_extra_includes ${BROTLI_INCLUDE_DIR}) + SET(mod_brotli_extra_libs ${BROTLI_LIBRARIES}) +ENDIF() SET(mod_firehose_requires SOMEONE_TO_MAKE_IT_COMPILE_ON_WINDOWS) SET(mod_heartbeat_extra_libs mod_watchdog) SET(mod_http2_requires NGHTTP2_FOUND) @@ -961,6 +988,8 @@ MESSAGE(STATUS " PCRE include directory .......... : ${PCRE_INCLUDE_DIR}") MESSAGE(STATUS " PCRE libraries .................. : ${PCRE_LIBRARIES}") MESSAGE(STATUS " libxml2 iconv prereq include dir. : ${LIBXML2_ICONV_INCLUDE_DIR}") MESSAGE(STATUS " libxml2 iconv prereq libraries .. : ${LIBXML2_ICONV_LIBRARIES}") +MESSAGE(STATUS " Brotli include directory......... : ${BROTLI_INCLUDE_DIR}") +MESSAGE(STATUS " Brotli libraries ................ : ${BROTLI_LIBRARIES}") MESSAGE(STATUS " Extra include directories ....... : ${EXTRA_INCLUDES}") MESSAGE(STATUS " Extra compile flags ............. : ${EXTRA_COMPILE_FLAGS}") MESSAGE(STATUS " Extra libraries ................. : ${EXTRA_LIBS}") -- cgit v1.2.1