OLD | NEW |
1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 17 matching lines...) Expand all Loading... |
28 import platform | 28 import platform |
29 import re | 29 import re |
30 import sys | 30 import sys |
31 import os | 31 import os |
32 from os.path import join, dirname, abspath | 32 from os.path import join, dirname, abspath |
33 from types import DictType, StringTypes | 33 from types import DictType, StringTypes |
34 root_dir = dirname(File('SConstruct').rfile().abspath) | 34 root_dir = dirname(File('SConstruct').rfile().abspath) |
35 sys.path.append(join(root_dir, 'tools')) | 35 sys.path.append(join(root_dir, 'tools')) |
36 import js2c, utils | 36 import js2c, utils |
37 | 37 |
| 38 TOP = os.environ.get('TOP') |
| 39 if TOP is None: |
| 40 TOP="" |
| 41 |
| 42 ANDROID_FLAGS = ['-march=armv5te', |
| 43 '-mtune=xscale', |
| 44 '-msoft-float', |
| 45 '-fpic', |
| 46 '-mthumb-interwork', |
| 47 '-funwind-tables', |
| 48 '-fstack-protector', |
| 49 '-fno-short-enums', |
| 50 '-fmessage-length=0', |
| 51 '-finline-functions', |
| 52 '-fno-inline-functions-called-once', |
| 53 '-fgcse-after-reload', |
| 54 '-frerun-cse-after-loop', |
| 55 '-frename-registers', |
| 56 '-fomit-frame-pointer', |
| 57 '-fno-strict-aliasing', |
| 58 '-finline-limit=64', |
| 59 '-MD'] |
| 60 |
| 61 ANDROID_INCLUDES = [TOP + '/bionic/libc/arch-arm/include', |
| 62 TOP + '/bionic/libc/include', |
| 63 TOP + '/bionic/libstdc++/include', |
| 64 TOP + '/bionic/libc/kernel/common', |
| 65 TOP + '/bionic/libc/kernel/arch-arm', |
| 66 TOP + '/bionic/libm/include', |
| 67 TOP + '/bionic/libm/include/arch/arm', |
| 68 TOP + '/bionic/libthread_db/include'] |
38 | 69 |
39 LIBRARY_FLAGS = { | 70 LIBRARY_FLAGS = { |
40 'all': { | 71 'all': { |
41 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'] | 72 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'] |
42 }, | 73 }, |
43 'gcc': { | 74 'gcc': { |
44 'all': { | 75 'all': { |
45 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | 76 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
46 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], | 77 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
47 }, | 78 }, |
(...skipping 10 matching lines...) Expand all Loading... |
58 'os:macos': { | 89 'os:macos': { |
59 'CCFLAGS': ['-ansi'], | 90 'CCFLAGS': ['-ansi'], |
60 }, | 91 }, |
61 'os:freebsd': { | 92 'os:freebsd': { |
62 'CCFLAGS': ['-ansi'], | 93 'CCFLAGS': ['-ansi'], |
63 }, | 94 }, |
64 'os:win32': { | 95 'os:win32': { |
65 'CCFLAGS': ['-DWIN32'], | 96 'CCFLAGS': ['-DWIN32'], |
66 'CXXFLAGS': ['-DWIN32'], | 97 'CXXFLAGS': ['-DWIN32'], |
67 }, | 98 }, |
| 99 'os:android': { |
| 100 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', '__ARM_AR
CH_5E__', '__ARM_ARCH_5TE__', 'SK_RELEASE', 'NDEBUG'], |
| 101 'CCFLAGS': ANDROID_FLAGS, |
| 102 'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type', '-Wstrict-
aliasing=2'], |
| 103 'CPPPATH': ANDROID_INCLUDES, |
| 104 }, |
68 'wordsize:64': { | 105 'wordsize:64': { |
69 'CCFLAGS': ['-m32'], | 106 'CCFLAGS': ['-m32'], |
70 'LINKFLAGS': ['-m32'] | 107 'LINKFLAGS': ['-m32'] |
71 }, | 108 }, |
72 'prof:oprofile': { | 109 'prof:oprofile': { |
73 'CPPDEFINES': ['ENABLE_OPROFILE_AGENT'] | 110 'CPPDEFINES': ['ENABLE_OPROFILE_AGENT'] |
74 } | 111 } |
75 }, | 112 }, |
76 'msvc': { | 113 'msvc': { |
77 'all': { | 114 'all': { |
(...skipping 29 matching lines...) Expand all Loading... |
107 } | 144 } |
108 }, | 145 }, |
109 } | 146 } |
110 } | 147 } |
111 | 148 |
112 | 149 |
113 V8_EXTRA_FLAGS = { | 150 V8_EXTRA_FLAGS = { |
114 'gcc': { | 151 'gcc': { |
115 'all': { | 152 'all': { |
116 'CXXFLAGS': [], #['-fvisibility=hidden'], | 153 'CXXFLAGS': [], #['-fvisibility=hidden'], |
117 'WARNINGFLAGS': ['-pedantic', '-Wall', '-Werror', '-W', | 154 'WARNINGFLAGS': ['-Wall', '-Werror', '-W', |
118 '-Wno-unused-parameter'] | 155 '-Wno-unused-parameter'] |
119 }, | 156 }, |
120 'arch:arm': { | 157 'arch:arm': { |
121 'CPPDEFINES': ['ARM'] | 158 'CPPDEFINES': ['ARM'] |
122 }, | 159 }, |
| 160 'arch:android': { |
| 161 'CPPDEFINES': ['ARM'] |
| 162 }, |
123 'os:win32': { | 163 'os:win32': { |
124 'WARNINGFLAGS': ['-Wno-long-long'] | 164 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] |
| 165 }, |
| 166 'os:linux': { |
| 167 'WARNINGFLAGS': ['-pedantic'] |
| 168 }, |
| 169 'os:macos': { |
| 170 'WARNINGFLAGS': ['-pedantic'] |
125 }, | 171 }, |
126 'disassembler:on': { | 172 'disassembler:on': { |
127 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] | 173 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
128 } | 174 } |
129 }, | 175 }, |
130 'msvc': { | 176 'msvc': { |
131 'all': { | 177 'all': { |
132 'WARNINGFLAGS': ['/W3', '/WX', '/wd4355', '/wd4800'] | 178 'WARNINGFLAGS': ['/W3', '/WX', '/wd4355', '/wd4800'] |
133 }, | 179 }, |
134 'library:shared': { | 180 'library:shared': { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 'all': { | 213 'all': { |
168 'LIBS': ['winmm', 'ws2_32'] | 214 'LIBS': ['winmm', 'ws2_32'] |
169 } | 215 } |
170 } | 216 } |
171 } | 217 } |
172 | 218 |
173 | 219 |
174 DTOA_EXTRA_FLAGS = { | 220 DTOA_EXTRA_FLAGS = { |
175 'gcc': { | 221 'gcc': { |
176 'all': { | 222 'all': { |
177 'WARNINGFLAGS': ['-Werror'] | 223 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'] |
178 } | 224 } |
179 }, | 225 }, |
180 'msvc': { | 226 'msvc': { |
181 'all': { | 227 'all': { |
182 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] | 228 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] |
183 } | 229 } |
184 } | 230 } |
185 } | 231 } |
186 | 232 |
187 | 233 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 269 } |
224 | 270 |
225 | 271 |
226 SAMPLE_FLAGS = { | 272 SAMPLE_FLAGS = { |
227 'all': { | 273 'all': { |
228 'CPPPATH': [join(abspath('.'), 'include')], | 274 'CPPPATH': [join(abspath('.'), 'include')], |
229 'LIBS': ['$LIBRARY'], | 275 'LIBS': ['$LIBRARY'], |
230 }, | 276 }, |
231 'gcc': { | 277 'gcc': { |
232 'all': { | 278 'all': { |
233 'LIBPATH': ['.'] | 279 'LIBPATH': ['.'], |
| 280 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] |
234 }, | 281 }, |
235 'os:linux': { | 282 'os:linux': { |
236 'LIBS': ['pthread', 'rt'], | 283 'LIBS': ['pthread', 'rt'], |
237 }, | 284 }, |
238 'os:macos': { | 285 'os:macos': { |
239 'LIBS': ['pthread'], | 286 'LIBS': ['pthread'], |
240 }, | 287 }, |
241 'os:freebsd': { | 288 'os:freebsd': { |
242 'LIBS': ['execinfo', 'pthread'] | 289 'LIBS': ['execinfo', 'pthread'] |
243 }, | 290 }, |
244 'os:win32': { | 291 'os:win32': { |
245 'LIBS': ['winmm', 'ws2_32'] | 292 'LIBS': ['winmm', 'ws2_32'] |
246 }, | 293 }, |
247 'wordsize:64': { | 294 'os:android': { |
248 'CCFLAGS': ['-m32'], | 295 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', '__ARM_AR
CH_5E__', '__ARM_ARCH_5TE__', 'SK_RELEASE', 'NDEBUG'], |
249 'LINKFLAGS': ['-m32'] | 296 'CCFLAGS': ANDROID_FLAGS, |
| 297 'CPPPATH': ANDROID_INCLUDES, |
| 298 'LIBPATH': [TOP + '/out/target/product/generic/obj/lib'], |
| 299 'LINKFLAGS': ['-nostdlib', '-Bdynamic', '-Wl,-T,' + TOP + '/build/core/
armelf.x', '-Wl,-dynamic-linker,/system/bin/linker', '-Wl,--gc-sections', '-Wl,-
z,nocopyreloc', '-Wl,-rpath-link=' + TOP + '/out/target/product/generic/obj/lib'
, TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o', TOP + '/prebui
lt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a'
, TOP + '/out/target/product/generic/obj/lib/crtend_android.o'], |
| 300 'LIBS': ['c', 'stdc++', 'm'], |
250 }, | 301 }, |
251 'mode:release': { | 302 'mode:release': { |
252 'CCFLAGS': ['-O2'] | 303 'CCFLAGS': ['-O2'] |
253 }, | 304 }, |
254 'mode:debug': { | 305 'mode:debug': { |
255 'CCFLAGS': ['-g', '-O0'] | 306 'CCFLAGS': ['-g', '-O0'] |
256 }, | 307 }, |
257 'prof:oprofile': { | 308 'prof:oprofile': { |
258 'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'], | 309 'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'], |
259 'LIBS': ['opagent'] | 310 'LIBS': ['opagent'] |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 WORDSIZE_GUESS = utils.GuessWordsize() | 399 WORDSIZE_GUESS = utils.GuessWordsize() |
349 | 400 |
350 | 401 |
351 SIMPLE_OPTIONS = { | 402 SIMPLE_OPTIONS = { |
352 'toolchain': { | 403 'toolchain': { |
353 'values': ['gcc', 'msvc'], | 404 'values': ['gcc', 'msvc'], |
354 'default': TOOLCHAIN_GUESS, | 405 'default': TOOLCHAIN_GUESS, |
355 'help': 'the toolchain to use' | 406 'help': 'the toolchain to use' |
356 }, | 407 }, |
357 'os': { | 408 'os': { |
358 'values': ['freebsd', 'linux', 'macos', 'win32'], | 409 'values': ['freebsd', 'linux', 'macos', 'win32', 'android'], |
359 'default': OS_GUESS, | 410 'default': OS_GUESS, |
360 'help': 'the os to build for' | 411 'help': 'the os to build for' |
361 }, | 412 }, |
362 'arch': { | 413 'arch': { |
363 'values':['arm', 'ia32'], | 414 'values':['arm', 'ia32'], |
364 'default': ARCH_GUESS, | 415 'default': ARCH_GUESS, |
365 'help': 'the architecture to build for' | 416 'help': 'the architecture to build for' |
366 }, | 417 }, |
367 'snapshot': { | 418 'snapshot': { |
368 'values': ['on', 'off', 'nobuild'], | 419 'values': ['on', 'off', 'nobuild'], |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 self.AddRelevantSubFlags(options, { key: value }) | 554 self.AddRelevantSubFlags(options, { key: value }) |
504 else: | 555 else: |
505 if not key in options: | 556 if not key in options: |
506 options[key] = value | 557 options[key] = value |
507 else: | 558 else: |
508 prefix = options[key] | 559 prefix = options[key] |
509 if isinstance(prefix, StringTypes): prefix = prefix.split() | 560 if isinstance(prefix, StringTypes): prefix = prefix.split() |
510 options[key] = prefix + value | 561 options[key] = prefix + value |
511 | 562 |
512 def ConfigureObject(self, env, input, **kw): | 563 def ConfigureObject(self, env, input, **kw): |
| 564 if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): |
| 565 kw['CPPPATH'] += env['CPPPATH'] |
513 if self.options['library'] == 'static': | 566 if self.options['library'] == 'static': |
514 return env.StaticObject(input, **kw) | 567 return env.StaticObject(input, **kw) |
515 else: | 568 else: |
516 return env.SharedObject(input, **kw) | 569 return env.SharedObject(input, **kw) |
517 | 570 |
518 def ApplyEnvOverrides(self, env): | 571 def ApplyEnvOverrides(self, env): |
519 if not self.env_overrides: | 572 if not self.env_overrides: |
520 return | 573 return |
521 if type(env['ENV']) == DictType: | 574 if type(env['ENV']) == DictType: |
522 env['ENV'].update(**self.env_overrides) | 575 env['ENV'].update(**self.env_overrides) |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 # version of scons. Also, there's a bug in some revisions that | 721 # version of scons. Also, there's a bug in some revisions that |
669 # doesn't allow this flag to be set, so we swallow any exceptions. | 722 # doesn't allow this flag to be set, so we swallow any exceptions. |
670 # Lovely. | 723 # Lovely. |
671 try: | 724 try: |
672 SetOption('warn', 'no-deprecated') | 725 SetOption('warn', 'no-deprecated') |
673 except: | 726 except: |
674 pass | 727 pass |
675 | 728 |
676 | 729 |
677 Build() | 730 Build() |
OLD | NEW |