OLD | NEW |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import shutil | 6 import shutil |
7 import sys | 7 import sys |
8 | 8 |
9 | 9 |
10 p = ARGUMENTS.get('PROGRESS') | 10 p = ARGUMENTS.get('PROGRESS') |
(...skipping 11 matching lines...) Expand all Loading... |
22 load = ARGUMENTS.get('LOAD') | 22 load = ARGUMENTS.get('LOAD') |
23 if load: | 23 if load: |
24 load = load.split(',') | 24 load = load.split(',') |
25 else: | 25 else: |
26 load = [] | 26 load = [] |
27 | 27 |
28 | 28 |
29 root_env = Environment( | 29 root_env = Environment( |
30 tools = ['component_setup'], | 30 tools = ['component_setup'], |
31 | 31 |
| 32 # Requested list of system (shared) libraries, from the comma separated |
| 33 # SYSTEM_LIBS command-line argument |
| 34 req_system_libs = [], |
| 35 # All supported system libraries, for the help message |
| 36 all_system_libs = [], |
| 37 |
32 CHROME_SRC_DIR = '$MAIN_DIR/..', | 38 CHROME_SRC_DIR = '$MAIN_DIR/..', |
33 DESTINATION_ROOT = '$MAIN_DIR/Hammer', | 39 DESTINATION_ROOT = '$MAIN_DIR/Hammer', |
34 TARGET_ROOT = '$DESTINATION_ROOT', | 40 TARGET_ROOT = '$DESTINATION_ROOT', |
35 | 41 |
36 # Where ComponentTestProgram() will build test executables. | 42 # Where ComponentTestProgram() will build test executables. |
37 TESTS_DIR = '$TARGET_ROOT', | 43 TESTS_DIR = '$TARGET_ROOT', |
38 | 44 |
39 # Where ComponentProgram() will build program executables. | 45 # Where ComponentProgram() will build program executables. |
40 STAGING_DIR = '$TARGET_ROOT', | 46 STAGING_DIR = '$TARGET_ROOT', |
41 | 47 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 94 |
89 PERL = 'perl', | 95 PERL = 'perl', |
90 PERL_INCLUDE_FLAG = '-I ', | 96 PERL_INCLUDE_FLAG = '-I ', |
91 PERL_INCLUDE_SUFFIX = '', | 97 PERL_INCLUDE_SUFFIX = '', |
92 _PERL_INCLUDE_FLAGS = ('${_concat(PERL_INCLUDE_FLAG, ' | 98 _PERL_INCLUDE_FLAGS = ('${_concat(PERL_INCLUDE_FLAG, ' |
93 'PERL_INCLUDE_PATH, ' | 99 'PERL_INCLUDE_PATH, ' |
94 'PERL_INCLUDE_SUFFIX,' | 100 'PERL_INCLUDE_SUFFIX,' |
95 '__env__, RDirs, TARGET, SOURCE)}'), | 101 '__env__, RDirs, TARGET, SOURCE)}'), |
96 ) | 102 ) |
97 | 103 |
| 104 root_env['req_system_libs'] = ARGUMENTS.get('SYSTEM_LIBS').split(',') |
| 105 |
| 106 def WantSystemLib(env, lib): |
| 107 """ |
| 108 Return true if lib has been requested as a system library in SYSTEM_LIBS. |
| 109 """ |
| 110 if lib not in env['all_system_libs']: |
| 111 env['all_system_libs'].append(lib) |
| 112 return (lib in env['req_system_libs']) |
| 113 root_env.AddMethod(WantSystemLib, "WantSystemLib") |
98 | 114 |
99 def ChromeProgram(env, *args, **kw): | 115 def ChromeProgram(env, *args, **kw): |
100 return env.ComponentProgram(*args, **kw) | 116 return env.ComponentProgram(*args, **kw) |
101 root_env.AddMethod(ChromeProgram) | 117 root_env.AddMethod(ChromeProgram) |
102 | 118 |
103 def ChromeTestProgram(env, *args, **kw): | 119 def ChromeTestProgram(env, *args, **kw): |
104 return env.ComponentTestProgram(*args, **kw) | 120 return env.ComponentTestProgram(*args, **kw) |
105 root_env.AddMethod(ChromeTestProgram) | 121 root_env.AddMethod(ChromeTestProgram) |
106 | 122 |
107 def ChromeStaticLibrary(env, *args, **kw): | 123 def ChromeStaticLibrary(env, *args, **kw): |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if LoadComponent('sdch'): | 217 if LoadComponent('sdch'): |
202 sconscripts.append('$SDCH_DIR/SConscript') | 218 sconscripts.append('$SDCH_DIR/SConscript') |
203 | 219 |
204 if LoadComponent('skia'): | 220 if LoadComponent('skia'): |
205 sconscripts.append('$SKIA_DIR/SConscript') | 221 sconscripts.append('$SKIA_DIR/SConscript') |
206 | 222 |
207 if LoadComponent('testing'): | 223 if LoadComponent('testing'): |
208 sconscripts.append('$TESTING_DIR/SConscript.gtest') | 224 sconscripts.append('$TESTING_DIR/SConscript.gtest') |
209 | 225 |
210 if LoadComponent('third_party'): | 226 if LoadComponent('third_party'): |
| 227 if not root_env.WantSystemLib('bzip2'): |
| 228 sconscripts.append('$BZIP2_DIR/bzip2.scons') |
| 229 root_env.Append(BZIP2_LIB = ['bzip2']) |
| 230 else: |
| 231 root_env.Append(BZIP2_LIB = ['bz2']) |
| 232 if not root_env.WantSystemLib('libpng'): |
| 233 sconscripts.append('$LIBPNG_DIR/libpng.scons') |
| 234 if not root_env.WantSystemLib('libjpeg'): |
| 235 sconscripts.append('$LIBJPEG_DIR/SConscript') |
| 236 if not root_env.WantSystemLib('libxml'): |
| 237 sconscripts.append('$LIBXML_DIR/SConscript') |
| 238 root_env.Append(XML_LIB = ['libxml']) |
| 239 else: |
| 240 root_env.Append(XML_LIB = ['xml2']) |
| 241 if not root_env.WantSystemLib('libxslt'): |
| 242 sconscripts.append('$LIBXSLT_DIR/SConscript') |
| 243 if not root_env.WantSystemLib('lzma_sdk'): |
| 244 sconscripts.append('$LZMA_SDK_DIR/SConscript') |
| 245 if not root_env.WantSystemLib('zlib'): |
| 246 sconscripts.append('$ZLIB_DIR/zlib.scons') |
| 247 root_env.Append(ZLIB_LIB = ['zlib']) |
| 248 else: |
| 249 root_env.Append(ZLIB_LIB = ['z']) |
211 sconscripts.extend([ | 250 sconscripts.extend([ |
212 '$BSDIFF_DIR/SConscript', | 251 '$BSDIFF_DIR/SConscript', |
213 '$BZIP2_DIR/bzip2.scons', | |
214 '$ICU38_DIR/icu38.scons', | 252 '$ICU38_DIR/icu38.scons', |
215 '$LIBPNG_DIR/libpng.scons', | |
216 '$LZMA_SDK_DIR/SConscript', | |
217 '$MODP_B64_DIR/modp_b64.scons', | 253 '$MODP_B64_DIR/modp_b64.scons', |
218 '$ZLIB_DIR/zlib.scons', | |
219 '$LIBJPEG_DIR/SConscript', | |
220 '$LIBXML_DIR/SConscript', | |
221 '$LIBXSLT_DIR/SConscript', | |
222 '$BSPATCH_DIR/SConscript', | 254 '$BSPATCH_DIR/SConscript', |
223 ]) | 255 ]) |
224 | 256 |
225 if LoadComponent('v8') and root_env.Dir('$CHROME_SRC_DIR/v8').exists(): | 257 if LoadComponent('v8') and root_env.Dir('$CHROME_SRC_DIR/v8').exists(): |
226 sconscripts.append('$OBJ_ROOT/build/SConscript.v8') | 258 sconscripts.append('$OBJ_ROOT/build/SConscript.v8') |
227 | 259 |
228 if LoadComponent('webkit'): | 260 if LoadComponent('webkit'): |
229 sconscripts.append('$WEBKIT_DIR/SConscript') | 261 sconscripts.append('$WEBKIT_DIR/SConscript') |
230 | 262 |
231 | 263 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 linux_env.ParseConfig('pkg-config --cflags --libs gtk+-2.0') | 542 linux_env.ParseConfig('pkg-config --cflags --libs gtk+-2.0') |
511 linux_env.ParseConfig('pkg-config --cflags --libs pangoft2') | 543 linux_env.ParseConfig('pkg-config --cflags --libs pangoft2') |
512 except OSError, e: | 544 except OSError, e: |
513 print ('\n' | 545 print ('\n' |
514 'Failed to find a package dependency. Please install all the\n' | 546 'Failed to find a package dependency. Please install all the\n' |
515 'packages listed at\n' | 547 'packages listed at\n' |
516 'http://code.google.com/p/chromium/wiki/LinuxBuildInstructions' | 548 'http://code.google.com/p/chromium/wiki/LinuxBuildInstructions' |
517 '#Software_Requirements') | 549 '#Software_Requirements') |
518 | 550 |
519 sys.exit(1) | 551 sys.exit(1) |
520 | 552 if root_env.WantSystemLib('libxml'): |
| 553 try: |
| 554 linux_env.ParseConfig('pkg-config --cflags --libs libxml-2.0') |
| 555 except OSError, e: |
| 556 print ('\n' |
| 557 'libxml requested in SYSTEM_LIBS but not found\n') |
| 558 sys.exit(1) |
| 559 if root_env.WantSystemLib('libxslt'): |
| 560 try: |
| 561 linux_env.ParseConfig('pkg-config --cflags --libs libxslt') |
| 562 except OSError, e: |
| 563 print ('\n' |
| 564 'libxslt requested in SYSTEM_LIBS but not found\n') |
| 565 sys.exit(1) |
521 | 566 |
522 # -------------------------------------------------------------------------- | 567 # -------------------------------------------------------------------------- |
523 # Mac specific | 568 # Mac specific |
524 | 569 |
525 mac_env = root_env.Clone() | 570 mac_env = root_env.Clone() |
526 environment_list.append(mac_env) | 571 environment_list.append(mac_env) |
527 mac_env.Tool('target_platform_mac') | 572 mac_env.Tool('target_platform_mac') |
528 mac_env.Tool('target_debug') | 573 mac_env.Tool('target_debug') |
529 mac_env.Replace( | 574 mac_env.Replace( |
530 BUILD_TYPE = 'debug-mac', | 575 BUILD_TYPE = 'debug-mac', |
(...skipping 20 matching lines...) Expand all Loading... |
551 '$CHROME_DIR/SConscript', | 596 '$CHROME_DIR/SConscript', |
552 '$GEARS_DIR/SConscript', | 597 '$GEARS_DIR/SConscript', |
553 '$GOOGLE_UPDATE_DIR/SConscript', | 598 '$GOOGLE_UPDATE_DIR/SConscript', |
554 '$RLZ_DIR/SConscript', | 599 '$RLZ_DIR/SConscript', |
555 '$SANDBOX_DIR/sandbox.scons', | 600 '$SANDBOX_DIR/sandbox.scons', |
556 'build/SConscript.v8', | 601 'build/SConscript.v8', |
557 '$WEBKIT_DIR/SConscript', | 602 '$WEBKIT_DIR/SConscript', |
558 ], | 603 ], |
559 ) | 604 ) |
560 | 605 |
561 mac_env.Append( | 606 if not root_env.WantSystemLib('libevent'): |
| 607 mac_env.Append( |
562 BUILD_SCONSCRIPTS = [ | 608 BUILD_SCONSCRIPTS = [ |
563 '$LIBEVENT_DIR/libevent.scons', | 609 '$LIBEVENT_DIR/libevent.scons', |
564 ], | 610 ], |
| 611 ) |
| 612 mac_env.Append( |
565 CFLAGS = [ | 613 CFLAGS = [ |
566 '-std=c99', | 614 '-std=c99', |
567 ], | 615 ], |
568 CXXFLAGS = [ | 616 CXXFLAGS = [ |
569 '-fvisibility-inlines-hidden', | 617 '-fvisibility-inlines-hidden', |
570 '${str(SOURCE).endswith(".mm") and "-fobjc-gc" or ""}', | 618 '${str(SOURCE).endswith(".mm") and "-fobjc-gc" or ""}', |
571 ], | 619 ], |
572 CCFLAGS = [ | 620 CCFLAGS = [ |
573 '-fmessage-length=0', | 621 '-fmessage-length=0', |
574 '-pipe', | 622 '-pipe', |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 ) | 679 ) |
632 | 680 |
633 | 681 |
634 help_fmt = """ | 682 help_fmt = """ |
635 Usage: hammer [SCONS_OPTIONS] [VARIABLES] [TARGET] ... | 683 Usage: hammer [SCONS_OPTIONS] [VARIABLES] [TARGET] ... |
636 | 684 |
637 Supported build variables: | 685 Supported build variables: |
638 LOAD=[module,...] Comma-separated list of components to load in the | 686 LOAD=[module,...] Comma-separated list of components to load in the |
639 dependency graph ('-' prefix excludes): | 687 dependency graph ('-' prefix excludes): |
640 %s | 688 %s |
| 689 SYSTEM_LIBS=[lib,...] Comma-separated list of system libraries to link |
| 690 dynamically (by default they are built in from |
| 691 included sources): |
| 692 %s |
641 PROGRESS=type Display a progress indicator: | 693 PROGRESS=type Display a progress indicator: |
642 name: print each evaluated target name | 694 name: print each evaluated target name |
643 spinner: print a spinner every 5 targets | 695 spinner: print a spinner every 5 targets |
644 VERBOSE=1 Display full command lines | 696 VERBOSE=1 Display full command lines |
645 """ | 697 """ |
646 | 698 |
647 if GetOption('help'): | 699 if GetOption('help'): |
648 import textwrap | 700 import textwrap |
649 tw = textwrap.TextWrapper( | 701 tw = textwrap.TextWrapper( |
650 width = 78, | 702 width = 78, |
651 initial_indent = ' '*32, | 703 initial_indent = ' '*32, |
652 subsequent_indent = ' '*32, | 704 subsequent_indent = ' '*32, |
653 ) | 705 ) |
654 components = tw.fill(', '.join(components)) | 706 components = tw.fill(', '.join(components)) |
| 707 all_system_libs = tw.fill(', '.join(env['all_system_libs'])) |
655 | 708 |
656 Help(help_fmt % components) | 709 Help(help_fmt % (components, all_system_libs)) |
657 | 710 |
658 | 711 |
659 Import('build_component') | 712 Import('build_component') |
660 Default(None) # Reset default target to empty. | 713 Default(None) # Reset default target to empty. |
661 Default(Alias(build_component)) # Set default target based on where built. | 714 Default(Alias(build_component)) # Set default target based on where built. |
662 | 715 |
663 # ------------------------------------------------------------------------- | 716 # ------------------------------------------------------------------------- |
664 | 717 |
665 # Invoke all the SConscripts in each of the environments that make sense on | 718 # Invoke all the SConscripts in each of the environments that make sense on |
666 # this host-platform. | 719 # this host-platform. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 'all_libraries', | 769 'all_libraries', |
717 'all_languages', | 770 'all_languages', |
718 'all_programs', | 771 'all_programs', |
719 'all_test_programs', | 772 'all_test_programs', |
720 ], projects = [p], | 773 ], projects = [p], |
721 COMPONENT_VS_PROJECT_SCRIPT_PATH=( | 774 COMPONENT_VS_PROJECT_SCRIPT_PATH=( |
722 'cd $$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR && hammer.bat'), | 775 'cd $$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR && hammer.bat'), |
723 ) | 776 ) |
724 | 777 |
725 # ------------------------------------------------------------------------- | 778 # ------------------------------------------------------------------------- |
OLD | NEW |