summaryrefslogtreecommitdiff
path: root/src/third_party/mozjs-38/SConscript
blob: 3b197a8bbcfe79f92d60da402d5f6a9e45b6a77c (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
# -*- mode: python -*-

Import("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']:
    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=[
        'AB_CD',
        'IMPL_MFBT',
        'JS_USE_CUSTOM_ALLOCATOR',
        'NO_NSPR_10_SUPPORT',
	'STATIC_JS_API=1',
        'U_NO_DEFAULT_INCLUDE_UTF_HEADERS=1',
        ])

# js-confdefs.h has to get in front on windows or wherever
if env.TargetOSIs('windows'):
    env.Prepend(CCFLAGS=[
            '/FI', 'js-confdefs.h'
            ])
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=[
    '#src',
    '$BUILD_DIR',
    '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/mfbt/Unified_cpp_mfbt0.cpp",
    "extract/js/src/perf/pm_stub.cpp",
    "extract/js/src/vm/TraceLogging.cpp",
    "extract/js/src/vm/TraceLoggingGraph.cpp",
    "extract/js/src/vm/TraceLoggingTypes.cpp",
    "extract/mfbt/Compression.cpp",
]

if env.TargetOSIs('windows'):
    sources.extend([
        "extract/js/src/jit/ExecutableAllocatorWin.cpp",
    ])
    env.Prepend(CPPDEFINES=[
        ("_CRT_RAND_S", "1")
    ])
else:
    sources.extend([
        "extract/js/src/jit/ExecutableAllocatorPosix.cpp",
    ])

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( "mozjs", sources )