Currently, the output buffer is a std::vector<uint8_t>.
When the buffer grows, resizing will cause unnecessary memcpy().
This change uses a list of bytes object to represent output buffer, can avoid the extra overhead of resizing.
In addition, C++ code can be removed, it's a pure C extension.
By convention projects using CMake which can build either static or
shared libraries use a BUILD_SHARED_LIBS flag to allow selecting between
both: the add_library() command automatically switches between both using
this variable when the library kind is not passed to add_library(). It
is also usual to expose the BUILD_SHARED_LIBS as an user-facing setting
with the option() command.
This way, the following will both work as expected:
% cmake -DBUILD_SHARED_LIBS=OFF ...
% cmake -DBUILS_SHARED_LIBS=ON ...
This is helpful for distributions which need (or want) to build only
static libraries.
Documentation:
- add note that brotli is a "stream" format, not an archive-like
- regenerate .1 with Pandoc
Build:
- drop legacy "BROTLI_BUILD_PORTABLE" option
- drop "BROTLI_SANITIZED" definition
Code:
- c: comb includes
- c/enc: extract encoder state into separate header
- c/enc: drop designated q10 codepath
- c/enc: dealing better with flushing of empty stream
- fix MSVC compilation
API:
- py: use library version instead of one in version.h
- c: add plugable API to report consumed input / produced output
- c/java: support "lean" prepared dictionaries (without copy of source)
* Wrap interface include directories with BUILD_INTERFACE generator expression
When exporting a CMake target using install(TARGETS) + install(EXPORT),
CMake requires all include directories to be clean of build system
directories.
https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.html
This change also allows use of brotli as a CMake subproject and
installing + exporting it.
* Fix typo in generator expression
* bootstrap: Verify functionality of sed
Check for the existence of sed by running a simple substitution rather
than using the --version flag. This lets us remove the weird exclusion
of FreeBSD from checking the sed requirement, and fixes checking the sed
requirement on other systems like macOS that use BSD sed, which doesn't
support --version.
* bootstrap: Detect flag for sed extended RE
Detect whether sed needs -E or -r to enable extended regular
expressions. Fixes bootstrap on macOS, whose BSD sed does not support
-r.
GNU sed has supported -E as a synonym for -r since version 4.2 (2009),
initially as an undocumented option for compatibility with BSD sed:
http://git.savannah.gnu.org/cgit/sed.git/commit/sed/sed.c?id=3a8e165ab02487c372df217c1989e287625ce0ae
and later as a documented option after -E became POSIX:
http://git.savannah.gnu.org/cgit/sed.git/commit/sed/sed.c?id=8b65e07904384b529a464c89f3739d2e7e4d5135