Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1428)

Side by Side Diff: SConstruct

Issue 1275001: Fix Android scons build by putting -lv8 before -lgcc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ANDROID_TOP + '/system/core/include'] 83 ANDROID_TOP + '/system/core/include']
84 84
85 ANDROID_LINKFLAGS = ['-nostdlib', 85 ANDROID_LINKFLAGS = ['-nostdlib',
86 '-Bdynamic', 86 '-Bdynamic',
87 '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x', 87 '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x',
88 '-Wl,-dynamic-linker,/system/bin/linker', 88 '-Wl,-dynamic-linker,/system/bin/linker',
89 '-Wl,--gc-sections', 89 '-Wl,--gc-sections',
90 '-Wl,-z,nocopyreloc', 90 '-Wl,-z,nocopyreloc',
91 '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/gen eric/obj/lib', 91 '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/gen eric/obj/lib',
92 ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin _dynamic.o', 92 ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin _dynamic.o',
93 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1 /lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a', 93 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0 /lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a',
94 ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_a ndroid.o']; 94 ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_a ndroid.o'];
95 95
96 LIBRARY_FLAGS = { 96 LIBRARY_FLAGS = {
97 'all': { 97 'all': {
98 'CPPPATH': [join(root_dir, 'src')], 98 'CPPPATH': [join(root_dir, 'src')],
99 'regexp:native': { 99 'regexp:native': {
100 'CPPDEFINES': ['V8_NATIVE_REGEXP'] 100 'CPPDEFINES': ['V8_NATIVE_REGEXP']
101 }, 101 },
102 'mode:debug': { 102 'mode:debug': {
103 'CPPDEFINES': ['V8_ENABLE_CHECKS'] 103 'CPPDEFINES': ['V8_ENABLE_CHECKS']
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 'all': { 364 'all': {
365 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] 365 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244']
366 } 366 }
367 } 367 }
368 } 368 }
369 369
370 370
371 CCTEST_EXTRA_FLAGS = { 371 CCTEST_EXTRA_FLAGS = {
372 'all': { 372 'all': {
373 'CPPPATH': [join(root_dir, 'src')], 373 'CPPPATH': [join(root_dir, 'src')],
374 'LIBS': ['$LIBRARY']
375 }, 374 },
376 'gcc': { 375 'gcc': {
377 'all': { 376 'all': {
378 'LIBPATH': [abspath('.')] 377 'LIBPATH': [abspath('.')]
379 }, 378 },
380 'os:linux': { 379 'os:linux': {
381 'LIBS': ['pthread'], 380 'LIBS': ['pthread'],
382 }, 381 },
383 'os:macos': { 382 'os:macos': {
384 'LIBS': ['pthread'], 383 'LIBS': ['pthread'],
385 }, 384 },
386 'os:freebsd': { 385 'os:freebsd': {
387 'LIBS': ['execinfo', 'pthread'] 386 'LIBS': ['execinfo', 'pthread']
388 }, 387 },
389 'os:solaris': { 388 'os:solaris': {
390 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], 389 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
391 'LINKFLAGS': ['-mt'] 390 'LINKFLAGS': ['-mt']
392 }, 391 },
393 'os:openbsd': { 392 'os:openbsd': {
394 'LIBS': ['execinfo', 'pthread'] 393 'LIBS': ['execinfo', 'pthread']
395 }, 394 },
396 'os:win32': { 395 'os:win32': {
397 'LIBS': ['winmm', 'ws2_32'] 396 'LIBS': ['winmm', 'ws2_32']
398 }, 397 },
399 'os:android': { 398 'os:android': {
400 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', 399 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
401 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], 400 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
402 'CCFLAGS': ANDROID_FLAGS, 401 'CCFLAGS': ANDROID_FLAGS,
403 'CPPPATH': ANDROID_INCLUDES, 402 'CPPPATH': ANDROID_INCLUDES,
404 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], 403 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib',
404 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4. 0/lib/gcc/arm-eabi/4.4.0/interwork'],
405 'LINKFLAGS': ANDROID_LINKFLAGS, 405 'LINKFLAGS': ANDROID_LINKFLAGS,
406 'LIBS': ['log', 'c', 'stdc++', 'm'], 406 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'],
407 'mode:release': { 407 'mode:release': {
408 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] 408 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
409 } 409 }
410 }, 410 },
411 }, 411 },
412 'msvc': { 412 'msvc': {
413 'all': { 413 'all': {
414 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], 414 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
415 'LIBS': ['winmm', 'ws2_32'] 415 'LIBS': ['winmm', 'ws2_32']
416 }, 416 },
417 'library:shared': { 417 'library:shared': {
418 'CPPDEFINES': ['USING_V8_SHARED'] 418 'CPPDEFINES': ['USING_V8_SHARED']
419 }, 419 },
420 'arch:ia32': { 420 'arch:ia32': {
421 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] 421 'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
422 }, 422 },
423 'arch:x64': { 423 'arch:x64': {
424 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], 424 'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
425 'LINKFLAGS': ['/STACK:2091752'] 425 'LINKFLAGS': ['/STACK:2091752']
426 }, 426 },
427 } 427 }
428 } 428 }
429 429
430 430
431 SAMPLE_FLAGS = { 431 SAMPLE_FLAGS = {
432 'all': { 432 'all': {
433 'CPPPATH': [join(abspath('.'), 'include')], 433 'CPPPATH': [join(abspath('.'), 'include')],
434 'LIBS': ['$LIBRARY'],
435 }, 434 },
436 'gcc': { 435 'gcc': {
437 'all': { 436 'all': {
438 'LIBPATH': ['.'], 437 'LIBPATH': ['.'],
439 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] 438 'CCFLAGS': ['-fno-rtti', '-fno-exceptions']
440 }, 439 },
441 'os:linux': { 440 'os:linux': {
442 'LIBS': ['pthread'], 441 'LIBS': ['pthread'],
443 }, 442 },
444 'os:macos': { 443 'os:macos': {
(...skipping 13 matching lines...) Expand all
458 'LIBS': ['execinfo', 'pthread'] 457 'LIBS': ['execinfo', 'pthread']
459 }, 458 },
460 'os:win32': { 459 'os:win32': {
461 'LIBS': ['winmm', 'ws2_32'] 460 'LIBS': ['winmm', 'ws2_32']
462 }, 461 },
463 'os:android': { 462 'os:android': {
464 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', 463 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__',
465 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], 464 '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'],
466 'CCFLAGS': ANDROID_FLAGS, 465 'CCFLAGS': ANDROID_FLAGS,
467 'CPPPATH': ANDROID_INCLUDES, 466 'CPPPATH': ANDROID_INCLUDES,
468 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], 467 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib',
468 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4. 0/lib/gcc/arm-eabi/4.4.0/interwork'],
469 'LINKFLAGS': ANDROID_LINKFLAGS, 469 'LINKFLAGS': ANDROID_LINKFLAGS,
470 'LIBS': ['log', 'c', 'stdc++', 'm'], 470 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'],
471 'mode:release': { 471 'mode:release': {
472 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] 472 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
473 } 473 }
474 }, 474 },
475 'arch:ia32': { 475 'arch:ia32': {
476 'CCFLAGS': ['-m32'], 476 'CCFLAGS': ['-m32'],
477 'LINKFLAGS': ['-m32'] 477 'LINKFLAGS': ['-m32']
478 }, 478 },
479 'arch:x64': { 479 'arch:x64': {
480 'CCFLAGS': ['-m64'], 480 'CCFLAGS': ['-m64'],
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 'LIBS': ['pthread'], 583 'LIBS': ['pthread'],
584 }, 584 },
585 'os:solaris': { 585 'os:solaris': {
586 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], 586 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
587 'LINKFLAGS': ['-mt'] 587 'LINKFLAGS': ['-mt']
588 }, 588 },
589 'os:openbsd': { 589 'os:openbsd': {
590 'LIBS': ['pthread'], 590 'LIBS': ['pthread'],
591 }, 591 },
592 'os:android': { 592 'os:android': {
593 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], 593 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib',
594 ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.4. 0/lib/gcc/arm-eabi/4.4.0/interwork'],
594 'LINKFLAGS': ANDROID_LINKFLAGS, 595 'LINKFLAGS': ANDROID_LINKFLAGS,
595 'LIBS': ['log', 'c', 'stdc++', 'm'], 596 'LIBS': ['log', 'c', 'stdc++', 'm', 'gcc'],
596 }, 597 },
597 'os:win32': { 598 'os:win32': {
598 'LIBS': ['winmm', 'ws2_32'], 599 'LIBS': ['winmm', 'ws2_32'],
599 }, 600 },
600 }, 601 },
601 'msvc': { 602 'msvc': {
602 'all': { 603 'all': {
603 'LIBS': ['winmm', 'ws2_32'] 604 'LIBS': ['winmm', 'ws2_32']
604 } 605 }
605 } 606 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 982 }
982 983
983 # Generate library base name. 984 # Generate library base name.
984 target_id = mode 985 target_id = mode
985 suffix = SUFFIXES[target_id] 986 suffix = SUFFIXES[target_id]
986 library_name = 'v8' + suffix 987 library_name = 'v8' + suffix
987 version = GetVersion() 988 version = GetVersion()
988 if context.options['soname'] == 'on': 989 if context.options['soname'] == 'on':
989 # When building shared object with SONAME version the library name. 990 # When building shared object with SONAME version the library name.
990 library_name += '-' + version 991 library_name += '-' + version
991 env['LIBRARY'] = library_name
992 992
993 # Generate library SONAME if required by the build. 993 # Generate library SONAME if required by the build.
994 if context.options['soname'] == 'on': 994 if context.options['soname'] == 'on':
995 soname = GetSpecificSONAME() 995 soname = GetSpecificSONAME()
996 if soname == '': 996 if soname == '':
997 soname = 'lib' + library_name + '.so' 997 soname = 'lib' + library_name + '.so'
998 env['SONAME'] = soname 998 env['SONAME'] = soname
999 999
1000 # Build the object files by invoking SCons recursively. 1000 # Build the object files by invoking SCons recursively.
1001 (object_files, shell_files, mksnapshot) = env.SConscript( 1001 (object_files, shell_files, mksnapshot) = env.SConscript(
1002 join('src', 'SConscript'), 1002 join('src', 'SConscript'),
1003 build_dir=join('obj', target_id), 1003 build_dir=join('obj', target_id),
1004 exports='context', 1004 exports='context',
1005 duplicate=False 1005 duplicate=False
1006 ) 1006 )
1007 1007
1008 context.mksnapshot_targets.append(mksnapshot) 1008 context.mksnapshot_targets.append(mksnapshot)
1009 1009
1010 # Link the object files into a library. 1010 # Link the object files into a library.
1011 env.Replace(**context.flags['v8']) 1011 env.Replace(**context.flags['v8'])
1012 env.Prepend(LIBS=[library_name])
1012 1013
1013 context.ApplyEnvOverrides(env) 1014 context.ApplyEnvOverrides(env)
1014 if context.options['library'] == 'static': 1015 if context.options['library'] == 'static':
1015 library = env.StaticLibrary(library_name, object_files) 1016 library = env.StaticLibrary(library_name, object_files)
1016 else: 1017 else:
1017 # There seems to be a glitch in the way scons decides where to put 1018 # There seems to be a glitch in the way scons decides where to put
1018 # PDB files when compiling using MSVC so we specify it manually. 1019 # PDB files when compiling using MSVC so we specify it manually.
1019 # This should not affect any other platforms. 1020 # This should not affect any other platforms.
1020 pdb_name = library_name + '.dll.pdb' 1021 pdb_name = library_name + '.dll.pdb'
1021 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) 1022 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
1022 context.library_targets.append(library) 1023 context.library_targets.append(library)
1023 1024
1024 d8_env = Environment() 1025 d8_env = Environment()
1025 d8_env.Replace(**context.flags['d8']) 1026 d8_env.Replace(**context.flags['d8'])
1026 context.ApplyEnvOverrides(d8_env) 1027 context.ApplyEnvOverrides(d8_env)
1027 shell = d8_env.Program('d8' + suffix, object_files + shell_files) 1028 shell = d8_env.Program('d8' + suffix, object_files + shell_files)
1028 context.d8_targets.append(shell) 1029 context.d8_targets.append(shell)
1029 1030
1030 for sample in context.samples: 1031 for sample in context.samples:
1031 sample_env = Environment(LIBRARY=library_name) 1032 sample_env = Environment()
1032 sample_env.Replace(**context.flags['sample']) 1033 sample_env.Replace(**context.flags['sample'])
1034 sample_env.Prepend(LIBS=[library_name])
1033 context.ApplyEnvOverrides(sample_env) 1035 context.ApplyEnvOverrides(sample_env)
1034 sample_object = sample_env.SConscript( 1036 sample_object = sample_env.SConscript(
1035 join('samples', 'SConscript'), 1037 join('samples', 'SConscript'),
1036 build_dir=join('obj', 'sample', sample, target_id), 1038 build_dir=join('obj', 'sample', sample, target_id),
1037 exports='sample context', 1039 exports='sample context',
1038 duplicate=False 1040 duplicate=False
1039 ) 1041 )
1040 sample_name = sample + suffix 1042 sample_name = sample + suffix
1041 sample_program = sample_env.Program(sample_name, sample_object) 1043 sample_program = sample_env.Program(sample_name, sample_object)
1042 sample_env.Depends(sample_program, library) 1044 sample_env.Depends(sample_program, library)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 # version of scons. Also, there's a bug in some revisions that 1095 # version of scons. Also, there's a bug in some revisions that
1094 # doesn't allow this flag to be set, so we swallow any exceptions. 1096 # doesn't allow this flag to be set, so we swallow any exceptions.
1095 # Lovely. 1097 # Lovely.
1096 try: 1098 try:
1097 SetOption('warn', 'no-deprecated') 1099 SetOption('warn', 'no-deprecated')
1098 except: 1100 except:
1099 pass 1101 pass
1100 1102
1101 1103
1102 Build() 1104 Build()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698