summaryrefslogtreecommitdiffstats
path: root/third_party/zstd/moz.build
blob: 3f38ca8feb7839f5f5d541f4b8a2408bbbf553ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- 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'