| OLD | NEW |
| 1 # Copyright 2010 the V8 project authors. All rights reserved. | 1 # Copyright 2010 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 18 matching lines...) Expand all Loading... |
| 29 import re | 29 import re |
| 30 import subprocess | 30 import subprocess |
| 31 import sys | 31 import sys |
| 32 import os | 32 import os |
| 33 from os.path import join, dirname, abspath | 33 from os.path import join, dirname, abspath |
| 34 from types import DictType, StringTypes | 34 from types import DictType, StringTypes |
| 35 root_dir = dirname(File('SConstruct').rfile().abspath) | 35 root_dir = dirname(File('SConstruct').rfile().abspath) |
| 36 sys.path.insert(0, join(root_dir, 'tools')) | 36 sys.path.insert(0, join(root_dir, 'tools')) |
| 37 import js2c, utils | 37 import js2c, utils |
| 38 | 38 |
| 39 # ANDROID_TOP is the top of the Android checkout, fetched from the environment | |
| 40 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB | |
| 41 # environment variables to the cross-compiling tools. | |
| 42 ANDROID_TOP = os.environ.get('TOP') | |
| 43 if ANDROID_TOP is None: | |
| 44 ANDROID_TOP="" | |
| 45 | |
| 46 # ARM_TARGET_LIB is the path to the dynamic library to use on the target | 39 # ARM_TARGET_LIB is the path to the dynamic library to use on the target |
| 47 # machine if cross-compiling to an arm machine. You will also need to set | 40 # machine if cross-compiling to an arm machine. You will also need to set |
| 48 # the additional cross-compiling environment variables to the cross compiler. | 41 # the additional cross-compiling environment variables to the cross compiler. |
| 49 ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') | 42 ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') |
| 50 if ARM_TARGET_LIB: | 43 if ARM_TARGET_LIB: |
| 51 ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + | 44 ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + |
| 52 ARM_TARGET_LIB + '/usr/lib', | 45 ARM_TARGET_LIB + '/usr/lib', |
| 53 '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + | 46 '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + |
| 54 '/lib/ld-linux.so.3'] | 47 '/lib/ld-linux.so.3'] |
| 55 else: | 48 else: |
| 56 ARM_LINK_FLAGS = [] | 49 ARM_LINK_FLAGS = [] |
| 57 | 50 |
| 58 GCC_EXTRA_CCFLAGS = [] | 51 GCC_EXTRA_CCFLAGS = [] |
| 59 GCC_DTOA_EXTRA_CCFLAGS = [] | 52 GCC_DTOA_EXTRA_CCFLAGS = [] |
| 60 | 53 |
| 61 ANDROID_FLAGS = ['-march=armv7-a', | |
| 62 '-mtune=cortex-a8', | |
| 63 '-mfloat-abi=softfp', | |
| 64 '-mfpu=vfp', | |
| 65 '-fpic', | |
| 66 '-mthumb-interwork', | |
| 67 '-funwind-tables', | |
| 68 '-fstack-protector', | |
| 69 '-fno-short-enums', | |
| 70 '-fmessage-length=0', | |
| 71 '-finline-functions', | |
| 72 '-fno-inline-functions-called-once', | |
| 73 '-fgcse-after-reload', | |
| 74 '-frerun-cse-after-loop', | |
| 75 '-frename-registers', | |
| 76 '-fomit-frame-pointer', | |
| 77 '-finline-limit=64', | |
| 78 '-DCAN_USE_VFP_INSTRUCTIONS=1', | |
| 79 '-DCAN_USE_ARMV7_INSTRUCTIONS=1', | |
| 80 '-DCAN_USE_UNALIGNED_ACCESSES=1', | |
| 81 '-MD'] | |
| 82 | |
| 83 ANDROID_INCLUDES = [ANDROID_TOP + '/bionic/libc/arch-arm/include', | |
| 84 ANDROID_TOP + '/bionic/libc/include', | |
| 85 ANDROID_TOP + '/bionic/libstdc++/include', | |
| 86 ANDROID_TOP + '/bionic/libc/kernel/common', | |
| 87 ANDROID_TOP + '/bionic/libc/kernel/arch-arm', | |
| 88 ANDROID_TOP + '/bionic/libm/include', | |
| 89 ANDROID_TOP + '/bionic/libm/include/arch/arm', | |
| 90 ANDROID_TOP + '/bionic/libthread_db/include', | |
| 91 ANDROID_TOP + '/frameworks/base/include', | |
| 92 ANDROID_TOP + '/system/core/include'] | |
| 93 | |
| 94 ANDROID_LINKFLAGS = ['-nostdlib', | |
| 95 '-Bdynamic', | |
| 96 '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x', | |
| 97 '-Wl,-dynamic-linker,/system/bin/linker', | |
| 98 '-Wl,--gc-sections', | |
| 99 '-Wl,-z,nocopyreloc', | |
| 100 '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/gen
eric/obj/lib', | |
| 101 ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin
_dynamic.o', | |
| 102 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0
/lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a', | |
| 103 ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_a
ndroid.o']; | |
| 104 | |
| 105 LIBRARY_FLAGS = { | 54 LIBRARY_FLAGS = { |
| 106 'all': { | 55 'all': { |
| 107 'CPPPATH': [join(root_dir, 'src')], | 56 'CPPPATH': [join(root_dir, 'src')], |
| 108 'regexp:interpreted': { | 57 'regexp:interpreted': { |
| 109 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] | 58 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] |
| 110 }, | 59 }, |
| 111 'mode:debug': { | 60 'mode:debug': { |
| 112 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT'] | 61 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT'] |
| 113 }, | 62 }, |
| 114 'vmstate:on': { | 63 'vmstate:on': { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 # needs to define __C99FEATURES__. | 142 # needs to define __C99FEATURES__. |
| 194 'CPPDEFINES': ['__C99FEATURES__'], | 143 'CPPDEFINES': ['__C99FEATURES__'], |
| 195 'CPPPATH' : ['/usr/local/include'], | 144 'CPPPATH' : ['/usr/local/include'], |
| 196 'LIBPATH' : ['/usr/local/lib'], | 145 'LIBPATH' : ['/usr/local/lib'], |
| 197 'CCFLAGS': ['-ansi'], | 146 'CCFLAGS': ['-ansi'], |
| 198 }, | 147 }, |
| 199 'os:win32': { | 148 'os:win32': { |
| 200 'CCFLAGS': ['-DWIN32'], | 149 'CCFLAGS': ['-DWIN32'], |
| 201 'CXXFLAGS': ['-DWIN32'], | 150 'CXXFLAGS': ['-DWIN32'], |
| 202 }, | 151 }, |
| 203 'os:android': { | |
| 204 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', | |
| 205 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], | |
| 206 'CCFLAGS': ANDROID_FLAGS, | |
| 207 'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type', | |
| 208 '-Wstrict-aliasing=2'], | |
| 209 'CPPPATH': ANDROID_INCLUDES, | |
| 210 }, | |
| 211 'arch:ia32': { | 152 'arch:ia32': { |
| 212 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], | 153 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], |
| 213 'CCFLAGS': ['-m32'], | 154 'CCFLAGS': ['-m32'], |
| 214 'LINKFLAGS': ['-m32'] | 155 'LINKFLAGS': ['-m32'] |
| 215 }, | 156 }, |
| 216 'arch:arm': { | 157 'arch:arm': { |
| 217 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], | 158 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], |
| 218 'unalignedaccesses:on' : { | 159 'unalignedaccesses:on' : { |
| 219 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] | 160 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] |
| 220 }, | 161 }, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 'os:solaris': { | 390 'os:solaris': { |
| 450 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | 391 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 451 'LINKFLAGS': ['-mt'] | 392 'LINKFLAGS': ['-mt'] |
| 452 }, | 393 }, |
| 453 'os:openbsd': { | 394 'os:openbsd': { |
| 454 'LIBS': ['execinfo', 'pthread'] | 395 'LIBS': ['execinfo', 'pthread'] |
| 455 }, | 396 }, |
| 456 'os:win32': { | 397 'os:win32': { |
| 457 'LIBS': ['winmm', 'ws2_32'] | 398 'LIBS': ['winmm', 'ws2_32'] |
| 458 }, | 399 }, |
| 459 'os:android': { | |
| 460 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', | |
| 461 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], | |
| 462 'CCFLAGS': ANDROID_FLAGS, | |
| 463 'CPPPATH': ANDROID_INCLUDES, | |
| 464 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', | |
| 465 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.
0/lib/gcc/arm-eabi/4.4.0/interwork'], | |
| 466 'LINKFLAGS': ANDROID_LINKFLAGS, | |
| 467 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], | |
| 468 'mode:release': { | |
| 469 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] | |
| 470 } | |
| 471 }, | |
| 472 'arch:arm': { | 400 'arch:arm': { |
| 473 'LINKFLAGS': ARM_LINK_FLAGS | 401 'LINKFLAGS': ARM_LINK_FLAGS |
| 474 }, | 402 }, |
| 475 }, | 403 }, |
| 476 'msvc': { | 404 'msvc': { |
| 477 'all': { | 405 'all': { |
| 478 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], | 406 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], |
| 479 'LIBS': ['winmm', 'ws2_32'] | 407 'LIBS': ['winmm', 'ws2_32'] |
| 480 }, | 408 }, |
| 481 'library:shared': { | 409 'library:shared': { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | 444 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 517 'LINKFLAGS': ['-mt'] | 445 'LINKFLAGS': ['-mt'] |
| 518 }, | 446 }, |
| 519 'os:openbsd': { | 447 'os:openbsd': { |
| 520 'LIBPATH' : ['/usr/local/lib'], | 448 'LIBPATH' : ['/usr/local/lib'], |
| 521 'LIBS': ['execinfo', 'pthread'] | 449 'LIBS': ['execinfo', 'pthread'] |
| 522 }, | 450 }, |
| 523 'os:win32': { | 451 'os:win32': { |
| 524 'LIBS': ['winmm', 'ws2_32'] | 452 'LIBS': ['winmm', 'ws2_32'] |
| 525 }, | 453 }, |
| 526 'os:android': { | |
| 527 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', | |
| 528 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], | |
| 529 'CCFLAGS': ANDROID_FLAGS, | |
| 530 'CPPPATH': ANDROID_INCLUDES, | |
| 531 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', | |
| 532 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.
0/lib/gcc/arm-eabi/4.4.0/interwork'], | |
| 533 'LINKFLAGS': ANDROID_LINKFLAGS, | |
| 534 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], | |
| 535 'mode:release': { | |
| 536 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] | |
| 537 } | |
| 538 }, | |
| 539 'arch:arm': { | 454 'arch:arm': { |
| 540 'LINKFLAGS': ARM_LINK_FLAGS | 455 'LINKFLAGS': ARM_LINK_FLAGS |
| 541 }, | 456 }, |
| 542 'arch:ia32': { | 457 'arch:ia32': { |
| 543 'CCFLAGS': ['-m32'], | 458 'CCFLAGS': ['-m32'], |
| 544 'LINKFLAGS': ['-m32'] | 459 'LINKFLAGS': ['-m32'] |
| 545 }, | 460 }, |
| 546 'arch:x64': { | 461 'arch:x64': { |
| 547 'CCFLAGS': ['-m64'], | 462 'CCFLAGS': ['-m64'], |
| 548 'LINKFLAGS': ['-m64'] | 463 'LINKFLAGS': ['-m64'] |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 'CPPPATH': [join(abspath('.'), 'include'), join(abspath('.'), 'src')] | 553 'CPPPATH': [join(abspath('.'), 'include'), join(abspath('.'), 'src')] |
| 639 }, | 554 }, |
| 640 'gcc': { | 555 'gcc': { |
| 641 'all': { | 556 'all': { |
| 642 'LIBPATH': ['.'], | 557 'LIBPATH': ['.'], |
| 643 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] | 558 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] |
| 644 }, | 559 }, |
| 645 'os:win32': { | 560 'os:win32': { |
| 646 'LIBS': ['winmm', 'ws2_32'] | 561 'LIBS': ['winmm', 'ws2_32'] |
| 647 }, | 562 }, |
| 648 'os:android': { | |
| 649 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', | |
| 650 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], | |
| 651 'CCFLAGS': ANDROID_FLAGS, | |
| 652 'CPPPATH': ANDROID_INCLUDES, | |
| 653 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', | |
| 654 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.
0/lib/gcc/arm-eabi/4.4.0/interwork'], | |
| 655 'LINKFLAGS': ANDROID_LINKFLAGS, | |
| 656 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], | |
| 657 'mode:release': { | |
| 658 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] | |
| 659 } | |
| 660 }, | |
| 661 'arch:arm': { | 563 'arch:arm': { |
| 662 'LINKFLAGS': ARM_LINK_FLAGS | 564 'LINKFLAGS': ARM_LINK_FLAGS |
| 663 }, | 565 }, |
| 664 'arch:ia32': { | 566 'arch:ia32': { |
| 665 'CCFLAGS': ['-m32'], | 567 'CCFLAGS': ['-m32'], |
| 666 'LINKFLAGS': ['-m32'] | 568 'LINKFLAGS': ['-m32'] |
| 667 }, | 569 }, |
| 668 'arch:x64': { | 570 'arch:x64': { |
| 669 'CCFLAGS': ['-m64'], | 571 'CCFLAGS': ['-m64'], |
| 670 'LINKFLAGS': ['-m64'] | 572 'LINKFLAGS': ['-m64'] |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 'os:freebsd': { | 693 'os:freebsd': { |
| 792 'LIBS': ['pthread'], | 694 'LIBS': ['pthread'], |
| 793 }, | 695 }, |
| 794 'os:solaris': { | 696 'os:solaris': { |
| 795 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | 697 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], |
| 796 'LINKFLAGS': ['-mt'] | 698 'LINKFLAGS': ['-mt'] |
| 797 }, | 699 }, |
| 798 'os:openbsd': { | 700 'os:openbsd': { |
| 799 'LIBS': ['pthread'], | 701 'LIBS': ['pthread'], |
| 800 }, | 702 }, |
| 801 'os:android': { | |
| 802 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib', | |
| 803 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.
0/lib/gcc/arm-eabi/4.4.0/interwork'], | |
| 804 'LINKFLAGS': ANDROID_LINKFLAGS, | |
| 805 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'], | |
| 806 }, | |
| 807 'os:win32': { | 703 'os:win32': { |
| 808 'LIBS': ['winmm', 'ws2_32'], | 704 'LIBS': ['winmm', 'ws2_32'], |
| 809 }, | 705 }, |
| 810 'arch:arm': { | 706 'arch:arm': { |
| 811 'LINKFLAGS': ARM_LINK_FLAGS | 707 'LINKFLAGS': ARM_LINK_FLAGS |
| 812 }, | 708 }, |
| 813 }, | 709 }, |
| 814 'msvc': { | 710 'msvc': { |
| 815 'all': { | 711 'all': { |
| 816 'LIBS': ['winmm', 'ws2_32'] | 712 'LIBS': ['winmm', 'ws2_32'] |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 # version of scons. Also, there's a bug in some revisions that | 1360 # version of scons. Also, there's a bug in some revisions that |
| 1465 # doesn't allow this flag to be set, so we swallow any exceptions. | 1361 # doesn't allow this flag to be set, so we swallow any exceptions. |
| 1466 # Lovely. | 1362 # Lovely. |
| 1467 try: | 1363 try: |
| 1468 SetOption('warn', 'no-deprecated') | 1364 SetOption('warn', 'no-deprecated') |
| 1469 except: | 1365 except: |
| 1470 pass | 1366 pass |
| 1471 | 1367 |
| 1472 | 1368 |
| 1473 Build() | 1369 Build() |
| OLD | NEW |