From ac3e19d271df985d4a17203c6060ca93a4fd63b0 Mon Sep 17 00:00:00 2001 From: Jesus Solis Date: Mon, 13 Jul 2026 01:14:57 -0500 Subject: [PATCH] external: add brotli brotli is a lossless compression algorithm using the "stream" format Downloaded from https://github.com/google/brotli/archive/refs/tags/v1.2.0.tar.gz Change-Id: Ia5dd6b6e321be4284342068250ae7a6118e192e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208008 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- Makefile.fetch | 1 + RepositoryExternal.mk | 20 ++++++- download.lst | 5 ++ external/Module_external.mk | 1 + external/brotli/Makefile | 7 +++ external/brotli/Module_brotli.mk | 17 ++++++ external/brotli/README | 3 + external/brotli/StaticLibrary_brotli.mk | 72 +++++++++++++++++++++++ external/brotli/UnpackedTarball_brotli.mk | 14 +++++ readlicense_oo/license/license.xml | 23 ++++++++ 10 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 external/brotli/Makefile create mode 100644 external/brotli/Module_brotli.mk create mode 100644 external/brotli/README create mode 100644 external/brotli/StaticLibrary_brotli.mk create mode 100644 external/brotli/UnpackedTarball_brotli.mk diff --git a/Makefile.fetch b/Makefile.fetch index 30ab92eba3f6..ef5f836a184d 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -107,6 +107,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S $(call fetch_Optional,BOOST,BOOST_TARBALL) \ $(call fetch_Optional,BOX2D,BOX2D_TARBALL) \ $(call fetch_Optional,BREAKPAD,BREAKPAD_TARBALL) \ + $(call fetch_Optional,BROTLI,BROTLI_TARBALL) \ $(call fetch_Optional,BSH,BSH_TARBALL) \ $(call fetch_Optional,BZIP2,BZIP2_TARBALL) \ $(call fetch_Optional,CAIRO,CAIRO_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 3125cae9d9e8..e3d15abe7f76 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -513,7 +513,6 @@ else endef endif - ifneq ($(filter HIGHWAY,$(BUILD_TYPE)),) define gb_LinkTarget__use_highway @@ -532,6 +531,25 @@ endef endif # HIGHWAY +ifneq ($(filter BROTLI,$(BUILD_TYPE)),) + +define gb_LinkTarget__use_brotli +$(call gb_LinkTarget_set_include,$(1),\ + -I$(gb_UnpackedTarball_workdir)/brotli/c \ + -I$(gb_UnpackedTarball_workdir)/brotli/c/include \ + $$(INCLUDE) \ +) +$(call gb_LinkTarget_use_static_libraries,$(1),brotli) + +endef + +define gb_ExternalProject__use_brotli +$(call gb_ExternalProject_use_static_libraries,$(1),brotli) + +endef + +endif # BROTLI + ifneq ($(SYSTEM_LIBJPEG),) define gb_LinkTarget__use_libjpeg diff --git a/download.lst b/download.lst index 95264557fec4..fcf48754f180 100644 --- a/download.lst +++ b/download.lst @@ -29,6 +29,11 @@ BREAKPAD_TARBALL := breakpad-b324760c7f53667af128a6b77b790323da04fcb9.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts +BROTLI_SHA256SUM := 816c96e8e8f193b40151dad7e8ff37b1221d019dbcb9c35cd3fadbfe6477dfec +BROTLI_TARBALL := brotli-1.2.0.tar.gz +# three static lines +# so that git cherry-pick +# will not run into conflicts BSH_SHA256SUM := 2248387ceaa319840434a3547a8b2fec12f95a8418ee039ce5ff5726053a139c BSH_TARBALL := bsh-2.1.1-src.zip # three static lines diff --git a/external/Module_external.mk b/external/Module_external.mk index 9110f10acf24..911728ab380b 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -17,6 +17,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,BOOST,boost) \ $(call gb_Helper_optional,BOX2D,box2d) \ $(call gb_Helper_optional,BREAKPAD,breakpad) \ + $(call gb_Helper_optional,BROTLI,brotli) \ $(call gb_Helper_optional,BSH,beanshell) \ $(call gb_Helper_optional,BZIP2,bzip2) \ $(call gb_Helper_optional,CAIRO,cairo) \ diff --git a/external/brotli/Makefile b/external/brotli/Makefile new file mode 100644 index 000000000000..e4968cf85fb6 --- /dev/null +++ b/external/brotli/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/brotli/Module_brotli.mk b/external/brotli/Module_brotli.mk new file mode 100644 index 000000000000..657998a67dec --- /dev/null +++ b/external/brotli/Module_brotli.mk @@ -0,0 +1,17 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,brotli)) + +$(eval $(call gb_Module_add_targets,brotli,\ + StaticLibrary_brotli \ + UnpackedTarball_brotli \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/brotli/README b/external/brotli/README new file mode 100644 index 000000000000..ab203ab248b6 --- /dev/null +++ b/external/brotli/README @@ -0,0 +1,3 @@ +brotli is a lossless compression algorithm using the "stream" format. + +From [https://github.com/google/brotli]. diff --git a/external/brotli/StaticLibrary_brotli.mk b/external/brotli/StaticLibrary_brotli.mk new file mode 100644 index 000000000000..6bd8ea7c5bbe --- /dev/null +++ b/external/brotli/StaticLibrary_brotli.mk @@ -0,0 +1,72 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,brotli)) + +$(eval $(call gb_StaticLibrary_use_unpacked,brotli,brotli)) + +$(eval $(call gb_StaticLibrary_set_warnings_disabled,brotli)) + +$(eval $(call gb_StaticLibrary_set_include,brotli,\ + -I$(WORKDIR)/UnpackedTarball/brotli \ + -I$(WORKDIR)/UnpackedTarball/brotli/c/include \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_StaticLibrary_add_generated_cobjects,brotli,\ + $(addprefix UnpackedTarball/brotli/c/common/, \ + constants \ + context \ + dictionary \ + platform \ + shared_dictionary \ + transform \ + ) \ +)) + +$(eval $(call gb_StaticLibrary_add_generated_cobjects,brotli,\ + $(addprefix UnpackedTarball/brotli/c/enc/, \ + backward_references \ + backward_references_hq \ + bit_cost \ + block_splitter \ + brotli_bit_stream \ + cluster \ + command \ + compound_dictionary \ + compress_fragment \ + compress_fragment_two_pass \ + dictionary_hash \ + encode \ + encoder_dict \ + entropy_encode \ + fast_log \ + histogram \ + literal_cost \ + memory \ + metablock \ + static_dict \ + static_dict_lut \ + static_init \ + utf8_util \ + ) \ +)) + +$(eval $(call gb_StaticLibrary_add_generated_cobjects,brotli,\ + $(addprefix UnpackedTarball/brotli/c/dec/, \ + bit_reader \ + decode \ + huffman \ + prefix \ + state \ + static_init \ + ) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/brotli/UnpackedTarball_brotli.mk b/external/brotli/UnpackedTarball_brotli.mk new file mode 100644 index 000000000000..3d02dbfe09b0 --- /dev/null +++ b/external/brotli/UnpackedTarball_brotli.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,brotli)) + +$(eval $(call gb_UnpackedTarball_set_tarball,brotli,$(BROTLI_TARBALL))) + +# vim: set noet sw=4 ts=4: diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index 63fce3a777be..549eedb092cc 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -171,6 +171,29 @@ copies of this file in any form for internal or external distribution as long as this notice remains attached.

+
+

brotli

+

The following software may be included in this product: brotli.

+

brotli code is covered by the MIT license:

+
+

Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.

+

Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions:

+

The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE.

+
+

Bzip2

The following software may be included in this product: bzip2, a free and open-source file compression