| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Note: this file is heavily based on //zircon/third_party/ulib/zstd/BUILD.gn. |
| |
| config("zstd_config") { |
| visibility = [ ":*" ] |
| |
| include_dirs = [ |
| "contrib/seekable_format", |
| "lib", |
| "lib/common", |
| "lib/compress", |
| "lib/dictBuilder", |
| ] |
| |
| defines = [ |
| "ZDICTLIB_VISIBILITY=", |
| "ZSTDERRORLIB_VISIBILITY=", |
| "ZSTDLIB_VISIBILITY=", |
| "XXH_NAMESPACE=ZSTD_", |
| ] |
| |
| if (is_host) { |
| defines += [ "ZSTD_MULTITHREAD" ] |
| } |
| |
| configs = [ "//build/config:symbol_visibility_hidden" ] |
| |
| # TODO(41757): UBSan has found an instance of undefined behavior in this target. |
| # Disable UBSan for this target temporarily until it is migrated into CI/CQ. |
| cflags = [ "-fno-sanitize=undefined" ] |
| } |
| |
| config("zstd_include") { |
| include_dirs = [ "//build/secondary/third_party/zstd/include" ] |
| } |
| |
| static_library("zstd") { |
| public = [ |
| "//build/secondary/third_party/zstd/include/zstd/zstd.h", |
| "//build/secondary/third_party/zstd/include/zstd/zstd_errors.h", |
| ] |
| |
| sources = [ |
| "lib/common/debug.c", |
| "lib/common/entropy_common.c", |
| "lib/common/error_private.c", |
| "lib/common/fse_decompress.c", |
| "lib/common/pool.c", |
| "lib/common/threading.c", |
| "lib/common/xxhash.c", |
| "lib/common/zstd_common.c", |
| "lib/compress/fse_compress.c", |
| "lib/compress/hist.c", |
| "lib/compress/huf_compress.c", |
| "lib/compress/zstd_compress.c", |
| "lib/compress/zstd_compress_literals.c", |
| "lib/compress/zstd_compress_sequences.c", |
| "lib/compress/zstd_double_fast.c", |
| "lib/compress/zstd_fast.c", |
| "lib/compress/zstd_lazy.c", |
| "lib/compress/zstd_ldm.c", |
| "lib/compress/zstd_opt.c", |
| "lib/compress/zstdmt_compress.c", |
| "lib/decompress/huf_decompress.c", |
| "lib/decompress/zstd_ddict.c", |
| "lib/decompress/zstd_decompress.c", |
| "lib/decompress/zstd_decompress_block.c", |
| "lib/dictBuilder/cover.c", |
| "lib/dictBuilder/divsufsort.c", |
| "lib/dictBuilder/fastcover.c", |
| "lib/dictBuilder/zdict.c", |
| ] |
| |
| public_configs = [ ":zstd_include" ] |
| |
| configs += [ ":zstd_config" ] |
| } |
| |
| config("zstd_seekable_config") { |
| visibility = [ ":*" ] |
| |
| cflags = [ "-Wno-sometimes-uninitialized" ] |
| } |
| |
| config("zstd_seekable_public_config") { |
| visibility = [ ":*" ] |
| |
| # Seekable library expects |
| # #include "zstd.h" |
| # to load zstd's lib/zstd.h. |
| include_dirs = [ "lib" ] |
| } |
| |
| static_library("zstdseek") { |
| public = [ "//build/secondary/third_party/zstd/include/zstd/zstd_seekable.h" ] |
| |
| sources = [ |
| "contrib/seekable_format/zstdseek_compress.c", |
| "contrib/seekable_format/zstdseek_decompress.c", |
| ] |
| |
| public_deps = [ ":zstd" ] |
| |
| # Compilation units loading seekable must incorporate its config's include_dirs. |
| public_configs = [ ":zstd_seekable_public_config" ] |
| |
| configs += [ |
| ":zstd_config", |
| ":zstd_seekable_config", |
| ] |
| } |