diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-02-28 11:39:53 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-11-11 13:01:33 +0100 |
commit | 11e8af6d08790f84ae10e1fa17424a432d0e1c87 (patch) | |
tree | bd162b6677a4b614d3e93436d99c033331c22632 | |
parent | 5229eb384e8555cf1599e283f08c62927db1c8c9 (diff) | |
download | qtwebengine-chromium-11e8af6d08790f84ae10e1fa17424a432d0e1c87.tar.gz |
Optionally unbundle libvpx, opus, FLAC, re2 and OpenH264
Add GN configuration to use system version of libvpx, Opus, FLAC,
re2 and OpenH264 libraries.
Makes the pkg_config config declaration optional, as it unconditionally
requires the package to be installed.
Change-Id: Ib33b2d35c87db26191f2b0368b89a07f5af99de2
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | chromium/third_party/flac/BUILD.gn | 39 | ||||
-rw-r--r-- | chromium/third_party/libvpx/BUILD.gn | 49 | ||||
-rw-r--r-- | chromium/third_party/openh264/BUILD.gn | 64 | ||||
-rw-r--r-- | chromium/third_party/opus/BUILD.gn | 34 | ||||
-rw-r--r-- | chromium/third_party/re2/BUILD.gn | 31 |
5 files changed, 206 insertions, 11 deletions
diff --git a/chromium/third_party/flac/BUILD.gn b/chromium/third_party/flac/BUILD.gn index ae81550588b..f6001b59e31 100644 --- a/chromium/third_party/flac/BUILD.gn +++ b/chromium/third_party/flac/BUILD.gn @@ -2,6 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/linux/pkg_config.gni") +import("//build/shim_headers.gni") + +declare_args() { + use_system_flac = false +} + config("flac_config") { defines = [ "FLAC__NO_DLL", @@ -22,7 +29,7 @@ config("flac_private_config") { } } -source_set("flac") { +source_set("bundled_flac") { sources = [ "include/FLAC/all.h", "include/FLAC/assert.h", @@ -111,3 +118,33 @@ source_set("flac") { ] } } + +if (use_system_flac) { + pkg_config("system_flac") { + packages = [ "flac" ] + } +} + +shim_headers("flac_shim") { + root_path = "include" + headers = [ + "FLAC/all.h", + "FLAC/assert.h", + "FLAC/callback.h", + "FLAC/export.h", + "FLAC/format.h", + "FLAC/metadata.h", + "FLAC/ordinals.h", + "FLAC/stream_decoder.h", + "FLAC/stream_encoder.h", + ] +} + +group("flac") { + if (use_system_flac) { + deps = [ ":flac_shim" ] + public_configs = [ ":system_flac" ] + } else { + public_deps = [ ":bundled_flac" ] + } +} diff --git a/chromium/third_party/libvpx/BUILD.gn b/chromium/third_party/libvpx/BUILD.gn index ab2fd0bbab0..6a7813d66c9 100644 --- a/chromium/third_party/libvpx/BUILD.gn +++ b/chromium/third_party/libvpx/BUILD.gn @@ -6,10 +6,16 @@ import("//build/config/android/config.gni") import("//build/config/arm.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/ios/config.gni") +import("//build/config/linux/pkg_config.gni") import("//build/config/sanitizers/sanitizers.gni") +import("//build/shim_headers.gni") import("//third_party/libvpx/libvpx_srcs.gni") import("//third_party/nasm/nasm_assemble.gni") +declare_args() { + use_system_libvpx = false +} + # Sets the architecture name for building libvpx. if (current_cpu == "x86") { cpu_arch_full = "ia32" @@ -365,7 +371,7 @@ source_set("libvpx_generic_headers") { sources = libvpx_srcs_generic_headers } -static_library("libvpx") { +static_library("bundled_libvpx") { if (!is_debug && (is_win || is_chromeos)) { configs -= [ "//build/config/compiler:default_optimization" ] configs += [ "//build/config/compiler:optimize_max" ] @@ -451,7 +457,7 @@ static_library("libvpx") { public_configs = [ ":libvpx_external_config" ] } -static_library("libvp9rc") { +static_library("bundled_libvp9rc") { if (!is_debug && is_win) { configs -= [ "//build/config/compiler:default_optimization" ] configs += [ "//build/config/compiler:optimize_max" ] @@ -469,3 +475,42 @@ static_library("libvp9rc") { public_configs = [ ":libvpx_external_config" ] } + +if (use_system_libvpx) { + pkg_config("system_libvpx") { + packages = [ "vpx" ] + } +} + +shim_headers("libvpx_shim") { + root_path = "source/libvpx/vpx" + prefix = "vpx/" + headers = [ + "vp8.h", + "vp8cx.h", + "vp8dx.h", + "vpx_codec.h", + "vpx_decoder.h", + "vpx_encoder.h", + "vpx_frame_buffer.h", + "vpx_image.h", + "vpx_integer.h", + ] +} + +group("libvpx") { + if (use_system_libvpx) { + deps = [ ":libvpx_shim" ] + public_configs = [ ":system_libvpx" ] + } else { + public_deps = [ ":bundled_libvpx" ] + } +} + +group("libvp9rc") { + if (use_system_libvpx) { + public_deps = [ ":libvpx" ] + } else { + public_deps = [ ":bundled_libvp9rc" ] + } +} diff --git a/chromium/third_party/openh264/BUILD.gn b/chromium/third_party/openh264/BUILD.gn index a8c658b5c91..a0a20f7293a 100644 --- a/chromium/third_party/openh264/BUILD.gn +++ b/chromium/third_party/openh264/BUILD.gn @@ -3,10 +3,16 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") +import("//build/config/linux/pkg_config.gni") import("//build/config/sanitizers/sanitizers.gni") +import("//build/shim_headers.gni") import("//third_party/nasm/nasm_assemble.gni") import("//third_party/openh264/openh264_sources.gni") +declare_args() { + use_system_openh264 = false +} + # Config shared by all openh264 targets. config("config") { cflags = [] @@ -129,7 +135,7 @@ if (use_assembler) { } } # if (is_win || is_linux || is_chromeos) -source_set("common") { +source_set("bundled_common") { sources = openh264_common_sources if (is_chromeos_ash && current_cpu == "arm") { sources += openh264_common_sources_asm_arm @@ -155,7 +161,7 @@ source_set("common") { } } -source_set("processing") { +source_set("bundled_processing") { sources = openh264_processing_sources if (is_chromeos_ash && current_cpu == "arm") { sources += openh264_processing_sources_asm_arm @@ -165,14 +171,16 @@ source_set("processing") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":config" ] - deps = [ ":common" ] + deps = [ + ":bundled_common", + ] if (use_assembler) { defines = [ "X86_ASM" ] deps += [ ":openh264_processing_asm" ] } } -source_set("encoder") { +source_set("bundled_encoder") { sources = openh264_encoder_sources if (is_chromeos_ash && current_cpu == "arm") { sources += openh264_encoder_sources_asm_arm @@ -189,11 +197,55 @@ source_set("encoder") { configs -= [ "//build/config/clang:extra_warnings" ] } deps = [ - ":common", - ":processing", + ":bundled_common", + ":bundled_processing", ] if (use_assembler) { defines = [ "X86_ASM" ] deps += [ ":openh264_encoder_asm" ] } } + +if (use_system_openh264) { + pkg_config("system_openh264") { + packages = [ "openh264" ] + } +} + +shim_headers("openh264_shim") { + prefix = "wels/" + root_path = "src/codec/api/svc" + headers = [ + "codec_api.h", + "codec_app_def.h", + "codec_def.h", + "codec_ver.h", + ] +} + +group("common") { + if (use_system_openh264) { + deps = [ ":openh264_shim" ] + public_configs = [ ":system_openh264" ] + } else { + public_deps = [ ":bundled_common" ] + } +} + +group("processing") { + if (use_system_openh264) { + deps = [ ":openh264_shim" ] + public_configs = [ ":system_openh264" ] + } else { + public_deps = [ ":bundled_processing" ] + } +} + +group("encoder") { + if (use_system_openh264) { + deps = [ ":openh264_shim" ] + public_configs = [ ":system_openh264" ] + } else { + public_deps = [ ":bundled_encoder" ] + } +} diff --git a/chromium/third_party/opus/BUILD.gn b/chromium/third_party/opus/BUILD.gn index 2394f5cd469..c266a4aa36b 100644 --- a/chromium/third_party/opus/BUILD.gn +++ b/chromium/third_party/opus/BUILD.gn @@ -3,8 +3,14 @@ # found in the LICENSE file. import("//build/config/arm.gni") +import("//build/config/linux/pkg_config.gni") +import("//build/shim_headers.gni") import("//testing/test.gni") +declare_args() { + use_system_opus = false +} + # If fixed point implementation shall be used (otherwise float). use_opus_fixed_point = current_cpu == "arm" || current_cpu == "arm64" @@ -207,7 +213,7 @@ if (use_opus_x86_optimization) { # Note: Do not add any defines or include_dirs to this target, those should all # go in the opus_private_config so they can be shared with intrinsic targets. -static_library("opus") { +static_library("bundled_opus") { sources = [ "src/celt/_kiss_fft_guts.h", "src/celt/arch.h", @@ -627,3 +633,29 @@ if (is_android || is_linux || is_chromeos) { ] } } + +if (use_system_opus) { + pkg_config("system_opus") { + packages = [ "opus" ] + } +} + +shim_headers("opus_shim") { + root_path = "src/include" + headers = [ + "opus.h", + "opus_custom.h", + "opus_defines.h", + "opus_multistream.h", + "opus_types.h", + ] +} + +group("opus") { + if (use_system_opus) { + deps = [ ":opus_shim" ] + public_configs = [ ":system_opus" ] + } else { + public_deps = [ ":bundled_opus" ] + } +} diff --git a/chromium/third_party/re2/BUILD.gn b/chromium/third_party/re2/BUILD.gn index a4e38410d1e..88a15bfe2d9 100644 --- a/chromium/third_party/re2/BUILD.gn +++ b/chromium/third_party/re2/BUILD.gn @@ -3,12 +3,17 @@ # found in the LICENSE file. import("//testing/libfuzzer/fuzzer_test.gni") +import("//build/shim_headers.gni") + +declare_args() { + use_system_re2 = false +} config("re2_config") { include_dirs = [ "src" ] } -static_library("re2") { +static_library("bundled_re2") { sources = [ "src/re2/bitmap256.h", "src/re2/bitstate.cc", @@ -64,3 +69,27 @@ fuzzer_test("third_party_re2_fuzzer") { sources = [ "src/re2/fuzzing/re2_fuzzer.cc" ] deps = [ ":re2" ] } + +shim_headers("re2_shim") { + root_path = "src/re2" + prefix = "re2/" + headers = [ + "filtered_re2.h", + "re2.h", + "set.h", + "stringpiece.h" + ] +} + +source_set("system_re2") { + deps = [ ":re2_shim" ] + libs = [ "re2" ] +} + +group("re2") { + if (use_system_re2) { + public_deps = [ ":system_re2" ] + } else { + public_deps = [ ":bundled_re2" ] + } +} |