Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/GOOGLE]: xsrc/external/mit/brotli/dist initial import of brotli 1.0.9.



details:   https://anonhg.NetBSD.org/xsrc/rev/165c80058644
branches:  GOOGLE
changeset: 7406:165c80058644
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Jan 29 06:38:34 2023 +0000

description:
initial import of brotli 1.0.9.

modern blender wants freetype to have brotli support enabled or it
won't build.  fortunately, enabling the decoder support (all it
needs currently) is relatively easy and small (~160k on amd64)
without exposing brotli as a first class citizen is easy, so this
will be linked into xsrc freetype directly.

XXX: pullup-10?  or perhaps force -10 to use pkgsrc freetype?

from pkgsrc DESCR:
Brotli is a generic-purpose lossless compression algorithm that compresses data
using a combination of a modern variant of the LZ77 algorithm, Huffman coding
and 2nd order context modeling, with a compression ratio comparable to the best
currently available general-purpose compression methods. It is similar in speed
with deflate but offers more dense compression.

diffstat:

 external/mit/brotli/dist/BUILD                                  |   144 +
 external/mit/brotli/dist/CMakeLists.txt                         |   421 +
 external/mit/brotli/dist/CONTRIBUTING.md                        |    27 +
 external/mit/brotli/dist/LICENSE                                |    19 +
 external/mit/brotli/dist/MANIFEST.in                            |    17 +
 external/mit/brotli/dist/Makefile                               |    55 +
 external/mit/brotli/dist/Makefile.am                            |    38 +
 external/mit/brotli/dist/README                                 |    15 +
 external/mit/brotli/dist/README.md                              |   104 +
 external/mit/brotli/dist/WORKSPACE                              |    21 +
 external/mit/brotli/dist/bootstrap                              |    35 +
 external/mit/brotli/dist/c/common/constants.c                   |    15 +
 external/mit/brotli/dist/c/common/constants.h                   |   200 +
 external/mit/brotli/dist/c/common/context.c                     |   156 +
 external/mit/brotli/dist/c/common/context.h                     |   113 +
 external/mit/brotli/dist/c/common/dictionary.c                  |  5914 ++++++++++
 external/mit/brotli/dist/c/common/dictionary.h                  |    64 +
 external/mit/brotli/dist/c/common/platform.c                    |    22 +
 external/mit/brotli/dist/c/common/platform.h                    |   594 +
 external/mit/brotli/dist/c/common/transform.c                   |   291 +
 external/mit/brotli/dist/c/common/transform.h                   |    85 +
 external/mit/brotli/dist/c/common/version.h                     |    26 +
 external/mit/brotli/dist/c/dec/bit_reader.c                     |    76 +
 external/mit/brotli/dist/c/dec/bit_reader.h                     |   351 +
 external/mit/brotli/dist/c/dec/decode.c                         |  2608 ++++
 external/mit/brotli/dist/c/dec/huffman.c                        |   339 +
 external/mit/brotli/dist/c/dec/huffman.h                        |   121 +
 external/mit/brotli/dist/c/dec/prefix.h                         |   732 +
 external/mit/brotli/dist/c/dec/state.c                          |   159 +
 external/mit/brotli/dist/c/dec/state.h                          |   365 +
 external/mit/brotli/dist/c/enc/backward_references.c            |   145 +
 external/mit/brotli/dist/c/enc/backward_references.h            |    39 +
 external/mit/brotli/dist/c/enc/backward_references_hq.c         |   843 +
 external/mit/brotli/dist/c/enc/backward_references_hq.h         |    95 +
 external/mit/brotli/dist/c/enc/backward_references_inc.h        |   163 +
 external/mit/brotli/dist/c/enc/bit_cost.c                       |    35 +
 external/mit/brotli/dist/c/enc/bit_cost.h                       |    63 +
 external/mit/brotli/dist/c/enc/bit_cost_inc.h                   |   127 +
 external/mit/brotli/dist/c/enc/block_encoder_inc.h              |    34 +
 external/mit/brotli/dist/c/enc/block_splitter.c                 |   194 +
 external/mit/brotli/dist/c/enc/block_splitter.h                 |    51 +
 external/mit/brotli/dist/c/enc/block_splitter_inc.h             |   440 +
 external/mit/brotli/dist/c/enc/brotli_bit_stream.c              |  1314 ++
 external/mit/brotli/dist/c/enc/brotli_bit_stream.h              |    84 +
 external/mit/brotli/dist/c/enc/cluster.c                        |    56 +
 external/mit/brotli/dist/c/enc/cluster.h                        |    48 +
 external/mit/brotli/dist/c/enc/cluster_inc.h                    |   320 +
 external/mit/brotli/dist/c/enc/command.c                        |    28 +
 external/mit/brotli/dist/c/enc/command.h                        |   190 +
 external/mit/brotli/dist/c/enc/compress_fragment.c              |   790 +
 external/mit/brotli/dist/c/enc/compress_fragment.h              |    61 +
 external/mit/brotli/dist/c/enc/compress_fragment_two_pass.c     |   645 +
 external/mit/brotli/dist/c/enc/compress_fragment_two_pass.h     |    54 +
 external/mit/brotli/dist/c/enc/dictionary_hash.c                |  1846 +++
 external/mit/brotli/dist/c/enc/dictionary_hash.h                |    25 +
 external/mit/brotli/dist/c/enc/encode.c                         |  1927 +++
 external/mit/brotli/dist/c/enc/encoder_dict.c                   |    33 +
 external/mit/brotli/dist/c/enc/encoder_dict.h                   |    43 +
 external/mit/brotli/dist/c/enc/entropy_encode.c                 |   503 +
 external/mit/brotli/dist/c/enc/entropy_encode.h                 |   122 +
 external/mit/brotli/dist/c/enc/entropy_encode_static.h          |   539 +
 external/mit/brotli/dist/c/enc/fast_log.c                       |   105 +
 external/mit/brotli/dist/c/enc/fast_log.h                       |    66 +
 external/mit/brotli/dist/c/enc/find_match_length.h              |    79 +
 external/mit/brotli/dist/c/enc/hash.h                           |   488 +
 external/mit/brotli/dist/c/enc/hash_composite_inc.h             |   125 +
 external/mit/brotli/dist/c/enc/hash_forgetful_chain_inc.h       |   293 +
 external/mit/brotli/dist/c/enc/hash_longest_match64_inc.h       |   267 +
 external/mit/brotli/dist/c/enc/hash_longest_match_inc.h         |   262 +
 external/mit/brotli/dist/c/enc/hash_longest_match_quickly_inc.h |   266 +
 external/mit/brotli/dist/c/enc/hash_rolling_inc.h               |   212 +
 external/mit/brotli/dist/c/enc/hash_to_binary_tree_inc.h        |   329 +
 external/mit/brotli/dist/c/enc/histogram.c                      |   100 +
 external/mit/brotli/dist/c/enc/histogram.h                      |    63 +
 external/mit/brotli/dist/c/enc/histogram_inc.h                  |    51 +
 external/mit/brotli/dist/c/enc/literal_cost.c                   |   175 +
 external/mit/brotli/dist/c/enc/literal_cost.h                   |    30 +
 external/mit/brotli/dist/c/enc/memory.c                         |   170 +
 external/mit/brotli/dist/c/enc/memory.h                         |   114 +
 external/mit/brotli/dist/c/enc/metablock.c                      |   663 +
 external/mit/brotli/dist/c/enc/metablock.h                      |   105 +
 external/mit/brotli/dist/c/enc/metablock_inc.h                  |   183 +
 external/mit/brotli/dist/c/enc/params.h                         |    46 +
 external/mit/brotli/dist/c/enc/prefix.h                         |    53 +
 external/mit/brotli/dist/c/enc/quality.h                        |   165 +
 external/mit/brotli/dist/c/enc/ringbuffer.h                     |   167 +
 external/mit/brotli/dist/c/enc/static_dict.c                    |   486 +
 external/mit/brotli/dist/c/enc/static_dict.h                    |    40 +
 external/mit/brotli/dist/c/enc/static_dict_lut.h                |  5864 +++++++++
 external/mit/brotli/dist/c/enc/utf8_util.c                      |    85 +
 external/mit/brotli/dist/c/enc/utf8_util.h                      |    32 +
 external/mit/brotli/dist/c/enc/write_bits.h                     |    87 +
 external/mit/brotli/dist/c/include/brotli/decode.h              |   344 +
 external/mit/brotli/dist/c/include/brotli/encode.h              |   448 +
 external/mit/brotli/dist/c/include/brotli/port.h                |   288 +
 external/mit/brotli/dist/c/include/brotli/types.h               |    83 +
 external/mit/brotli/dist/c/tools/brotli.c                       |  1116 +
 external/mit/brotli/dist/c/tools/brotli.md                      |   107 +
 external/mit/brotli/dist/compiler_config_setting.bzl            |    28 +
 external/mit/brotli/dist/configure                              |     8 +
 external/mit/brotli/dist/configure-cmake                        |   318 +
 external/mit/brotli/dist/configure.ac                           |    14 +
 external/mit/brotli/dist/docs/brotli.1                          |   132 +
 external/mit/brotli/dist/docs/constants.h.3                     |    47 +
 external/mit/brotli/dist/docs/decode.h.3                        |   415 +
 external/mit/brotli/dist/docs/encode.h.3                        |   586 +
 external/mit/brotli/dist/docs/types.h.3                         |   117 +
 external/mit/brotli/dist/premake5.lua                           |    78 +
 external/mit/brotli/dist/python/Makefile                        |    57 +
 external/mit/brotli/dist/python/README.md                       |    54 +
 external/mit/brotli/dist/python/_brotli.cc                      |   753 +
 external/mit/brotli/dist/python/bro.py                          |   160 +
 external/mit/brotli/dist/python/brotli.py                       |    56 +
 external/mit/brotli/dist/python/tests/_test_utils.py            |   112 +
 external/mit/brotli/dist/python/tests/bro_test.py               |   102 +
 external/mit/brotli/dist/python/tests/compress_test.py          |    41 +
 external/mit/brotli/dist/python/tests/compressor_test.py        |    94 +
 external/mit/brotli/dist/python/tests/decompress_test.py        |    42 +
 external/mit/brotli/dist/python/tests/decompressor_test.py      |    59 +
 external/mit/brotli/dist/scripts/libbrotlicommon.pc.in          |    11 +
 external/mit/brotli/dist/scripts/libbrotlidec.pc.in             |    12 +
 external/mit/brotli/dist/scripts/libbrotlienc.pc.in             |    12 +
 external/mit/brotli/dist/scripts/sources.lst                    |   104 +
 external/mit/brotli/dist/setup.cfg                              |     5 +
 external/mit/brotli/dist/setup.py                               |   293 +
 external/mit/brotli/dist/tests/Makefile                         |    17 +
 external/mit/brotli/dist/tests/compatibility_test.sh            |    25 +
 external/mit/brotli/dist/tests/roundtrip_test.sh                |    36 +
 external/mit/brotli/dist/tests/run-compatibility-test.cmake     |    31 +
 external/mit/brotli/dist/tests/run-roundtrip-test.cmake         |    36 +
 external/mit/brotli/dist/tests/testdata/empty.compressed        |     1 +
 external/mit/brotli/dist/tests/testdata/ukkonooa                |     1 +
 external/mit/brotli/dist/tests/testdata/ukkonooa.compressed     |   Bin 
 133 files changed, 41398 insertions(+), 0 deletions(-)

