summaryrefslogtreecommitdiff
path: root/src/third_party/mozjs-45/SConscript
blob: 747edfe80213d58e2b82c51ec7c91e78edf4be0a (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# -*- mode: python -*-

Import([
    "get_option",
    "env",
    ])

env = env.Clone()
env.InjectThirdPartyIncludePaths(libraries=['zlib'])

def removeIfPresent(lst, item):
    try:
        lst.remove(item)
    except ValueError:
        pass

for to_remove in ['-Werror', '-Wall', '-W', '/W3']:
    removeIfPresent(env['CCFLAGS'], to_remove)

# See what -D's show up in make.  The AB_CD one might change, but we're little
# endian only for now so I think it's sane
env.Prepend(CPPDEFINES=[
        'IMPL_MFBT',
        'JS_USE_CUSTOM_ALLOCATOR',
        'STATIC_JS_API=1',
        'U_NO_DEFAULT_INCLUDE_UTF_HEADERS=1',
        ])

if get_option('spider-monkey-dbg') == "on":
    env.Prepend(CPPDEFINES=[
            'DEBUG',
            'JS_DEBUG',
            'JS_GC_ZEAL',
            ])

# js-confdefs.h has to get in front on windows or wherever
if env.TargetOSIs('windows'):
    env.Prepend(CCFLAGS=[
            '/FI', 'js-confdefs.h',

            #  'declaration' : no matching operator delete found; memory will not be freed if
            #  initialization throws an exception
            '/wd4291',

            # name" : the inline specifier cannot be used when a friend declaration refers to a
            # specialization of a function template
            '/wd4396',

            # nonstandard extension used : zero-sized array in struct/union
            '/wd4200',

            # 'identifier' : no suitable definition provided for explicit template instantiation
            # request
            '/wd4661',

            # 'operation' : unsafe mix of type 'type' and type 'type' in operation
            '/wd4805',

            # 'reinterpret_cast': conversion from 'type' to 'type' of greater size
            '/wd4312',

            # 'operator': unsafe use of type 'type' in operation
            '/wd4804'
    ])
else:
    if env.TargetOSIs('solaris'):
        env.Prepend(CCFLAGS=[
            '-include', 'solaris_hacks.h'
        ])

    env.Append(
        CCFLAGS=[
            '-include', 'js-confdefs.h',
            '-Wno-invalid-offsetof',
        ],
        CXXFLAGS=[
            '-Wno-non-virtual-dtor',
        ],
    )

# js/src, js/public and mfbt are the only required sources right now, that
# could change in the future
#
# Also:
# We pre-generate configs for platforms and just check them in.  Running
# mozilla's config requires a relatively huge portion of their tree.
env.Prepend(CPPPATH=[
    'extract/js/src',
    'extract/mfbt',
    'extract/intl/icu/source/common',
    'include',
    'mongo_sources',
    'platform/' + env["TARGET_ARCH"] + "/" + env["TARGET_OS"] + "/build",
    'platform/' + env["TARGET_ARCH"] + "/" + env["TARGET_OS"] + "/include",
])

sources = [
    "extract/js/src/builtin/RegExp.cpp",
    "extract/js/src/frontend/Parser.cpp",
    "extract/js/src/jsarray.cpp",
    "extract/js/src/jsatom.cpp",
    "extract/js/src/jsmath.cpp",
    "extract/js/src/jsutil.cpp",
    "extract/js/src/gc/StoreBuffer.cpp",
    "extract/js/src/mfbt/Unified_cpp_mfbt0.cpp",
    "extract/js/src/perf/pm_stub.cpp",
    "extract/js/src/vm/Initialization.cpp",
    "extract/mfbt/Compression.cpp",
]


if env['TARGET_ARCH'] == 'x86_64' and not env.TargetOSIs('solaris'):
    sources.extend([
        "extract/js/src/jit/x86-shared/Disassembler-x86-shared.cpp",
    ])

if env.TargetOSIs('windows'):
    env.Prepend(CPPDEFINES=[
        ("_CRT_RAND_S", "1")
    ])

sources.extend(Glob('platform/' + env["TARGET_ARCH"] + "/" + env["TARGET_OS"] + "/build/*.cpp")),

# All of those unified sources come in from configure.  The files don't
# actually build individually anymore.
env.Library(
    target="mozjs",
    source=sources,
    LIBDEPS_TAGS=[
        # Depends on allocation symbols defined elsewhere
        'illegal_cyclic_or_unresolved_dependencies_whitelisted',
    ],
)