summaryrefslogtreecommitdiffstats
path: root/webkit/build/JavaScriptCore/SConscript
blob: 08c577c296beb9e20a5202ecb52d5c7ca8a36ad4 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

Import('env')

env = env.Clone()


cygwin = env.Dir('$CHROME_SRC_DIR/third_party/cygwin/bin')
cygwin_posix = cygwin.abspath.replace('\\', '/')
env.PrependENVPath('PATH', cygwin_posix)


hash_table_cmd = '$PERL $CREATE_HASH_TABLE $SOURCE $CREATE_HASH_TABLE_FLAGS > $TARGET'

env.Replace(
    CREATE_HASH_TABLE_COM       = hash_table_cmd,
    CREATE_HASH_TABLE           = env.File('$CHROME_SRC_DIR/third_party/WebKit/JavaScriptCore/create_hash_table'),
    CREATE_HASH_TABLE_FLAGS     = '-i',
)

# TODO(erg): Temporarily disabling JSC building since it's changed heavily
# during the merge; I am also not sure we want/need to build it when building
# V8...
#
# We still need to build the pieces of pcre so we can't just drop this
# SConscript file though... <http://crbug.com/3043>
# env['BUILDERS']['Lookup_Table_h'] = Builder(action = '$CREATE_HASH_TABLE_COM',
#                                             suffix = '.lut.h',
#                                             src_suffix = '.cpp')
#
# inputs = [
#     'array_object',
#     'date_object',
#     'math_object',
#     'number_object',
#     'regexp_object',
#     'string_object',
# ]
#
# for i in inputs:
#     env.Lookup_Table_h(i, '$KJS_DIR/%s.cpp' % i)
#
# env.Lookup_Table_h('lexer', '$KJS_DIR/keywords.table',
#                    CREATE_HASH_TABLE_FLAGS='')

# TODO(bradnelson): sucks, needs relative path
env.Command('$WEBKIT_DIR/port/JavaScriptCore/chartables.c',
            '$PCRE_DIR/dftables',
            '$PERL $CHROME_SRC_DIR/third_party/WebKit/JavaScriptCore/pcre/dftables ' + \
            '${TARGET.posix}')

# We'd like to do this as follows:
#env.CXXFile('grammar.cpp', '$KJS_DIR/grammar.y')
# but SCons has a HARD-WIRED notion that the source must be a .yy file.
# TODO(bradnelson): not sure why YACCCOM is needed, but fails without
cpp = env.Command(['Grammar.cpp', 'Grammar.h'],
                  '$JAVASCRIPTCORE_DIR/parser/Grammar.y',
                  '$YACCCOM',
                  YACCCOM = '$YACC $YACCFLAGS -o $TARGET $SOURCES',
                  YACCFLAGS = '-d -p kjsyy')
env.AddPostAction(cpp, Move('${TARGETS[1]}', '${TARGET.dir}/Grammar.hpp'))

copies = [
    'API/APICast.h',
    'API/JSBase.h',
    'API/JSValueRef.h',
    'API/JSObjectRef.h',
    'API/JSRetainPtr.h',
    'API/JSContextRef.h',
    'API/JSStringRef.h',
    'API/JSStringRefCF.h',
    'API/JSStringRefBSTR.h',
    'API/JavaScriptCore.h',
    # NOTE: these work ok for now with relative paths because they are concated
    # with JAVASCRIPT_CORE_DIR down below.
    '../WebCore/bridge/npruntime.h',
    '../WebCore/bridge/runtime.h',
    '../WebCore/bridge/NP_jsobject.h',
    '../WebCore/bridge/npruntime_internal.h',
    '../WebCore/bridge/npruntime_impl.h',
    '../WebCore/bridge/runtime_object.h',
    '../WebCore/bridge/runtime_root.h',
    'runtime/Collector.h',
    'wtf/HashCountedSet.h',
]

JSCORE_OUT = '$WEBKIT_DIR/scons/WebCore/JavaScriptCore'

for c in copies:
  i = env.Install(JSCORE_OUT, '$JAVASCRIPTCORE_DIR/' + c)
  env.Alias('webkit', i)

# Stuff for WTF
env = env.Clone(
    CPPPATH = [
        '$JAVASCRIPTCORE_DIR',
        '$WTF_DIR',
        '$JAVASCRIPTCORE_DIR/API',
        '$JAVASCRIPTCORE_DIR/bindings',
        '$JAVASCRIPTCORE_DIR/bindings/c',
        '$JAVASCRIPTCORE_DIR/bindings/jni',
        '$WEBKIT_DIR/pending',
        '$JAVASCRIPTCORE_DIR/wtf',
        '$ICU38_DIR/public/common',
        '$ICU38_DIR/public/i18n',
        '$WEBKIT_DIR',
        '$CHROME_SRC_DIR',
    ],
)

env.Append(
    CPPDEFINES = [
        '__STD_C',
        'U_STATIC_IMPLEMENTATION',
    ],
    CPPPATH = [
        '$WTF_DIR/unicode',
    ],
)

if env.Bit('windows'):
    env.Append(
        CPPPATH = [
                # Windows workarounds to not having pthread.h and sched.h
                '$WEBKIT_DIR/build/JavaScriptCore',
                # Windows workarounds to not having stdint.h
                '$JAVASCRIPTCORE_DIR/os-win32',
                ],
        CPPDEFINES = [
                'CRASH=__debugbreak',
                ],
        CCFLAGS = [
                '/TP',

                '/Wp64',

                '/wd4127',
                '/wd4355',
                '/wd4510',
                '/wd4512',
                '/wd4610',
                '/wd4706',
                ],
        )

wtf_inputs = [
    '$WTF_DIR/ByteArray.cpp',
    '$WTF_DIR/Assertions.cpp',
    '$WTF_DIR/chromium/MainThreadChromium.cpp',
    '$WTF_DIR/dtoa.cpp',
    '$WTF_DIR/FastMalloc.cpp',
    '$WTF_DIR/HashTable.cpp',
    '$WTF_DIR/MainThread.cpp',
    '$WTF_DIR/RandomNumber.cpp',
    '$WTF_DIR/RefCountedLeakCounter.cpp',
    '$WTF_DIR/Threading.cpp',
    '$WTF_DIR/ThreadingPthreads.cpp',
    '$WTF_DIR/TCSystemAlloc.cpp',
    '$WTF_DIR/unicode/UTF8.cpp',
    '$WTF_DIR/unicode/icu/CollatorICU.cpp',
]

if env.Bit('windows'):
  wtf_inputs.extend([
      '$WTF_DIR/ThreadingWin.cpp',
      '$WTF_DIR/ThreadSpecificWin.cpp',
  ])
elif env.Bit('linux'):
  # Re-add the include path for glib.h because it got lost when cloning the
  # environment.
  env.ParseConfig('pkg-config --cflags --libs glib-2.0')


env.ChromeLibrary('WTF', wtf_inputs)

env.ChromeMSVSProject('$WEBKIT_DIR/build/JavaScriptCore/WTF.vcproj',
                guid='{AA8A5A85-592B-4357-BC60-E0E91E026AF6}')