diffs (truncated from 41931 to 300 lines):

diff -r b52b9fb50d7f -r 165c80058644 external/mit/brotli/dist/BUILD
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/brotli/dist/BUILD    Sun Jan 29 06:38:34 2023 +0000
@@ -0,0 +1,144 @@
+# Description:
+#   Brotli is a generic-purpose lossless compression algorithm.
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+licenses(["notice"])  # MIT
+
+exports_files(["LICENSE"])
+
+config_setting(
+    name = "darwin",
+    values = {"cpu": "darwin"},
+    visibility = ["//visibility:public"],
+)
+
+config_setting(
+    name = "darwin_x86_64",
+    values = {"cpu": "darwin_x86_64"},
+    visibility = ["//visibility:public"],
+)
+
+config_setting(
+    name = "windows",
+    values = {"cpu": "x64_windows"},
+    visibility = ["//visibility:public"],
+)
+
+config_setting(
+    name = "windows_msvc",
+    values = {"cpu": "x64_windows_msvc"},
+    visibility = ["//visibility:public"],
+)
+
+config_setting(
+    name = "windows_msys",
+    values = {"cpu": "x64_windows_msys"},
+    visibility = ["//visibility:public"],
+)
+
+load(":compiler_config_setting.bzl", "create_msvc_config")
+
+create_msvc_config()
+
+STRICT_C_OPTIONS = select({
+    ":msvc": [],
+    "//conditions:default": [
+        "--pedantic-errors",
+        "-Wall",
+        "-Wconversion",
+        "-Werror",
+        "-Wextra",
+        "-Wlong-long",
+        "-Wmissing-declarations",
+        "-Wmissing-prototypes",
+        "-Wno-strict-aliasing",
+        "-Wshadow",
+        "-Wsign-compare",
+    ],
+})
+
+filegroup(
+    name = "public_headers",
+    srcs = glob(["c/include/brotli/*.h"]),
+)
+
+filegroup(
+    name = "common_headers",
+    srcs = glob(["c/common/*.h"]),
+)
+
+filegroup(
+    name = "common_sources",
+    srcs = glob(["c/common/*.c"]),
+)
+
+filegroup(
+    name = "dec_headers",
+    srcs = glob(["c/dec/*.h"]),
+)
+
+filegroup(
+    name = "dec_sources",
+    srcs = glob(["c/dec/*.c"]),
+)
+
+filegroup(
+    name = "enc_headers",
+    srcs = glob(["c/enc/*.h"]),
+)
+
+filegroup(
+    name = "enc_sources",
+    srcs = glob(["c/enc/*.c"]),
+)
+
+cc_library(
+    name = "brotli_inc",
+    hdrs = [":public_headers"],
+    copts = STRICT_C_OPTIONS,
+    strip_include_prefix = "c/include",
+)
+
+cc_library(
+    name = "brotlicommon",
+    srcs = [":common_sources"],
+    hdrs = [":common_headers"],
+    copts = STRICT_C_OPTIONS,
+    deps = [":brotli_inc"],
+)
+
+cc_library(
+    name = "brotlidec",
+    srcs = [":dec_sources"],
+    hdrs = [":dec_headers"],
+    copts = STRICT_C_OPTIONS,
+    deps = [":brotlicommon"],
+)
+
+cc_library(
+    name = "brotlienc",
+    srcs = [":enc_sources"],
+    hdrs = [":enc_headers"],
+    copts = STRICT_C_OPTIONS,
+    linkopts = ["-lm"],
+    deps = [":brotlicommon"],
+)
+
+cc_binary(
+    name = "brotli",
+    srcs = ["c/tools/brotli.c"],
+    copts = STRICT_C_OPTIONS,
+    linkstatic = 1,
+    deps = [
+        ":brotlidec",
+        ":brotlienc",
+    ],
+)
+
+filegroup(
+    name = "dictionary",
+    srcs = ["c/common/dictionary.bin"],
+)
diff -r b52b9fb50d7f -r 165c80058644 external/mit/brotli/dist/CMakeLists.txt
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/brotli/dist/CMakeLists.txt   Sun Jan 29 06:38:34 2023 +0000
@@ -0,0 +1,421 @@
+# Ubuntu 12.04 LTS has CMake 2.8.7, and is an important target since
+# several CI services, such as Travis and Drone, use it.  Solaris 11
+# has 2.8.6, and it's not difficult to support if you already have to
+# support 2.8.7.
+cmake_minimum_required(VERSION 2.8.6)
+
+project(brotli C)
+
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "Setting build type to Release as none was specified.")
+  set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
+else()
+  message(STATUS "Build type is '${CMAKE_BUILD_TYPE}'")
+endif()
+
+include(CheckCSourceCompiles)
+check_c_source_compiles(
+  "#if defined(__EMSCRIPTEN__)
+   int main() {return 0;}
+   #endif"
+  BROTLI_EMSCRIPTEN
+)
+if (BROTLI_EMSCRIPTEN)
+  message("-- Compiler is EMSCRIPTEN")
+else()
+  message("-- Compiler is not EMSCRIPTEN")
+endif()
+
+# If Brotli is being bundled in another project, we don't want to
+# install anything.  However, we want to let people override this, so
+# we'll use the BROTLI_BUNDLED_MODE variable to let them do that; just
+# set it to OFF in your project before you add_subdirectory(brotli).
+get_directory_property(BROTLI_PARENT_DIRECTORY PARENT_DIRECTORY)
+if(NOT DEFINED BROTLI_BUNDLED_MODE)
+  # Bundled mode hasn't been set one way or the other, set the default
+  # depending on whether or not we are the top-level project.
+  if(BROTLI_PARENT_DIRECTORY)
+    set(BROTLI_BUNDLED_MODE ON)
+  else()
+    set(BROTLI_BUNDLED_MODE OFF)
+  endif()
+endif()
+mark_as_advanced(BROTLI_BUNDLED_MODE)
+
+include(GNUInstallDirs)
+
+# Parse version information from common/version.h. Normally we would
+# define these values here and write them out to configuration file(s)
+# (i.e., config.h), but in this case we parse them from
+# common/version.h to be less intrusive.
+function(hex_to_dec HEXADECIMAL DECIMAL)
+  string(TOUPPER "${HEXADECIMAL}" _tail)
+  set(_decimal 0)
+  string(LENGTH "${_tail}" _tail_length)
+  while (_tail_length GREATER 0)
+    math(EXPR _decimal "${_decimal} * 16")
+    string(SUBSTRING "${_tail}" 0 1 _digit)
+    string(SUBSTRING "${_tail}" 1 -1 _tail)
+    if (_digit STREQUAL "A")
+      math(EXPR _decimal "${_decimal} + 10")
+    elseif (_digit STREQUAL "B")
+      math(EXPR _decimal "${_decimal} + 11")
+    elseif (_digit STREQUAL "C")
+      math(EXPR _decimal "${_decimal} + 12")
+    elseif (_digit STREQUAL "D")
+      math(EXPR _decimal "${_decimal} + 13")
+    elseif (_digit STREQUAL "E")
+      math(EXPR _decimal "${_decimal} + 14")
+    elseif (_digit STREQUAL "F")
+      math(EXPR _decimal "${_decimal} + 15")
+    else()
+      math(EXPR _decimal "${_decimal} + ${_digit}")
+    endif()
+    string(LENGTH "${_tail}" _tail_length)
+  endwhile()
+  set(${DECIMAL} ${_decimal} PARENT_SCOPE)
+endfunction(hex_to_dec)
+
+# Version information
+file(STRINGS "c/common/version.h" _brotli_version_line REGEX "^#define BROTLI_VERSION (0x[0-9a-fA-F]+)$")
+string(REGEX REPLACE "^#define BROTLI_VERSION 0x([0-9a-fA-F]+)$" "\\1" _brotli_version_hex "${_brotli_version_line}")
+hex_to_dec("${_brotli_version_hex}" _brotli_version)
+math(EXPR BROTLI_VERSION_MAJOR "${_brotli_version} >> 24")
+math(EXPR BROTLI_VERSION_MINOR "(${_brotli_version} >> 12) & 4095")
+math(EXPR BROTLI_VERSION_PATCH "${_brotli_version} & 4095")
+set(BROTLI_VERSION "${BROTLI_VERSION_MAJOR}.${BROTLI_VERSION_MINOR}.${BROTLI_VERSION_PATCH}")
+mark_as_advanced(BROTLI_VERSION BROTLI_VERSION_MAJOR BROTLI_VERSION_MINOR BROTLI_VERSION_PATCH)
+
+# ABI Version information
+file(STRINGS "c/common/version.h" _brotli_abi_info_line REGEX "^#define BROTLI_ABI_VERSION (0x[0-9a-fA-F]+)$")
+string(REGEX REPLACE "^#define BROTLI_ABI_VERSION 0x([0-9a-fA-F]+)$" "\\1" _brotli_abi_info_hex "${_brotli_abi_info_line}")
+hex_to_dec("${_brotli_abi_info_hex}" _brotli_abi_info)
+math(EXPR BROTLI_ABI_CURRENT "${_brotli_abi_info} >> 24")
+math(EXPR BROTLI_ABI_REVISION "(${_brotli_abi_info} >> 12) & 4095")
+math(EXPR BROTLI_ABI_AGE "${_brotli_abi_info} & 4095")
+math(EXPR BROTLI_ABI_COMPATIBILITY "${BROTLI_ABI_CURRENT} - ${BROTLI_ABI_AGE}")
+mark_as_advanced(BROTLI_ABI_CURRENT BROTLI_ABI_REVISION BROTLI_ABI_AGE BROTLI_ABI_COMPATIBILITY)
+
+if (ENABLE_SANITIZER)
+  set(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+  set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+
+  # By default, brotli depends on undefined behavior, but setting
+  # BROTLI_BUILD_PORTABLE should result in a build which does not.
+  if(ENABLE_SANITIZER STREQUAL "undefined")
+    add_definitions(-DBROTLI_BUILD_PORTABLE)
+  endif()
+endif ()
+
+include(CheckFunctionExists)
+set(LIBM_LIBRARY)
+CHECK_FUNCTION_EXISTS(log2 LOG2_RES)
+if(NOT LOG2_RES)
+  set(orig_req_libs "${CMAKE_REQUIRED_LIBRARIES}")
+  set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
+  CHECK_FUNCTION_EXISTS(log2 LOG2_LIBM_RES)
+  if(LOG2_LIBM_RES)
+    set(LIBM_LIBRARY "m")
+    add_definitions(-DBROTLI_HAVE_LOG2=1)
+  else()
+    add_definitions(-DBROTLI_HAVE_LOG2=0)
+  endif()
+
+  set(CMAKE_REQUIRED_LIBRARIES "${orig_req_libs}")
+  unset(LOG2_LIBM_RES)
+  unset(orig_req_libs)
+else()
+  add_definitions(-DBROTLI_HAVE_LOG2=1)
+endif()
+unset(LOG2_RES)
+
+set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/c/include")
+mark_as_advanced(BROTLI_INCLUDE_DIRS)
+
+set(BROTLI_LIBRARIES_CORE brotlienc brotlidec brotlicommon)
+set(BROTLI_LIBRARIES ${BROTLI_LIBRARIES_CORE} ${LIBM_LIBRARY})
+mark_as_advanced(BROTLI_LIBRARIES)
+
+set(BROTLI_LIBRARIES_CORE_STATIC brotlienc-static brotlidec-static brotlicommon-static)
+set(BROTLI_LIBRARIES_STATIC ${BROTLI_LIBRARIES_CORE_STATIC} ${LIBM_LIBRARY})
+mark_as_advanced(BROTLI_LIBRARIES_STATIC)
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+  add_definitions(-DOS_LINUX)
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+  add_definitions(-DOS_FREEBSD)
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")



Home | Main Index | Thread Index | Old Index