Merge pull request #79101 from akien-mga/linux-unbundle-brotli

Linux: Allow unbundling brotli to use system library
This commit is contained in:
Rémi Verschelde 2023-07-07 08:35:44 +02:00
commit f1e63b808a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 9 additions and 5 deletions

View File

@ -222,6 +222,7 @@ opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise e
opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False)) opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False))
# Thirdparty libraries # Thirdparty libraries
opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True))
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True)) opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True)) opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True))
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True)) opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))

View File

@ -65,7 +65,7 @@ thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_mis
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources) env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources)
# Brotli # Brotli
if env["brotli"]: if env["brotli"] and env["builtin_brotli"]:
thirdparty_brotli_dir = "#thirdparty/brotli/" thirdparty_brotli_dir = "#thirdparty/brotli/"
thirdparty_brotli_sources = [ thirdparty_brotli_sources = [
"common/constants.c", "common/constants.c",

View File

@ -35,13 +35,13 @@
#include "thirdparty/misc/fastlz.h" #include "thirdparty/misc/fastlz.h"
#ifdef BROTLI_ENABLED
#include "thirdparty/brotli/include/brotli/decode.h"
#endif
#include <zlib.h> #include <zlib.h>
#include <zstd.h> #include <zstd.h>
#ifdef BROTLI_ENABLED
#include <brotli/decode.h>
#endif
int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) { int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) {
switch (p_mode) { switch (p_mode) {
case MODE_BROTLI: { case MODE_BROTLI: {

View File

@ -240,6 +240,9 @@ def configure(env: "Environment"):
if not env["builtin_zstd"]: if not env["builtin_zstd"]:
env.ParseConfig("pkg-config libzstd --cflags --libs") env.ParseConfig("pkg-config libzstd --cflags --libs")
if env["brotli"] and not env["builtin_brotli"]:
env.ParseConfig("pkg-config libbrotlicommon libbrotlidec --cflags --libs")
# Sound and video libraries # Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.) # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)