Source code

Revision control

Copy as Markdown

Other Tools

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'Networking')
EXPORTS.zstd += [
'lib/zstd.h',
]
UNIFIED_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/decompress/huf_decompress.c',
'lib/decompress/zstd_ddict.c',
'lib/decompress/zstd_decompress.c',
'lib/decompress/zstd_decompress_block.c',
]
# we aren't using these currently
#COMPRESS_SOURCES = [
# '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_compress_superblock.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',
#]
CFLAGS += [
'-Wextra',
'-Wcast-qual',
'-Wcast-align',
'-Wshadow',
'-Wstrict-aliasing=1',
'-Wswitch-enum',
'-Wdeclaration-after-statement',
'-Wstrict-prototypes',
'-Wundef',
'-Wpointer-arith',
'-Wvla',
'-Wformat=2',
'-Winit-self',
'-Wfloat-equal',
'-Wwrite-strings',
'-Wredundant-decls',
'-Wmissing-prototypes',
'-Wc++-compat'
]
CXXFLAGS += [
'-DXXH_NAMESPACE=ZSTD_',
'-DDEBUGLEVEL=0',
'-DZSTD_MULTITHREAD=1',
]
LOCAL_INCLUDES += [ 'lib/decompress' ]
# .S assembler format is incompatible with Microsoft MASM, disable for now
if CONFIG["OS_ARCH"] == "WINNT":
CXXFLAGS += [ '-DZSTD_DISABLE_ASM=1' ]
else:
# If the assembler format is made compatible, we still need to preprocess it
if CONFIG["TARGET_CPU"] == "x86_64" and CONFIG["OS_ARCH"] == "WINNT":
if CONFIG["CC_TYPE"] == "clang-cl":
# libffi asm needs to be preprocessed for MSVC's assembler
GeneratedFile("win64_intel.asm",
inputs=[
"lib/decompress/huf_decompress_amd64.S",
],
script="preprocess_asm.py",
flags=["$(DEFINES)", "$(LOCAL_INCLUDES)"],
)
SOURCES += ["!win64_intel.asm"]
else:
SOURCES += [
'lib/decompress/huf_decompress_amd64.S',
]
else:
SOURCES += [
'lib/decompress/huf_decompress_amd64.S',
]
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
Library('zstd')
FINAL_LIBRARY = 'xul'