diff options
author | Kristian Monsen <kristianm@google.com> | 2011-07-26 12:15:06 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-07-26 20:41:55 +0100 |
commit | 3dff810fe0cc4962a5fa554318e9bf8bc45f5274 (patch) | |
tree | a9fffa9ab7d061ab00538c18beb77403547378d0 /build | |
parent | 67d814a5d5c8d7df4740db4d2d74d0a41f94bece (diff) | |
download | external_chromium-3dff810fe0cc4962a5fa554318e9bf8bc45f5274.zip external_chromium-3dff810fe0cc4962a5fa554318e9bf8bc45f5274.tar.gz external_chromium-3dff810fe0cc4962a5fa554318e9bf8bc45f5274.tar.bz2 |
Merge Chromium at 12.0.742.130: Initial merge by git
Fix for bug 5080607 Update external/chromium to latest revision
Change-Id: I5c98b0d2845fccca4cbcdcea506e8f1759ba5416
Diffstat (limited to 'build')
44 files changed, 5568 insertions, 0 deletions
diff --git a/build/README.chromium b/build/README.chromium new file mode 100644 index 0000000..012df35 --- /dev/null +++ b/build/README.chromium @@ -0,0 +1,15 @@ +List of property sheets to be included by projects: + common.vsprops + Not used anymore. No-op. Kept for compatibility with current projects. + + debug.vsprops + Enables debug settings. Must be included directly in Debug configuration. Includes internal\essential.vsprops. + + external_code.vsprops + Contains settings made to simplify usage of external (non-Google) code. It relaxes the warning levels. Should be included after debug.vsprops or release.vsprops to override their settings. + + output_dll_copy.rules + Run to enable automatic copy of DLL when they are as an input file in a vcproj project. + + release.vsprops + Enables release settings. Must be included directly in Release configuration. Includes internal\essential.vsprops. Also includes "internal\release_impl$(CHROME_BUILD_TYPE).vsprops". So the behavior is dependant on the CHROME_BUILD_TYPE environment variable. diff --git a/build/all.gyp b/build/all.gyp new file mode 100644 index 0000000..0ce4a4d --- /dev/null +++ b/build/all.gyp @@ -0,0 +1,562 @@ +# Copyright (c) 2010 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. + +{ + 'targets': [ + { + 'target_name': 'All', + 'type': 'none', + 'xcode_create_dependents_test_runner': 1, + 'dependencies': [ + '../app/app.gyp:*', + '../base/base.gyp:*', + '../chrome/browser/sync/tools/sync_tools.gyp:*', + '../chrome/chrome.gyp:*', + '../crypto/crypto.gyp:*', + '../ui/ui.gyp:*', + '../gpu/gpu.gyp:*', + '../gpu/demos/demos.gyp:*', + '../ipc/ipc.gyp:*', + '../jingle/jingle.gyp:*', + '../media/media.gyp:*', + '../net/net.gyp:*', + '../ppapi/ppapi.gyp:*', + '../printing/printing.gyp:*', + '../sdch/sdch.gyp:*', + '../skia/skia.gyp:*', + '../testing/gmock.gyp:*', + '../testing/gtest.gyp:*', + '../third_party/bzip2/bzip2.gyp:*', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:*', + '../third_party/cld/cld.gyp:*', + '../third_party/codesighs/codesighs.gyp:*', + '../third_party/ffmpeg/ffmpeg.gyp:*', + '../third_party/iccjpeg/iccjpeg.gyp:*', + '../third_party/icu/icu.gyp:*', + '../third_party/libpng/libpng.gyp:*', + '../third_party/libwebp/libwebp.gyp:*', + '../third_party/libxml/libxml.gyp:*', + '../third_party/libxslt/libxslt.gyp:*', + '../third_party/lzma_sdk/lzma_sdk.gyp:*', + '../third_party/mesa/mesa.gyp:*', + '../third_party/modp_b64/modp_b64.gyp:*', + '../third_party/npapi/npapi.gyp:*', + '../third_party/ots/ots.gyp:*', + '../third_party/qcms/qcms.gyp:*', + '../third_party/sqlite/sqlite.gyp:*', + '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:*', + '../third_party/zlib/zlib.gyp:*', + '../webkit/support/webkit_support.gyp:*', + '../webkit/webkit.gyp:*', + 'util/build_util.gyp:*', + 'temp_gyp/googleurl.gyp:*', + '<(libjpeg_gyp_path):*', + ], + 'conditions': [ + ['javascript_engine=="v8"', { + 'dependencies': [ + '../v8/tools/gyp/v8.gyp:*', + ], + }], + ['OS=="mac" or OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'dependencies': [ + '../third_party/yasm/yasm.gyp:*#host', + ], + }], + ['OS=="mac" or OS=="win"', { + 'dependencies': [ + '../third_party/nss/nss.gyp:*', + ], + }], + ['OS=="mac"', { + 'dependencies': [ + '../third_party/ocmock/ocmock.gyp:*', + ], + }], + ['OS=="linux"', { + 'dependencies': [ + '../breakpad/breakpad.gyp:*', + '../courgette/courgette.gyp:*', + '../sandbox/sandbox.gyp:*', + ], + 'conditions': [ + ['branding=="Chrome"', { + 'dependencies': [ + '../chrome/chrome.gyp:linux_packages_<(channel)', + ], + }], + ], + }], + ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'dependencies': [ + '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*', + '../tools/xdisplaycheck/xdisplaycheck.gyp:*', + ], + }], + ['OS=="win"', { + 'conditions': [ + ['win_use_allocator_shim==1', { + 'dependencies': [ + '../base/allocator/allocator.gyp:*', + ], + }], + ], + 'dependencies': [ + '../breakpad/breakpad.gyp:*', + '../chrome/app/locales/locales.gyp:*', + '../chrome_frame/chrome_frame.gyp:*', + '../cloud_print/virtual_driver/virtual_driver.gyp:*', + '../courgette/courgette.gyp:*', + '../rlz/rlz.gyp:*', + '../sandbox/sandbox.gyp:*', + '../third_party/angle/src/build_angle.gyp:*', + '../third_party/bsdiff/bsdiff.gyp:*', + '../third_party/bspatch/bspatch.gyp:*', + '../third_party/gles2_book/gles2_book.gyp:*', + '../tools/memory_watcher/memory_watcher.gyp:*', + ], + }, { + 'dependencies': [ + '../third_party/libevent/libevent.gyp:*', + ], + }], + ['toolkit_views==1', { + 'dependencies': [ + '../views/views.gyp:*', + ], + }], + ['remoting==1', { + 'dependencies': [ + '../remoting/remoting.gyp:*', + ], + }], + ['use_openssl!=1', { + 'dependencies': [ + '../net/third_party/nss/ssl.gyp:*', + ], + }], + ], + }, # target_name: All + { + 'target_name': 'chromium_builder_tests', + 'type': 'none', + 'dependencies': [ + '../app/app.gyp:app_unittests', + '../base/base.gyp:base_unittests', + '../chrome/chrome.gyp:browser_tests', + '../chrome/chrome.gyp:interactive_ui_tests', + '../chrome/chrome.gyp:nacl_ui_tests', + '../chrome/chrome.gyp:nacl_sandbox_tests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:sync_integration_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:ui_tests', + '../chrome/chrome.gyp:unit_tests', + '../crypto/crypto.gyp:crypto_unittests', + '../ui/ui.gyp:gfx_unittests', + '../gpu/gpu.gyp:gpu_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../net/net.gyp:net_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + 'conditions': [ + ['OS=="win"', { + 'dependencies': [ + '../chrome/chrome.gyp:installer_util_unittests', + '../chrome/chrome.gyp:mini_installer_test', + # mini_installer_tests depends on mini_installer. This should be + # defined in installer.gyp. + '../chrome/installer/mini_installer.gyp:mini_installer', + '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_perftests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_tests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests', + '../chrome_frame/chrome_frame.gyp:npchrome_frame', + '../courgette/courgette.gyp:courgette_unittests', + '../sandbox/sandbox.gyp:sbox_integration_tests', + '../sandbox/sandbox.gyp:sbox_unittests', + '../sandbox/sandbox.gyp:sbox_validation_tests', + '../views/views.gyp:views_unittests', + '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:copy_TestNetscapePlugIn', + # TODO(nsylvain) ui_tests.exe depends on test_shell_common. + # This should: + # 1) not be the case. OR. + # 2) be expressed in the ui tests dependencies. + '../webkit/webkit.gyp:test_shell_common', + ], + }], + ], + }, # target_name: chromium_builder_tests + { + 'target_name': 'chromium_2010_builder_tests', + 'type': 'none', + 'dependencies': [ + '../chrome/chrome.gyp:chrome', + '../app/app.gyp:app_unittests', + '../base/base.gyp:base_unittests', + '../chrome/chrome.gyp:browser_tests', + '../chrome/chrome.gyp:interactive_ui_tests', + # TODO(bradnelson): fix and enable. + #'../chrome/chrome.gyp:nacl_ui_tests', + #'../chrome/chrome.gyp:nacl_sandbox_tests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:sync_integration_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:ui_tests', + '../chrome/chrome.gyp:unit_tests', + '../crypto/crypto.gyp:crypto_unittests', + '../ui/ui.gyp:gfx_unittests', + '../gpu/gpu.gyp:gpu_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../net/net.gyp:net_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + 'conditions': [ + ['OS=="win"', { + 'dependencies': [ + '../chrome/chrome.gyp:installer_util_unittests', + # TODO(bradnelson): fix and enable. + #'../chrome/chrome.gyp:mini_installer_test', + # mini_installer_tests depends on mini_installer. This should be + # defined in installer.gyp. + #'../chrome/installer/mini_installer.gyp:mini_installer', + #'../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests', + #'../chrome_frame/chrome_frame.gyp:chrome_frame_perftests', + #'../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests', + #'../chrome_frame/chrome_frame.gyp:chrome_frame_tests', + #'../chrome_frame/chrome_frame.gyp:chrome_frame_unittests', + #'../chrome_frame/chrome_frame.gyp:npchrome_frame', + '../courgette/courgette.gyp:courgette_unittests', + '../sandbox/sandbox.gyp:sbox_integration_tests', + '../sandbox/sandbox.gyp:sbox_unittests', + '../sandbox/sandbox.gyp:sbox_validation_tests', + '../views/views.gyp:views_unittests', + '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:copy_TestNetscapePlugIn', + # TODO(nsylvain) ui_tests.exe depends on test_shell_common. + # This should: + # 1) not be the case. OR. + # 2) be expressed in the ui tests dependencies. + '../webkit/webkit.gyp:test_shell_common', + ], + }], + ], + }, # target_name: chromium_2010_builder_tests + { + 'target_name': 'chromium_builder_perf', + 'type': 'none', + 'dependencies': [ + '../chrome/chrome.gyp:memory_test', + '../chrome/chrome.gyp:page_cycler_tests', + '../chrome/chrome.gyp:plugin_tests', + '../chrome/chrome.gyp:startup_tests', + '../chrome/chrome.gyp:tab_switching_test', + '../chrome/chrome.gyp:ui_tests', # needed for dromaeo, sunspider, v8 + '../chrome/chrome.gyp:url_fetch_test', + ], + }, # target_name: chromium_builder_perf + { + 'target_name': 'chromium_gpu_builder', + 'type': 'none', + 'dependencies': [ + '../chrome/chrome.gyp:gpu_tests', + '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:DumpRenderTree', + ], + }, # target_name: chromium_gpu_builder + { + 'target_name': 'chromium_builder_qa', + 'type': 'none', + 'dependencies': [ + '../chrome/chrome.gyp:chromedriver', + ], + 'conditions': [ + ['OS=="mac" or OS=="win" or (OS=="linux" and target_arch==python_arch)', { + 'dependencies': [ + '../chrome/chrome.gyp:pyautolib', + ], + }], # 'OS=="mac" or OS=="win" or (OS=="linux" and target_arch==python_arch)' + ], + }, # target_name: chromium_builder_qa + ], + 'conditions': [ + ['OS=="mac"', { + 'targets': [ + { + # Target to build everything plus the dmg. We don't put the dmg + # in the All target because developers really don't need it. + 'target_name': 'all_and_dmg', + 'type': 'none', + 'dependencies': [ + 'All', + '../chrome/chrome.gyp:build_app_dmg', + ], + }, + # These targets are here so the build bots can use them to build + # subsets of a full tree for faster cycle times. + { + 'target_name': 'chromium_builder_dbg', + 'type': 'none', + 'dependencies': [ + '../app/app.gyp:app_unittests', + '../chrome/chrome.gyp:browser_tests', + '../chrome/chrome.gyp:interactive_ui_tests', + '../chrome/chrome.gyp:nacl_ui_tests', + '../chrome/chrome.gyp:nacl_sandbox_tests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:sync_integration_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:ui_tests', + '../chrome/chrome.gyp:unit_tests', + '../ui/ui.gyp:gfx_unittests', + '../gpu/gpu.gyp:gpu_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + }, + { + 'target_name': 'chromium_builder_rel', + 'type': 'none', + 'dependencies': [ + '../app/app.gyp:app_unittests', + '../chrome/chrome.gyp:browser_tests', + '../chrome/chrome.gyp:memory_test', + '../chrome/chrome.gyp:nacl_ui_tests', + '../chrome/chrome.gyp:nacl_sandbox_tests', + '../chrome/chrome.gyp:page_cycler_tests', + '../chrome/chrome.gyp:plugin_tests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:startup_tests', + '../chrome/chrome.gyp:sync_integration_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:tab_switching_test', + '../chrome/chrome.gyp:ui_tests', + '../chrome/chrome.gyp:unit_tests', + '../chrome/chrome.gyp:url_fetch_test', + '../ui/ui.gyp:gfx_unittests', + '../gpu/gpu.gyp:gpu_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + }, + { + 'target_name': 'chromium_builder_dbg_tsan_mac', + 'type': 'none', + 'dependencies': [ + '../base/base.gyp:base_unittests', + '../crypto/crypto.gyp:crypto_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + '../net/net.gyp:net_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + ], + }, + { + 'target_name': 'chromium_builder_dbg_valgrind_mac', + 'type': 'none', + 'dependencies': [ + '../app/app.gyp:app_unittests', + '../base/base.gyp:base_unittests', + '../crypto/crypto.gyp:crypto_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../media/media.gyp:media_unittests', + '../net/net.gyp:net_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:unit_tests', + '../chrome/chrome.gyp:ui_tests', + '../ui/ui.gyp:gfx_unittests', + '../jingle/jingle.gyp:jingle_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + ], + }, + ], # targets + }], # OS="mac" + ['OS=="win"', { + 'targets': [ + # These targets are here so the build bots can use them to build + # subsets of a full tree for faster cycle times. + { + 'target_name': 'chromium_builder', + 'type': 'none', + 'dependencies': [ + '../app/app.gyp:app_unittests', + '../chrome/chrome.gyp:browser_tests', + '../chrome/chrome.gyp:installer_util_unittests', + '../chrome/chrome.gyp:interactive_ui_tests', + '../chrome/chrome.gyp:memory_test', + '../chrome/chrome.gyp:mini_installer_test', + '../chrome/chrome.gyp:nacl_ui_tests', + '../chrome/chrome.gyp:nacl_sandbox_tests', + '../chrome/chrome.gyp:page_cycler_tests', + '../chrome/chrome.gyp:plugin_tests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:selenium_tests', + '../chrome/chrome.gyp:startup_tests', + '../chrome/chrome.gyp:sync_integration_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:tab_switching_test', + '../chrome/chrome.gyp:ui_tests', + '../chrome/chrome.gyp:unit_tests', + '../chrome/chrome.gyp:url_fetch_test', + # mini_installer_tests depends on mini_installer. This should be + # defined in installer.gyp. + '../chrome/installer/mini_installer.gyp:mini_installer', + '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_perftests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_tests', + '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests', + '../chrome_frame/chrome_frame.gyp:npchrome_frame', + '../courgette/courgette.gyp:courgette_unittests', + '../ui/ui.gyp:gfx_unittests', + '../gpu/gpu.gyp:gpu_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:copy_TestNetscapePlugIn', + '../views/views.gyp:views_unittests', + # TODO(nsylvain) ui_tests.exe depends on test_shell_common. + # This should: + # 1) not be the case. OR. + # 2) be expressed in the ui tests dependencies. + '../webkit/webkit.gyp:test_shell_common', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + }, + { + 'target_name': 'chromium_builder_dbg_tsan_win', + 'type': 'none', + 'dependencies': [ + '../app/app.gyp:app_unittests', + # TODO(bradnelson): app_unittests should depend on locales. + # However, we can't add dependencies on chrome/ to app/ + # See http://crbug.com/43603 + '../base/base.gyp:base_unittests', + '../chrome/app/locales/locales.gyp:*', + '../chrome/chrome.gyp:sync_unit_tests', + '../crypto/crypto.gyp:crypto_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:media_unittests', + '../net/net.gyp:net_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + }, + ], # targets + 'conditions': [ + ['branding=="Chrome"', { + 'targets': [ + { + 'target_name': 'chrome_official_builder', + 'type': 'none', + 'dependencies': [ + '../chrome/app/locales/locales.gyp:*', + '../chrome/chrome.gyp:chromedriver', + '../chrome/chrome.gyp:crash_service', + '../chrome/chrome.gyp:policy_templates', + '../chrome/chrome.gyp:pyautolib', + '../chrome/chrome.gyp:reliability_tests', + '../chrome/chrome.gyp:automated_ui_tests', + '../chrome/installer/mini_installer.gyp:mini_installer', + '../chrome_frame/chrome_frame.gyp:npchrome_frame', + '../courgette/courgette.gyp:courgette', + '../courgette/courgette.gyp:courgette64', + '../third_party/adobe/flash/flash_player.gyp:flash_player', + ], + 'conditions': [ + ['internal_pdf', { + 'dependencies': [ + '../pdf/pdf.gyp:pdf', + ], + }], # internal_pdf + ] + }, + ], # targets + }], # branding=="Chrome" + ], # conditions + }], # OS="win" + ['chromeos==1', { + 'targets': [ + { + 'target_name': 'chromeos_builder', + 'type': 'none', + 'sources': [ + # TODO(bradnelson): This is here to work around gyp issue 137. + # Remove this sources list when that issue has been fixed. + 'all.gyp', + ], + 'dependencies': [ + '../app/app.gyp:app_unittests', + '../base/base.gyp:base_unittests', + '../chrome/chrome.gyp:browser_tests', + '../chrome/chrome.gyp:chrome', + '../chrome/chrome.gyp:interactive_ui_tests', + '../chrome/chrome.gyp:memory_test', + '../chrome/chrome.gyp:page_cycler_tests', + '../chrome/chrome.gyp:safe_browsing_tests', + '../chrome/chrome.gyp:startup_tests', + '../chrome/chrome.gyp:sync_unit_tests', + '../chrome/chrome.gyp:sync_integration_tests', + '../chrome/chrome.gyp:tab_switching_test', + '../chrome/chrome.gyp:ui_tests', + '../chrome/chrome.gyp:unit_tests', + '../chrome/chrome.gyp:url_fetch_test', + '../crypto/crypto.gyp:crypto_unittests', + '../ui/ui.gyp:gfx_unittests', + '../ipc/ipc.gyp:ipc_tests', + '../jingle/jingle.gyp:jingle_unittests', + '../media/media.gyp:ffmpeg_tests', + '../media/media.gyp:media_unittests', + '../media/media.gyp:omx_test', + '../net/net.gyp:net_unittests', + '../printing/printing.gyp:printing_unittests', + '../remoting/remoting.gyp:remoting_unittests', + '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', + '../views/views.gyp:views_unittests', + 'temp_gyp/googleurl.gyp:googleurl_unittests', + ], + }, + ], # targets + }], # "chromeos==1" + ], # conditions +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/apply_locales.py b/build/apply_locales.py new file mode 100755 index 0000000..6af7280 --- /dev/null +++ b/build/apply_locales.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# Copyright (c) 2009 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. + +# TODO: remove this script when GYP has for loops + +import sys +import optparse + +def main(argv): + + parser = optparse.OptionParser() + usage = 'usage: %s [options ...] format_string locale_list' + parser.set_usage(usage.replace('%s', '%prog')) + parser.add_option('-d', dest='dash_to_underscore', action="store_true", + default=False, + help='map "en-US" to "en" and "-" to "_" in locales') + + (options, arglist) = parser.parse_args(argv) + + if len(arglist) < 3: + print 'ERROR: need string and list of locales' + return 1 + + str_template = arglist[1] + locales = arglist[2:] + + results = [] + for locale in locales: + # For Cocoa to find the locale at runtime, it needs to use '_' instead + # of '-' (http://crbug.com/20441). Also, 'en-US' should be represented + # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). + if options.dash_to_underscore: + if locale == 'en-US': + locale = 'en' + locale = locale.replace('-', '_') + results.append(str_template.replace('ZZLOCALE', locale)) + + # Quote each element so filename spaces don't mess up GYP's attempt to parse + # it into a list. + print ' '.join(["'%s'" % x for x in results]) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/build/branding_value.sh b/build/branding_value.sh new file mode 100755 index 0000000..9fcb550 --- /dev/null +++ b/build/branding_value.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# Copyright (c) 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. + +# This is a wrapper for fetching values from the BRANDING files. Pass the +# value of GYP's branding variable followed by the key you want and the right +# file is checked. +# +# branding_value.sh Chromium COPYRIGHT +# branding_value.sh Chromium PRODUCT_FULLNAME +# + +set -e + +if [ $# -ne 2 ] ; then + echo "error: expect two arguments, branding and key" >&2 + exit 1 +fi + +BUILD_BRANDING=$1 +THE_KEY=$2 + +pushd $(dirname "${0}") > /dev/null +BUILD_DIR=$(pwd) +popd > /dev/null + +TOP="${BUILD_DIR}/.." + +case ${BUILD_BRANDING} in + Chromium) + BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING" + ;; + Chrome) + BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING" + ;; + *) + echo "error: unknown branding: ${BUILD_BRANDING}" >&2 + exit 1 + ;; +esac + +BRANDING_VALUE=$(sed -n -e "s/^${THE_KEY}=\(.*\)\$/\1/p" "${BRANDING_FILE}") + +if [ -z "${BRANDING_VALUE}" ] ; then + echo "error: failed to find key '${THE_KEY}'" >&2 + exit 1 +fi + +echo "${BRANDING_VALUE}" diff --git a/build/build_config.h b/build/build_config.h index df16071..fab9da0 100644 --- a/build/build_config.h +++ b/build/build_config.h @@ -49,6 +49,7 @@ #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \ defined(OS_SOLARIS) +<<<<<<< HEAD #if defined(ANDROID) #define USE_OPENSSL 1 @@ -64,6 +65,12 @@ #else #undef USE_X11 #endif +======= +#if !defined(USE_OPENSSL) +#define USE_NSS 1 // Default to use NSS for crypto, unless OpenSSL is chosen. +#endif +#define USE_X11 1 // Use X for graphics. +>>>>>>> chromium.org at 12.0.742.130 #endif #if defined(USE_OPENSSL) && defined(USE_NSS) @@ -73,8 +80,12 @@ // For access to standard POSIXish features, use OS_POSIX instead of a // more specific macro. #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \ +<<<<<<< HEAD defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_NACL) || \ defined(ANDROID) +======= + defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_NACL) +>>>>>>> chromium.org at 12.0.742.130 #define OS_POSIX 1 // Use base::DataPack for name/value pairs. #define USE_BASE_DATA_PACK 1 diff --git a/build/common.croc b/build/common.croc new file mode 100644 index 0000000..90b9cb9 --- /dev/null +++ b/build/common.croc @@ -0,0 +1,127 @@ +# -*- python -*- +# Crocodile config file for Chromium - settings common to all platforms +# +# This should be speicified before the platform-specific config, for example: +# croc -c chrome_common.croc -c linux/chrome_linux.croc + +{ + # List of root directories, applied in order + 'roots' : [ + # Sub-paths we specifically care about and want to call out + { + 'root' : '_/src', + 'altname' : 'CHROMIUM', + }, + ], + + # List of rules, applied in order + # Note that any 'include':0 rules here will be overridden by the 'include':1 + # rules in the platform-specific configs. + 'rules' : [ + # Don't scan for executable lines in uninstrumented C++ header files + { + 'regexp' : '.*\\.(h|hpp)$', + 'add_if_missing' : 0, + }, + + # Groups + { + 'regexp' : '', + 'group' : 'source', + }, + { + 'regexp' : '.*_(test|unittest)\\.', + 'group' : 'test', + }, + + # Languages + { + 'regexp' : '.*\\.(c|h)$', + 'language' : 'C', + }, + { + 'regexp' : '.*\\.(cc|cpp|hpp)$', + 'language' : 'C++', + }, + + # Files/paths to include. Specify these before the excludes, since rules + # are in order. + { + 'regexp' : '^CHROMIUM/(base|media|net|printing|remoting|chrome|webkit/glue|native_client)/', + 'include' : 1, + }, + # Don't include subversion or mercurial SCM dirs + { + 'regexp' : '.*/(\\.svn|\\.hg)/', + 'include' : 0, + }, + # Don't include output dirs + { + 'regexp' : '.*/(Debug|Release|sconsbuild|out|xcodebuild)/', + 'include' : 0, + }, + # Don't include third-party source + { + 'regexp' : '.*/third_party/', + 'include' : 0, + }, + # We don't run the V8 test suite, so we don't care about V8 coverage. + { + 'regexp' : '.*/v8/', + 'include' : 0, + }, + ], + + # Paths to add source from + 'add_files' : [ + 'CHROMIUM' + ], + + # Statistics to print + 'print_stats' : [ + { + 'stat' : 'files_executable', + 'format' : '*RESULT FilesKnown: files_executable= %d files', + }, + { + 'stat' : 'files_instrumented', + 'format' : '*RESULT FilesInstrumented: files_instrumented= %d files', + }, + { + 'stat' : '100.0 * files_instrumented / files_executable', + 'format' : '*RESULT FilesInstrumentedPercent: files_instrumented_percent= %g', + }, + { + 'stat' : 'lines_executable', + 'format' : '*RESULT LinesKnown: lines_known= %d lines', + }, + { + 'stat' : 'lines_instrumented', + 'format' : '*RESULT LinesInstrumented: lines_instrumented= %d lines', + }, + { + 'stat' : 'lines_covered', + 'format' : '*RESULT LinesCoveredSource: lines_covered_source= %d lines', + 'group' : 'source', + }, + { + 'stat' : 'lines_covered', + 'format' : '*RESULT LinesCoveredTest: lines_covered_test= %d lines', + 'group' : 'test', + }, + { + 'stat' : '100.0 * lines_covered / lines_executable', + 'format' : '*RESULT PercentCovered: percent_covered= %g', + }, + { + 'stat' : '100.0 * lines_covered / lines_executable', + 'format' : '*RESULT PercentCoveredSource: percent_covered_source= %g', + 'group' : 'source', + }, + { + 'stat' : '100.0 * lines_covered / lines_executable', + 'format' : '*RESULT PercentCoveredTest: percent_covered_test= %g', + 'group' : 'test', + }, + ], +} diff --git a/build/common.gypi b/build/common.gypi new file mode 100644 index 0000000..6333160 --- /dev/null +++ b/build/common.gypi @@ -0,0 +1,1691 @@ +# Copyright (c) 2010 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. + +# IMPORTANT: +# Please don't directly include this file if you are building via gyp_chromium, +# since gyp_chromium is automatically forcing its inclusion. +{ + # Variables expected to be overriden on the GYP command line (-D) or by + # ~/.gyp/include.gypi. + 'variables': { + # Putting a variables dict inside another variables dict looks kind of + # weird. This is done so that 'host_arch', 'chromeos', etc are defined as + # variables within the outer variables dict here. This is necessary + # to get these variables defined for the conditions within this variables + # dict that operate on these variables (e.g., for setting 'toolkit_views', + # we need to have 'chromeos' already set). + 'variables': { + 'variables': { + 'variables': { + # Whether we're building a ChromeOS build. + 'chromeos%': 0, + + # Disable touch support by default. + 'touchui%': 0, + }, + # Copy conditionally-set variables out one scope. + 'chromeos%': '<(chromeos)', + 'touchui%': '<(touchui)', + + # To do a shared build on linux we need to be able to choose between + # type static_library and shared_library. We default to doing a static + # build but you can override this with "gyp -Dlibrary=shared_library" + # or you can add the following line (without the #) to + # ~/.gyp/include.gypi {'variables': {'library': 'shared_library'}} + # to compile as shared by default + 'library%': 'static_library', + + # Compute the architecture that we're building on. + 'conditions': [ + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + # This handles the Linux platforms we generally deal with. Anything + # else gets passed through, which probably won't work very well; such + # hosts should pass an explicit target_arch to gyp. + 'host_arch%': + '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")', + }, { # OS!="linux" + 'host_arch%': 'ia32', + }], + + # Set default value of toolkit_views on for Windows, Chrome OS + # and the touch UI. + ['OS=="win" or chromeos==1 or touchui==1', { + 'toolkit_views%': 1, + }, { + 'toolkit_views%': 0, + }], + ], + }, + + # Copy conditionally-set variables out one scope. + 'chromeos%': '<(chromeos)', + 'touchui%': '<(touchui)', + 'host_arch%': '<(host_arch)', + 'library%': '<(library)', + 'toolkit_views%': '<(toolkit_views)', + + # Override branding to select the desired branding flavor. + 'branding%': 'Chromium', + + # Override buildtype to select the desired build flavor. + # Dev - everyday build for development/testing + # Official - release build (generally implies additional processing) + # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp + # conversion is done), some of the things which are now controlled by + # 'branding', such as symbol generation, will need to be refactored based + # on 'buildtype' (i.e. we don't care about saving symbols for non-Official + # builds). + 'buildtype%': 'Dev', + + # Default architecture we're building for is the architecture we're + # building on. + 'target_arch%': '<(host_arch)', + + # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are + # are built under a chromium full build (1) or a webkit.org chromium + # build (0). + 'inside_chromium_build%': 1, + + # Set to 1 to enable fast builds. It disables debug info for fastest + # compilation. + 'fastbuild%': 0, + + # Disable file manager component extension by default. + 'file_manager_extension%': 0, + + # Python version. + 'python_ver%': '2.5', + + # Set ARM-v7 compilation flags + 'armv7%': 0, + + # Set Neon compilation flags (only meaningful if armv7==1). + 'arm_neon%': 1, + + # The system root for cross-compiles. Default: none. + 'sysroot%': '', + + # On Linux, we build with sse2 for Chromium builds. + 'disable_sse2%': 0, + + # Use libjpeg-turbo as the JPEG codec used by Chromium. + 'use_libjpeg_turbo%': 1, + + # Variable 'component' is for cases where we would like to build some + # components as dynamic shared libraries but still need variable + # 'library' for static libraries. + # By default, component is set to whatever library is set to and + # it can be overriden by the GYP command line or by ~/.gyp/include.gypi. + 'component%': '<(library)', + + # Set to select the Title Case versions of strings in GRD files. + 'use_titlecase_in_grd_files%': 0, + + # Use translations provided by volunteers at launchpad.net. This + # currently only works on Linux. + 'use_third_party_translations%': 0, + + # Remoting compilation is enabled by default. Set to 0 to disable. + 'remoting%': 1, + + # If this is set, the clang plugins used on the buildbot will be used. + # Run tools/clang/scripts/update.sh to make sure they are compiled. + # This causes 'clang_chrome_plugins_flags' to be set. + # Has no effect if 'clang' is not set as well. + 'clang_use_chrome_plugins%': 0, + + 'conditions': [ + # A flag to enable or disable our compile-time dependency + # on gnome-keyring. If that dependency is disabled, no gnome-keyring + # support will be available. This option is useful + # for Linux distributions. + ['chromeos==1', { + 'use_gnome_keyring%': 0, + }, { + 'use_gnome_keyring%': 1, + }], + + # Set to 1 compile with -fPIC cflag on linux. This is a must for shared + # libraries on linux x86-64 and arm. + ['host_arch=="ia32"', { + 'linux_fpic%': 0, + }, { + 'linux_fpic%': 1, + }], + + ['toolkit_views==0 or OS=="mac"', { + # GTK+ and Mac wants Title Case strings + 'use_titlecase_in_grd_files%': 1, + }], + + # Enable some hacks to support Flapper only on Chrome OS. + ['chromeos==1', { + 'enable_flapper_hacks%': 1, + }, { + 'enable_flapper_hacks%': 0, + }], + + # Enable file manager extension by default on Chrome OS. + ['chromeos==1', { + 'file_manager_extension%': 1, + }, { + 'file_manager_extension%': 0, + }], + ], + }, + + # Copy conditionally-set variables out one scope. + 'branding%': '<(branding)', + 'buildtype%': '<(buildtype)', + 'target_arch%': '<(target_arch)', + 'host_arch%': '<(host_arch)', + 'toolkit_views%': '<(toolkit_views)', + 'use_gnome_keyring%': '<(use_gnome_keyring)', + 'linux_fpic%': '<(linux_fpic)', + 'enable_flapper_hacks%': '<(enable_flapper_hacks)', + 'chromeos%': '<(chromeos)', + 'touchui%': '<(touchui)', + 'file_manager_extension%': '<(file_manager_extension)', + 'inside_chromium_build%': '<(inside_chromium_build)', + 'fastbuild%': '<(fastbuild)', + 'python_ver%': '<(python_ver)', + 'armv7%': '<(armv7)', + 'arm_neon%': '<(arm_neon)', + 'sysroot%': '<(sysroot)', + 'disable_sse2%': '<(disable_sse2)', + 'library%': '<(library)', + 'component%': '<(component)', + 'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)', + 'use_third_party_translations%': '<(use_third_party_translations)', + 'remoting%': '<(remoting)', + 'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)', + + # The release channel that this build targets. This is used to restrict + # channel-specific build options, like which installer packages to create. + # The default is 'all', which does no channel-specific filtering. + 'channel%': 'all', + + # Override chromium_mac_pch and set it to 0 to suppress the use of + # precompiled headers on the Mac. Prefix header injection may still be + # used, but prefix headers will not be precompiled. This is useful when + # using distcc to distribute a build to compile slaves that don't + # share the same compiler executable as the system driving the compilation, + # because precompiled headers rely on pointers into a specific compiler + # executable's image. Setting this to 0 is needed to use an experimental + # Linux-Mac cross compiler distcc farm. + 'chromium_mac_pch%': 1, + + # Mac OS X SDK and deployment target support. + # The SDK identifies the version of the system headers that will be used, + # and corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time macro. + # "Maximum allowed" refers to the operating system version whose APIs are + # available in the headers. + # The deployment target identifies the minimum system version that the + # built products are expected to function on. It corresponds to the + # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro. + # To ensure these macros are available, #include <AvailabilityMacros.h>. + # Additional documentation on these macros is available at + # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3 + # Chrome normally builds with the Mac OS X 10.5 SDK and sets the + # deployment target to 10.5. Other projects, such as O3D, may override + # these defaults. + 'mac_sdk%': '10.5', + 'mac_deployment_target%': '10.5', + + # Set to 1 to enable code coverage. In addition to build changes + # (e.g. extra CFLAGS), also creates a new target in the src/chrome + # project file called "coverage". + # Currently ignored on Windows. + 'coverage%': 0, + + # Overridable specification for potential use of alternative + # JavaScript engines. + 'javascript_engine%': 'v8', + + # Although base/allocator lets you select a heap library via an + # environment variable, the libcmt shim it uses sometimes gets in + # the way. To disable it entirely, and switch to normal msvcrt, do e.g. + # 'win_use_allocator_shim': 0, + # 'win_release_RuntimeLibrary': 2 + # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build. + 'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt + + # Whether usage of OpenMAX is enabled. + 'enable_openmax%': 0, + + # Whether proprietary audio/video codecs are assumed to be included with + # this build (only meaningful if branding!=Chrome). + 'proprietary_codecs%': 0, + + # TODO(bradnelson): eliminate this when possible. + # To allow local gyp files to prevent release.vsprops from being included. + # Yes(1) means include release.vsprops. + # Once all vsprops settings are migrated into gyp, this can go away. + 'msvs_use_common_release%': 1, + + # TODO(bradnelson): eliminate this when possible. + # To allow local gyp files to override additional linker options for msvs. + # Yes(1) means set use the common linker options. + 'msvs_use_common_linker_extras%': 1, + + # TODO(sgk): eliminate this if possible. + # It would be nicer to support this via a setting in 'target_defaults' + # in chrome/app/locales/locales.gypi overriding the setting in the + # 'Debug' configuration in the 'target_defaults' dict below, + # but that doesn't work as we'd like. + 'msvs_debug_link_incremental%': '2', + + # Needed for some of the largest modules. + 'msvs_debug_link_nonincremental%': '1', + + # This is the location of the sandbox binary. Chrome looks for this before + # running the zygote process. If found, and SUID, it will be used to + # sandbox the zygote process and, thus, all renderer processes. + 'linux_sandbox_path%': '', + + # Set this to true to enable SELinux support. + 'selinux%': 0, + + # Set this to true when building with Clang. + # See http://code.google.com/p/chromium/wiki/Clang for details. + # TODO: eventually clang should behave identically to gcc, and this + # won't be necessary. + 'clang%': 0, + + # These two variables can be set in GYP_DEFINES while running + # |gclient runhooks| to let clang run a plugin in every compilation. + # Only has an effect if 'clang=1' is in GYP_DEFINES as well. + # Example: + # GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_add_plugin=print-fns' gclient runhooks + + 'clang_load%': '', + 'clang_add_plugin%': '', + + # Enable sampling based profiler. + # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html + 'profiling%': '0', + + # Override whether we should use Breakpad on Linux. I.e. for Chrome bot. + 'linux_breakpad%': 0, + # And if we want to dump symbols for Breakpad-enabled builds. + 'linux_dump_symbols%': 0, + # And if we want to strip the binary after dumping symbols. + 'linux_strip_binary%': 0, + # Strip the test binaries needed for Linux reliability tests. + 'linux_strip_reliability_tests%': 0, + + # Enable TCMalloc. + 'linux_use_tcmalloc%': 1, + + # Disable TCMalloc's debugallocation. + 'linux_use_debugallocation%': 0, + + # Disable TCMalloc's heapchecker. + 'linux_use_heapchecker%': 0, + + # Disable shadow stack keeping used by heapcheck to unwind the stacks + # better. + 'linux_keep_shadow_stacks%': 0, + + # Set to 1 to turn on seccomp sandbox by default. + # (Note: this is ignored for official builds.) + 'linux_use_seccomp_sandbox%': 0, + + # Set to 1 to link against libgnome-keyring instead of using dlopen(). + 'linux_link_gnome_keyring%': 0, + + # Used to disable Native Client at compile time, for platforms where it + # isn't supported + 'disable_nacl%': 0, + + # Set Thumb compilation flags. + 'arm_thumb%': 0, + + # Set ARM fpu compilation flags (only meaningful if armv7==1 and + # arm_neon==0). + 'arm_fpu%': 'vfpv3', + + # Enable new NPDevice API. + 'enable_new_npdevice_api%': 0, + + # Enable EGLImage support in OpenMAX + 'enable_eglimage%': 1, + + # Enable a variable used elsewhere throughout the GYP files to determine + # whether to compile in the sources for the GPU plugin / process. + 'enable_gpu%': 1, + + # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803 + 'use_openssl%': 0, + + # .gyp files or targets should set chromium_code to 1 if they build + # Chromium-specific code, as opposed to external code. This variable is + # used to control such things as the set of warnings to enable, and + # whether warnings are treated as errors. + 'chromium_code%': 0, + + # Set to 1 to compile with the built in pdf viewer. + 'internal_pdf%': 0, + + # This allows to use libcros from the current system, ie. /usr/lib/ + # The cros_api will be pulled in as a static library, and all headers + # from the system include dirs. + 'system_libcros%': 0, + + # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_' + # so Cocoa is happy (http://crbug.com/20441). + 'locales': [ + 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', + 'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he', + 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv', + 'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', + 'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk', + 'vi', 'zh-CN', 'zh-TW', + ], + + 'grit_defines': [], + + # Use Harfbuzz-NG instead of Harfbuzz. + # Under development: http://crbug.com/68551 + 'use_harfbuzz_ng%': 0, + + # If debug_devtools is set to 1, JavaScript files for DevTools are + # stored as is and loaded from disk. Otherwise, a concatenated file + # is stored in resources.pak. It is still possible to load JS files + # from disk by passing --debug-devtools cmdline switch. + 'debug_devtools%': 0, + + # Point to ICU directory. + 'icu_src_dir': '../third_party/icu', + + 'conditions': [ + ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + # This will set gcc_version to XY if you are running gcc X.Y.*. + # This is used to tweak build flags for gcc 4.4. + 'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)', + # Figure out the python architecture to decide if we build pyauto. + 'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/lib/libpython<(python_ver).so.1.0)', + 'conditions': [ + ['branding=="Chrome"', { + 'linux_breakpad%': 1, + }], + # All Chrome builds have breakpad symbols, but only process the + # symbols from official builds. + ['(branding=="Chrome" and buildtype=="Official")', { + 'linux_dump_symbols%': 1, + }], + ], + }], # OS=="linux" or OS=="freebsd" or OS=="openbsd" + + ['OS=="mac"', { + 'conditions': [ + # mac_product_name is set to the name of the .app bundle as it should + # appear on disk. This duplicates data from + # chrome/app/theme/chromium/BRANDING and + # chrome/app/theme/google_chrome/BRANDING, but is necessary to get + # these names into the build system. + ['branding=="Chrome"', { + 'mac_product_name%': 'Google Chrome', + }, { # else: branding!="Chrome" + 'mac_product_name%': 'Chromium', + }], + + # Feature variables for enabling Mac Breakpad and Keystone auto-update + # support. Both features are on by default in official builds with + # Chrome branding. + ['branding=="Chrome" and buildtype=="Official"', { + 'mac_breakpad%': 1, + 'mac_keystone%': 1, + }, { # else: branding!="Chrome" or buildtype!="Official" + 'mac_breakpad%': 0, + 'mac_keystone%': 0, + }], + ], + }], # OS=="mac" + + # Whether to use multiple cores to compile with visual studio. This is + # optional because it sometimes causes corruption on VS 2005. + # It is on by default on VS 2008 and off on VS 2005. + ['OS=="win"', { + 'conditions': [ + ['component=="shared_library"', { + 'win_use_allocator_shim%': 0, + }], + ['MSVS_VERSION=="2005"', { + 'msvs_multi_core_compile%': 0, + },{ + 'msvs_multi_core_compile%': 1, + }], + # Don't do incremental linking for large modules on 32-bit. + ['MSVS_OS_BITS==32', { + 'msvs_large_module_debug_link_mode%': '1', # No + },{ + 'msvs_large_module_debug_link_mode%': '2', # Yes + }], + ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', { + 'msvs_express%': 1, + 'secure_atl%': 0, + },{ + 'msvs_express%': 0, + 'secure_atl%': 1, + }], + ], + 'nacl_win64_defines': [ + # This flag is used to minimize dependencies when building + # Native Client loader for 64-bit Windows. + 'NACL_WIN64', + ], + }], + + ['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', { + 'use_cups%': 1, + }, { + 'use_cups%': 0, + }], + + # Set the relative path from this file to the GYP file of the JPEG + # library used by Chromium. + ['use_libjpeg_turbo==1', { + 'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp', + }, { + 'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp', + }], # use_libjpeg_turbo==1 + + # Use GConf, the GNOME configuration system. + ['chromeos==1', { + 'use_gconf%': 0, + }, { + 'use_gconf%': 1, + }], + + # Set up -D and -E flags passed into grit. + ['branding=="Chrome"', { + # TODO(mmoss) The .grd files look for _google_chrome, but for + # consistency they should look for google_chrome_build like C++. + 'grit_defines': ['-D', '_google_chrome', + '-E', 'CHROMIUM_BUILD=google_chrome'], + }, { + 'grit_defines': ['-D', '_chromium', + '-E', 'CHROMIUM_BUILD=chromium'], + }], + ['chromeos==1', { + 'grit_defines': ['-D', 'chromeos'], + }], + ['toolkit_views==1', { + 'grit_defines': ['-D', 'toolkit_views'], + }], + ['touchui==1', { + 'grit_defines': ['-D', 'touchui'], + }], + ['file_manager_extension==1', { + 'grit_defines': ['-D', 'file_manager_extension'], + }], + ['remoting==1', { + 'grit_defines': ['-D', 'remoting'], + }], + ['use_titlecase_in_grd_files==1', { + 'grit_defines': ['-D', 'use_titlecase'], + }], + ['use_third_party_translations==1', { + 'grit_defines': ['-D', 'use_third_party_translations'], + 'locales': ['ast', 'eu', 'gl', 'ka', 'ku', 'ug'], + }], + + ['clang_use_chrome_plugins==1', { + 'clang_chrome_plugins_flags': + '<!(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)', + }], + ], + }, + 'target_defaults': { + 'variables': { + # The condition that operates on chromium_code is in a target_conditions + # section, and will not have access to the default fallback value of + # chromium_code at the top of this file, or to the chromium_code + # variable placed at the root variables scope of .gyp files, because + # those variables are not set at target scope. As a workaround, + # if chromium_code is not set at target scope, define it in target scope + # to contain whatever value it has during early variable expansion. + # That's enough to make it available during target conditional + # processing. + 'chromium_code%': '<(chromium_code)', + + # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html + 'mac_release_optimization%': '3', # Use -O3 unless overridden + 'mac_debug_optimization%': '0', # Use -O0 unless overridden + # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx + 'win_release_Optimization%': '2', # 2 = /Os + 'win_debug_Optimization%': '0', # 0 = /Od + # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx + 'win_debug_RuntimeChecks%': '3', # 3 = all checks enabled, 0 = off + # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx + 'win_debug_InlineFunctionExpansion%': '', # empty = default, 0 = off, + 'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max + # VS inserts quite a lot of extra checks to algorithms like + # std::partial_sort in Debug build which make them O(N^2) + # instead of O(N*logN). This is particularly slow under memory + # tools like ThreadSanitizer so we want it to be disablable. + # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx + 'win_debug_disable_iterator_debugging%': '0', + + 'release_extra_cflags%': '', + 'debug_extra_cflags%': '', + 'release_valgrind_build%': 0, + + 'conditions': [ + ['OS=="win" and component=="shared_library"', { + # See http://msdn.microsoft.com/en-us/library/aa652367.aspx + 'win_release_RuntimeLibrary%': '2', # 2 = /MT (nondebug DLL) + 'win_debug_RuntimeLibrary%': '3', # 3 = /MTd (debug DLL) + }, { + # See http://msdn.microsoft.com/en-us/library/aa652367.aspx + 'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static) + 'win_debug_RuntimeLibrary%': '1', # 1 = /MTd (debug static) + }], + ], + }, + 'conditions': [ + ['branding=="Chrome"', { + 'defines': ['GOOGLE_CHROME_BUILD'], + }, { # else: branding!="Chrome" + 'defines': ['CHROMIUM_BUILD'], + }], + ['toolkit_views==1', { + 'defines': ['TOOLKIT_VIEWS=1'], + }], + ['chromeos==1', { + 'defines': ['OS_CHROMEOS=1'], + }], + ['touchui==1', { + 'defines': ['TOUCH_UI=1'], + }], + ['file_manager_extension==1', { + 'defines': ['FILE_MANAGER_EXTENSION=1'], + }], + ['profiling==1', { + 'defines': ['ENABLE_PROFILING=1'], + }], + ['remoting==1', { + 'defines': ['ENABLE_REMOTING=1'], + }], + ['proprietary_codecs==1', { + 'defines': ['USE_PROPRIETARY_CODECS'], + }], + ['enable_flapper_hacks==1', { + 'defines': ['ENABLE_FLAPPER_HACKS=1'], + }], + ['fastbuild!=0', { + 'conditions': [ + # For Windows, we don't genererate debug information. + ['OS=="win"', { + 'msvs_settings': { + 'VCLinkerTool': { + 'GenerateDebugInformation': 'false', + }, + 'VCCLCompilerTool': { + 'DebugInformationFormat': '0', + } + } + }, { # else: OS != "win", generate less debug information. + 'variables': { + 'debug_extra_cflags': '-g1', + }, + }], + # Clang creates chubby debug information, which makes linking very + # slow. For now, don't create debug information with clang. See + # http://crbug.com/70000 + ['OS=="linux" and clang==1', { + 'variables': { + 'debug_extra_cflags': '-g0', + }, + }], + ], # conditions for fastbuild. + }], # fastbuild!=0 + ['selinux==1', { + 'defines': ['CHROMIUM_SELINUX=1'], + }], + ['win_use_allocator_shim==0', { + 'conditions': [ + ['OS=="win"', { + 'defines': ['NO_TCMALLOC'], + }], + ], + }], + ['enable_gpu==1', { + 'defines': [ + 'ENABLE_GPU=1', + ], + }], + ['use_openssl==1', { + 'defines': [ + 'USE_OPENSSL=1', + ], + }], + ['enable_eglimage==1', { + 'defines': [ + 'ENABLE_EGLIMAGE=1', + ], + }], + ['coverage!=0', { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', # -fprofile-arcs + 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', # -ftest-coverage + }, + # Add -lgcov for types executable, shared_library, and + # loadable_module; not for static_library. + # This is a delayed conditional. + 'target_conditions': [ + ['_type!="static_library"', { + 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] }, + }], + ], + }], + ['OS=="linux"', { + 'cflags': [ '-ftest-coverage', + '-fprofile-arcs' ], + 'link_settings': { 'libraries': [ '-lgcov' ] }, + }], + # Finally, for Windows, we simply turn on profiling. + ['OS=="win"', { + 'msvs_settings': { + 'VCLinkerTool': { + 'Profile': 'true', + }, + 'VCCLCompilerTool': { + # /Z7, not /Zi, so coverage is happyb + 'DebugInformationFormat': '1', + 'AdditionalOptions': ['/Yd'], + } + } + }], # OS==win + ], # conditions for coverage + }], # coverage!=0 + ['OS=="win"', { + 'defines': [ + '__STD_C', + '_CRT_SECURE_NO_DEPRECATE', + '_SCL_SECURE_NO_DEPRECATE', + ], + 'include_dirs': [ + '<(DEPTH)/third_party/wtl/include', + ], + }], # OS==win + ], # conditions for 'target_defaults' + 'target_conditions': [ + ['chromium_code==0', { + 'conditions': [ + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + # We don't want to get warnings from third-party code, + # so remove any existing warning-enabling flags like -Wall. + 'cflags!': [ + '-Wall', + '-Wextra', + '-Werror', + ], + 'cflags': [ + # Don't warn about hash_map in third-party code. + '-Wno-deprecated', + # Don't warn about printf format problems. + # This is off by default in gcc but on in Ubuntu's gcc(!). + '-Wno-format', + ], + }], + [ 'OS=="win"', { + 'defines': [ + '_CRT_SECURE_NO_DEPRECATE', + '_CRT_NONSTDC_NO_WARNINGS', + '_CRT_NONSTDC_NO_DEPRECATE', + '_SCL_SECURE_NO_DEPRECATE', + ], + 'msvs_disabled_warnings': [4800], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'false', + 'Detect64BitPortabilityProblems': 'false', + }, + }, + }], + [ 'OS=="mac"', { + 'xcode_settings': { + 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', + 'WARNING_CFLAGS!': ['-Wall', '-Wextra'], + }, + }], + ], + }, { + # In Chromium code, we define __STDC_FORMAT_MACROS in order to get the + # C99 macros on Mac and Linux. + 'defines': [ + '__STDC_FORMAT_MACROS', + ], + 'conditions': [ + ['OS!="win"', { + 'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)win/'], + ['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ], + }], + ['OS!="mac"', { + 'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)(cocoa|mac)/'], + ['exclude', '\\.mm?$' ] ], + }], + ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { + 'sources/': [ + ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)gtk/'], + ['exclude', '(^|/)(gtk|x11)_[^/]*\\.(h|cc)$'], + ], + }], + ['OS!="linux"', { + 'sources/': [ + ['exclude', '_linux(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)linux/'], + ], + }], + # We use "POSIX" to refer to all non-Windows operating systems. + ['OS=="win"', { + 'sources/': [ ['exclude', '_posix\\.(h|cc)$'] ], + # turn on warnings for signed/unsigned mismatch on chromium code. + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions': ['/we4389'], + }, + }, + }], + ['chromeos!=1', { + 'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ] + }], + ['toolkit_views==0', { + 'sources/': [ ['exclude', '_views\\.(h|cc)$'] ] + }], + ], + }], + ], # target_conditions for 'target_defaults' + 'default_configuration': 'Debug', + 'configurations': { + # VCLinkerTool LinkIncremental values below: + # 0 == default + # 1 == /INCREMENTAL:NO + # 2 == /INCREMENTAL + # Debug links incremental, Release does not. + # + # Abstract base configurations to cover common attributes. + # + 'Common_Base': { + 'abstract': 1, + 'msvs_configuration_attributes': { + 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)', + 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', + 'CharacterSet': '1', + }, + }, + 'x86_Base': { + 'abstract': 1, + 'msvs_settings': { + 'VCLinkerTool': { + 'TargetMachine': '1', + }, + }, + 'msvs_configuration_platform': 'Win32', + }, + 'x64_Base': { + 'abstract': 1, + 'msvs_configuration_platform': 'x64', + 'msvs_settings': { + 'VCLinkerTool': { + 'TargetMachine': '17', # x86 - 64 + 'AdditionalLibraryDirectories!': + ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'], + 'AdditionalLibraryDirectories': + ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'], + }, + 'VCLibrarianTool': { + 'AdditionalLibraryDirectories!': + ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'], + 'AdditionalLibraryDirectories': + ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'], + }, + }, + 'defines': [ + # Not sure if tcmalloc works on 64-bit Windows. + 'NO_TCMALLOC', + ], + }, + 'Debug_Base': { + 'abstract': 1, + 'defines': [ + 'DYNAMIC_ANNOTATIONS_ENABLED=1', + 'WTF_USE_DYNAMIC_ANNOTATIONS=1', + ], + 'xcode_settings': { + 'COPY_PHASE_STRIP': 'NO', + 'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)', + 'OTHER_CFLAGS': [ '<@(debug_extra_cflags)', ], + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '<(win_debug_Optimization)', + 'PreprocessorDefinitions': ['_DEBUG'], + 'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)', + 'RuntimeLibrary': '<(win_debug_RuntimeLibrary)', + 'conditions': [ + # According to MSVS, InlineFunctionExpansion=0 means + # "default inlining", not "/Ob0". + # Thus, we have to handle InlineFunctionExpansion==0 separately. + ['win_debug_InlineFunctionExpansion==0', { + 'AdditionalOptions': ['/Ob0'], + }], + ['win_debug_InlineFunctionExpansion!=""', { + 'InlineFunctionExpansion': + '<(win_debug_InlineFunctionExpansion)', + }], + ['win_debug_disable_iterator_debugging==1', { + 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'], + }], + ], + }, + 'VCLinkerTool': { + 'LinkIncremental': '<(msvs_debug_link_incremental)', + }, + 'VCResourceCompilerTool': { + 'PreprocessorDefinitions': ['_DEBUG'], + }, + }, + 'conditions': [ + ['OS=="linux"', { + 'cflags': [ + '<@(debug_extra_cflags)', + ], + }], + ], + }, + 'Release_Base': { + 'abstract': 1, + 'defines': [ + 'NDEBUG', + ], + 'xcode_settings': { + 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip + 'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)', + 'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ], + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '<(win_release_Optimization)', + 'RuntimeLibrary': '<(win_release_RuntimeLibrary)', + 'conditions': [ + # According to MSVS, InlineFunctionExpansion=0 means + # "default inlining", not "/Ob0". + # Thus, we have to handle InlineFunctionExpansion==0 separately. + ['win_release_InlineFunctionExpansion==0', { + 'AdditionalOptions': ['/Ob0'], + }], + ['win_release_InlineFunctionExpansion!=""', { + 'InlineFunctionExpansion': + '<(win_release_InlineFunctionExpansion)', + }], + ], + }, + 'VCLinkerTool': { + 'LinkIncremental': '1', + }, + }, + 'conditions': [ + ['release_valgrind_build==0', { + 'defines': [ + 'NVALGRIND', + 'DYNAMIC_ANNOTATIONS_ENABLED=0', + ], + }, { + 'defines': [ + 'DYNAMIC_ANNOTATIONS_ENABLED=1', + 'WTF_USE_DYNAMIC_ANNOTATIONS=1', + ], + }], + ['win_use_allocator_shim==0', { + 'defines': ['NO_TCMALLOC'], + }], + ['OS=="linux"', { + 'cflags': [ + '<@(release_extra_cflags)', + ], + }], + ], + }, + 'Purify_Base': { + 'abstract': 1, + 'defines': [ + 'PURIFY', + 'NO_TCMALLOC', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', + 'RuntimeLibrary': '0', + 'BufferSecurityCheck': 'false', + }, + 'VCLinkerTool': { + 'EnableCOMDATFolding': '1', + 'LinkIncremental': '1', + }, + }, + }, + # + # Concrete configurations + # + 'Debug': { + 'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'], + }, + 'Release': { + 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'], + 'conditions': [ + ['msvs_use_common_release', { + 'includes': ['release.gypi'], + }], + ] + }, + 'conditions': [ + [ 'OS=="win"', { + # TODO(bradnelson): add a gyp mechanism to make this more graceful. + 'Purify': { + 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base', 'Purify'], + }, + 'Debug_x64': { + 'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'], + }, + 'Release_x64': { + 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'], + }, + 'Purify_x64': { + 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base', 'Purify_Base'], + }, + }], + ], + }, + }, + 'conditions': [ + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + 'target_defaults': { + # Enable -Werror by default, but put it in a variable so it can + # be disabled in ~/.gyp/include.gypi on the valgrind builders. + 'variables': { + # Use -fno-strict-aliasing by default since gcc 4.4 has periodic + # issues that slip through the cracks. We could do this just for + # gcc 4.4 but it makes more sense to be consistent on all + # compilers in use. TODO(Craig): turn this off again when + # there is some 4.4 test infrastructure in place and existing + # aliasing issues have been fixed. + 'no_strict_aliasing%': 1, + 'conditions': [['OS=="linux"', {'werror%': '-Werror',}], + ['OS=="freebsd"', {'werror%': '',}], + ['OS=="openbsd"', {'werror%': '',}], + ], + }, + 'cflags': [ + '<(werror)', # See note above about the werror variable. + '-pthread', + '-fno-exceptions', + '-Wall', + # TODO(evan): turn this back on once all the builds work. + # '-Wextra', + # Don't warn about unused function params. We use those everywhere. + '-Wno-unused-parameter', + # Don't warn about the "struct foo f = {0};" initialization pattern. + '-Wno-missing-field-initializers', + '-D_FILE_OFFSET_BITS=64', + # Don't export any symbols (for example, to plugins we dlopen()). + # Note: this is *required* to make some plugins work. + '-fvisibility=hidden', + '-pipe', + ], + 'cflags_cc': [ + '-fno-rtti', + '-fno-threadsafe-statics', + # Make inline functions have hidden visiblity by default. + # Surprisingly, not covered by -fvisibility=hidden. + '-fvisibility-inlines-hidden', + ], + 'ldflags': [ + '-pthread', '-Wl,-z,noexecstack', + ], + 'configurations': { + 'Debug_Base': { + 'variables': { + 'debug_optimize%': '0', + }, + 'defines': [ + '_DEBUG', + ], + 'cflags': [ + '-O>(debug_optimize)', + '-g', + ], + }, + 'Release_Base': { + 'variables': { + 'release_optimize%': '2', + # Binaries become big and gold is unable to perform GC + # and remove unused sections for some of test targets + # on 32 bit platform. + # (This is currently observed only in chromeos valgrind bots) + # The following flag is to disable --gc-sections linker + # option for these bots. + 'no_gc_sections%': 0, + }, + 'cflags': [ + '-O>(release_optimize)', + # Don't emit the GCC version ident directives, they just end up + # in the .comment section taking up binary size. + '-fno-ident', + # Put data and code in their own sections, so that unused symbols + # can be removed at link time with --gc-sections. + '-fdata-sections', + '-ffunction-sections', + ], + 'ldflags': [ + # Specifically tell the linker to perform optimizations. + # See http://lwn.net/Articles/192624/ . + '-Wl,-O1', + '-Wl,--as-needed', + ], + 'conditions' : [ + ['no_gc_sections==0', { + 'ldflags': [ + '-Wl,--gc-sections', + ], + }], + ['clang==1', { + 'cflags!': [ + '-fno-ident', + ], + }], + ['profiling==1', { + 'cflags': [ + '-fno-omit-frame-pointer', + '-g', + ], + }], + ] + }, + }, + 'variants': { + 'coverage': { + 'cflags': ['-fprofile-arcs', '-ftest-coverage'], + 'ldflags': ['-fprofile-arcs'], + }, + 'profile': { + 'cflags': ['-pg', '-g'], + 'ldflags': ['-pg'], + }, + 'symbols': { + 'cflags': ['-g'], + }, + }, + 'conditions': [ + [ 'target_arch=="ia32"', { + 'asflags': [ + # Needed so that libs with .s files (e.g. libicudata.a) + # are compatible with the general 32-bit-ness. + '-32', + ], + # All floating-point computations on x87 happens in 80-bit + # precision. Because the C and C++ language standards allow + # the compiler to keep the floating-point values in higher + # precision than what's specified in the source and doing so + # is more efficient than constantly rounding up to 64-bit or + # 32-bit precision as specified in the source, the compiler, + # especially in the optimized mode, tries very hard to keep + # values in x87 floating-point stack (in 80-bit precision) + # as long as possible. This has important side effects, that + # the real value used in computation may change depending on + # how the compiler did the optimization - that is, the value + # kept in 80-bit is different than the value rounded down to + # 64-bit or 32-bit. There are possible compiler options to make + # this behavior consistent (e.g. -ffloat-store would keep all + # floating-values in the memory, thus force them to be rounded + # to its original precision) but they have significant runtime + # performance penalty. + # + # -mfpmath=sse -msse2 makes the compiler use SSE instructions + # which keep floating-point values in SSE registers in its + # native precision (32-bit for single precision, and 64-bit for + # double precision values). This means the floating-point value + # used during computation does not change depending on how the + # compiler optimized the code, since the value is always kept + # in its specified precision. + 'conditions': [ + ['branding=="Chromium" and disable_sse2==0', { + 'cflags': [ + '-march=pentium4', + '-msse2', + '-mfpmath=sse', + ], + }], + # ChromeOS targets Pinetrail, which is sse3, but most of the + # benefit comes from sse2 so this setting allows ChromeOS + # to build on other CPUs. In the future -march=atom would help + # but requires a newer compiler. + ['chromeos==1 and disable_sse2==0', { + 'cflags': [ + '-msse2', + ], + }], + # Install packages have started cropping up with + # different headers between the 32-bit and 64-bit + # versions, so we have to shadow those differences off + # and make sure a 32-bit-on-64-bit build picks up the + # right files. + ['host_arch!="ia32"', { + 'include_dirs+': [ + '/usr/include32', + ], + }], + ], + # -mmmx allows mmintrin.h to be used for mmx intrinsics. + # video playback is mmx and sse2 optimized. + 'cflags': [ + '-m32', + '-mmmx', + ], + 'ldflags': [ + '-m32', + ], + }], + ['target_arch=="arm"', { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags_cc': [ + # The codesourcery arm-2009q3 toolchain warns at that the ABI + # has changed whenever it encounters a varargs function. This + # silences those warnings, as they are not helpful and + # clutter legitimate warnings. + '-Wno-abi', + ], + 'conditions': [ + ['arm_thumb == 1', { + 'cflags': [ + '-mthumb', + # TODO(piman): -Wa,-mimplicit-it=thumb is needed for + # inline assembly that uses condition codes but it's + # suboptimal. Better would be to #ifdef __thumb__ at the + # right place and have a separate thumb path. + '-Wa,-mimplicit-it=thumb', + ] + }], + ['armv7==1', { + 'cflags': [ + '-march=armv7-a', + '-mtune=cortex-a8', + '-mfloat-abi=softfp', + ], + 'conditions': [ + ['arm_neon==1', { + 'cflags': [ '-mfpu=neon', ], + }, { + 'cflags': [ '-mfpu=<(arm_fpu)', ], + }] + ], + }], + ], + }], + ], + }], + ['linux_fpic==1', { + 'cflags': [ + '-fPIC', + ], + }], + ['sysroot!=""', { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': [ + '--sysroot=<(sysroot)', + ], + 'ldflags': [ + '--sysroot=<(sysroot)', + ], + }]] + }], + ['clang==1', { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': [ + '-Wheader-hygiene', + # Clang spots more unused functions. + '-Wno-unused-function', + # Don't die on dtoa code that uses a char as an array index. + '-Wno-char-subscripts', + # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see + # http://code.google.com/p/googletest/source/detail?r=446 . + # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ) + '-Wno-unnamed-type-template-args', + ], + 'cflags!': [ + # Clang doesn't seem to know know this flag. + '-mfpmath=sse', + ], + }]], + }], + ['clang==1 and clang_use_chrome_plugins==1', { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': [ + '<(clang_chrome_plugins_flags)', + ], + }]], + }], + ['clang==1 and clang_load!="" and clang_add_plugin!=""', { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': [ + '-Xclang', '-load', '-Xclang', '<(clang_load)', + '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)', + ], + }]], + }], + ['no_strict_aliasing==1', { + 'cflags': [ + '-fno-strict-aliasing', + ], + }], + ['linux_breakpad==1', { + 'cflags': [ '-g' ], + 'defines': ['USE_LINUX_BREAKPAD'], + }], + ['library=="shared_library"', { + # When building with shared libraries, remove the visiblity-hiding + # flag. + 'cflags!': [ '-fvisibility=hidden' ], + 'conditions': [ + ['target_arch=="x64" or target_arch=="arm"', { + # Shared libraries need -fPIC on x86-64 and arm + 'cflags': ['-fPIC'] + }] + ], + 'ldflags!': [ + # --as-needed confuses library interdependencies. + # See http://code.google.com/p/chromium/issues/detail?id=61430 + '-Wl,--as-needed', + ], + }], + ['linux_use_heapchecker==1', { + 'variables': {'linux_use_tcmalloc%': 1}, + }], + ['linux_use_tcmalloc==0', { + 'defines': ['NO_TCMALLOC'], + }], + ['linux_use_heapchecker==0', { + 'defines': ['NO_HEAPCHECKER'], + }], + ['linux_keep_shadow_stacks==1', { + 'defines': ['KEEP_SHADOW_STACKS'], + 'cflags': ['-finstrument-functions'], + }], + ], + }, + }], + # FreeBSD-specific options; note that most FreeBSD options are set above, + # with Linux. + ['OS=="freebsd"', { + 'target_defaults': { + 'ldflags': [ + '-Wl,--no-keep-memory', + ], + }, + }], + ['OS=="solaris"', { + 'cflags!': ['-fvisibility=hidden'], + 'cflags_cc!': ['-fvisibility-inlines-hidden'], + }], + ['OS=="mac"', { + 'target_defaults': { + 'variables': { + # These should be 'mac_real_dsym%' and 'mac_strip%', but there + # seems to be a bug with % in variables that are intended to be + # set to different values in different targets, like these two. + 'mac_strip': 1, # Strip debugging symbols from the target. + 'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases. + }, + 'mac_bundle': 0, + 'xcode_settings': { + 'ALWAYS_SEARCH_USER_PATHS': 'NO', + 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99 + 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks + 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic + # (Equivalent to -fPIC) + 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions + 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti + 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings + # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden + 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', + 'GCC_OBJC_CALL_CXX_CDTORS': 'YES', # -fobjc-call-cxx-cdtors + 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden + 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics + 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror + 'GCC_VERSION': '4.2', + 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof + # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min + 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)', + 'PREBINDING': 'NO', # No -Wl,-prebind + 'USE_HEADERMAP': 'NO', + 'WARNING_CFLAGS': [ + '-Wall', + '-Wendif-labels', + '-Wextra', + # Don't warn about unused function parameters. + '-Wno-unused-parameter', + # Don't warn about the "struct foo f = {0};" initialization + # pattern. + '-Wno-missing-field-initializers', + ], + 'conditions': [ + ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'}, + {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'} + ], + ['clang==1', { + 'WARNING_CFLAGS': [ + '-Wheader-hygiene', + # Don't die on dtoa code that uses a char as an array index. + # This is required solely for base/third_party/dmg_fp/dtoa.cc. + '-Wno-char-subscripts', + # Clang spots more unused functions. + '-Wno-unused-function', + # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see + # http://code.google.com/p/googletest/source/detail?r=446 . + # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ). + '-Wno-unnamed-type-template-args', + ], + 'OTHER_CFLAGS': [ + # TODO(thakis): Causes many warnings - http://crbug.com/75001 + '-fobjc-exceptions', + ], + }], + ['clang==1 and clang_use_chrome_plugins==1', { + 'OTHER_CFLAGS': [ + '<(clang_chrome_plugins_flags)', + ], + }], + ['clang==1 and clang_load!="" and clang_add_plugin!=""', { + 'OTHER_CFLAGS': [ + '-Xclang', '-load', '-Xclang', '<(clang_load)', + '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)', + ], + }], + ], + }, + 'target_conditions': [ + ['_type!="static_library"', { + 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']}, + }], + ['_mac_bundle', { + 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']}, + }], + ['(_type=="executable" or _type=="shared_library" or \ + _type=="loadable_module") and mac_strip!=0', { + 'target_conditions': [ + ['mac_real_dsym == 1', { + # To get a real .dSYM bundle produced by dsymutil, set the + # debug information format to dwarf-with-dsym. Since + # strip_from_xcode will not be used, set Xcode to do the + # stripping as well. + 'configurations': { + 'Release_Base': { + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'target_conditions': [ + ['_type=="shared_library" or _type=="loadable_module"', { + # The Xcode default is to strip debugging symbols + # only (-S). Local symbols should be stripped as + # well, which will be handled by -x. Xcode will + # continue to insert -S when stripping even when + # additional flags are added with STRIPFLAGS. + 'STRIPFLAGS': '-x', + }], # _type=="shared_library" or _type=="loadable_module"' + ], # target_conditions + }, # xcode_settings + }, # configuration "Release" + }, # configurations + }, { # mac_real_dsym != 1 + # To get a fast fake .dSYM bundle, use a post-build step to + # produce the .dSYM and strip the executable. strip_from_xcode + # only operates in the Release configuration. + 'postbuilds': [ + { + 'variables': { + # Define strip_from_xcode in a variable ending in _path + # so that gyp understands it's a path and performs proper + # relativization during dict merging. + 'strip_from_xcode_path': 'mac/strip_from_xcode', + }, + 'postbuild_name': 'Strip If Needed', + 'action': ['<(strip_from_xcode_path)'], + }, + ], # postbuilds + }], # mac_real_dsym + ], # target_conditions + }], # (_type=="executable" or _type=="shared_library" or + # _type=="loadable_module") and mac_strip!=0 + ], # target_conditions + }, # target_defaults + }], # OS=="mac" + ['OS=="win"', { + 'target_defaults': { + 'defines': [ + '_WIN32_WINNT=0x0600', + 'WINVER=0x0600', + 'WIN32', + '_WINDOWS', + 'NOMINMAX', + '_CRT_RAND_S', + 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS', + 'WIN32_LEAN_AND_MEAN', + '_ATL_NO_OPENGL', + '_HAS_TR1=0', + ], + 'conditions': [ + ['component=="static_library"', { + 'defines': [ + '_HAS_EXCEPTIONS=0', + ], + }], + ['secure_atl', { + 'defines': [ + '_SECURE_ATL', + ], + }], + ], + 'msvs_system_include_dirs': [ + '<(DEPTH)/third_party/platformsdk_win7/files/Include', + '<(DEPTH)/third_party/directxsdk/files/Include', + '$(VSInstallDir)/VC/atlmfc/include', + ], + 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'], + 'msvs_disabled_warnings': [4351, 4396, 4503, 4819], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'MinimalRebuild': 'false', + 'BufferSecurityCheck': 'true', + 'EnableFunctionLevelLinking': 'true', + 'RuntimeTypeInfo': 'false', + 'WarningLevel': '3', + 'WarnAsError': 'true', + 'DebugInformationFormat': '3', + 'conditions': [ + ['msvs_multi_core_compile', { + 'AdditionalOptions': ['/MP'], + }], + ['MSVS_VERSION=="2005e"', { + 'AdditionalOptions': ['/w44068'], # Unknown pragma to 4 (ATL) + }], + ['component=="shared_library"', { + 'ExceptionHandling': '1', # /EHsc + }, { + 'ExceptionHandling': '0', + }], + ], + }, + 'VCLibrarianTool': { + 'AdditionalOptions': ['/ignore:4221'], + 'AdditionalLibraryDirectories': [ + '<(DEPTH)/third_party/platformsdk_win7/files/Lib', + '<(DEPTH)/third_party/directxsdk/files/Lib/x86', + ], + }, + 'VCLinkerTool': { + 'AdditionalDependencies': [ + 'wininet.lib', + 'dnsapi.lib', + 'version.lib', + 'msimg32.lib', + 'ws2_32.lib', + 'usp10.lib', + 'psapi.lib', + 'dbghelp.lib', + ], + 'conditions': [ + ['msvs_express', { + # Explicitly required when using the ATL with express + 'AdditionalDependencies': [ + 'atlthunk.lib', + ], + }], + ['MSVS_VERSION=="2005e"', { + # Non-express versions link automatically to these + 'AdditionalDependencies': [ + 'advapi32.lib', + 'comdlg32.lib', + 'ole32.lib', + 'shell32.lib', + 'user32.lib', + 'winspool.lib', + ], + }], + ], + 'AdditionalLibraryDirectories': [ + '<(DEPTH)/third_party/platformsdk_win7/files/Lib', + '<(DEPTH)/third_party/directxsdk/files/Lib/x86', + ], + 'GenerateDebugInformation': 'true', + 'MapFileName': '$(OutDir)\\$(TargetName).map', + 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib', + 'FixedBaseAddress': '1', + # SubSystem values: + # 0 == not set + # 1 == /SUBSYSTEM:CONSOLE + # 2 == /SUBSYSTEM:WINDOWS + # Most of the executables we'll ever create are tests + # and utilities with console output. + 'SubSystem': '1', + }, + 'VCMIDLTool': { + 'GenerateStublessProxies': 'true', + 'TypeLibraryName': '$(InputName).tlb', + 'OutputDirectory': '$(IntDir)', + 'HeaderFileName': '$(InputName).h', + 'DLLDataFileName': 'dlldata.c', + 'InterfaceIdentifierFileName': '$(InputName)_i.c', + 'ProxyFileName': '$(InputName)_p.c', + }, + 'VCResourceCompilerTool': { + 'Culture' : '1033', + 'AdditionalIncludeDirectories': [ + '<(DEPTH)', + '<(SHARED_INTERMEDIATE_DIR)', + ], + }, + }, + }, + }], + ['disable_nacl==1 or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + 'target_defaults': { + 'defines': [ + 'DISABLE_NACL', + ], + }, + }], + ['OS=="win" and msvs_use_common_linker_extras', { + 'target_defaults': { + 'msvs_settings': { + 'VCLinkerTool': { + 'DelayLoadDLLs': [ + 'dbghelp.dll', + 'dwmapi.dll', + 'uxtheme.dll', + ], + }, + }, + 'configurations': { + 'x86_Base': { + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalOptions': [ + '/safeseh', + '/dynamicbase', + '/ignore:4199', + '/ignore:4221', + '/nxcompat', + ], + }, + }, + }, + 'x64_Base': { + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalOptions': [ + # safeseh is not compatible with x64 + '/dynamicbase', + '/ignore:4199', + '/ignore:4221', + '/nxcompat', + ], + }, + }, + }, + }, + }, + }], + ['enable_new_npdevice_api==1', { + 'target_defaults': { + 'defines': [ + 'ENABLE_NEW_NPDEVICE_API', + ], + }, + }], + ], + 'xcode_settings': { + # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT! + # This block adds *project-wide* configuration settings to each project + # file. It's almost always wrong to put things here. Specify your + # custom xcode_settings in target_defaults to add them to targets instead. + + # In an Xcode Project Info window, the "Base SDK for All Configurations" + # setting sets the SDK on a project-wide basis. In order to get the + # configured SDK to show properly in the Xcode UI, SDKROOT must be set + # here at the project level. + 'SDKROOT': 'macosx<(mac_sdk)', # -isysroot + + # The Xcode generator will look for an xcode_settings section at the root + # of each dict and use it to apply settings on a file-wide basis. Most + # settings should not be here, they should be in target-specific + # xcode_settings sections, or better yet, should use non-Xcode-specific + # settings in target dicts. SYMROOT is a special case, because many other + # Xcode variables depend on it, including variables such as + # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something + # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the + # files to appear (when present) in the UI as actual files and not red + # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR, + # and therefore SYMROOT, needs to be set at the project level. + 'SYMROOT': '<(DEPTH)/xcodebuild', + }, +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/compiler_version.py b/build/compiler_version.py new file mode 100755 index 0000000..69f0a50 --- /dev/null +++ b/build/compiler_version.py @@ -0,0 +1,50 @@ +#!/usr/bin/python + +# Copyright (c) 2009 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. + +"""Compiler version checking tool for gcc + +Print gcc version as XY if you are running gcc X.Y.*. +This is used to tweak build flags for gcc 4.4. +""" + +import os +import re +import subprocess +import sys + +def GetVersion(compiler): + try: + # Note that compiler could be something tricky like "distcc g++". + compiler = compiler + " -dumpversion" + pipe = subprocess.Popen(compiler, stdout=subprocess.PIPE, shell=True) + gcc_output = pipe.communicate()[0] + result = re.match(r"(\d+)\.(\d+)", gcc_output) + return result.group(1) + result.group(2) + except Exception, e: + print >> sys.stderr, "compiler_version.py failed to execute:", compiler + print >> sys.stderr, e + return "" + +def main(): + # Check if CXX environment variable exists and + # if it does use that compiler. + cxx = os.getenv("CXX", None) + if cxx: + cxxversion = GetVersion(cxx) + if cxxversion != "": + print cxxversion + return 0 + else: + # Otherwise we check the g++ version. + gccversion = GetVersion("g++") + if gccversion != "": + print gccversion + return 0 + + return 1 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/build/dir_exists.py b/build/dir_exists.py new file mode 100644 index 0000000..d1c194f --- /dev/null +++ b/build/dir_exists.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# Copyright (c) 2009 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 os.path +import sys + +sys.stdout.write(str(os.path.isdir(sys.argv[1]))) +sys.exit(0) diff --git a/build/extract_from_cab.py b/build/extract_from_cab.py new file mode 100644 index 0000000..fd99184 --- /dev/null +++ b/build/extract_from_cab.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# Copyright (c) 2009 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. + +# Extracts a single file from a CAB archive. + +import os +import subprocess +import sys + +if len(sys.argv) != 4: + print 'Usage: extract_from_cab.py cab_path archived_file output_dir' + sys.exit(1) + +[cab_path, archived_file, output_dir] = sys.argv[1:] + +# Invoke the Windows expand utility to extract the file. +level = subprocess.call(['expand', cab_path, '-F:' + archived_file, output_dir]) +if level != 0: + sys.exit(level) + +# The expand utility preserves the modification date and time of the archived +# file. Touch the extracted file. This helps build systems that compare the +# modification times of input and output files to determine whether to do an +# action. +os.utime(os.path.join(output_dir, archived_file), None) diff --git a/build/features_override.gypi b/build/features_override.gypi new file mode 100644 index 0000000..64b90ca --- /dev/null +++ b/build/features_override.gypi @@ -0,0 +1,119 @@ +# Copyright (c) 2009 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. + +# This file is only included in full-chromium builds, and overrides the +# feature_defines variable in +# third_party/WebKit/Source/WebKit/chromium/features.gypi. +{ + 'variables': { + # WARNING: This list of strings completely replaces the list in + # features.gypi. Therefore, if an enable is listed in features.gypi + # but not listed below, it will revert to its hardcoded webkit value. + 'feature_defines': [ + 'ENABLE_3D_PLUGIN=1', + 'ENABLE_BLOB=1', + 'ENABLE_BLOB_SLICE=1', + 'ENABLE_CHANNEL_MESSAGING=1', + 'ENABLE_CLIENT_BASED_GEOLOCATION=1', + 'ENABLE_DASHBOARD_SUPPORT=0', + 'ENABLE_DATABASE=1', + 'ENABLE_DATAGRID=0', + 'ENABLE_DATA_TRANSFER_ITEMS=1', + 'ENABLE_DEVICE_ORIENTATION=1', + 'ENABLE_DIRECTORY_UPLOAD=1', + 'ENABLE_DOM_STORAGE=1', + 'ENABLE_EVENTSOURCE=1', + 'ENABLE_JAVASCRIPT_I18N_API=1', + 'ENABLE_FILE_SYSTEM=1', + 'ENABLE_FILTERS=1', + 'ENABLE_GEOLOCATION=1', + 'ENABLE_ICONDATABASE=0', + 'ENABLE_INDEXED_DATABASE=1', + 'ENABLE_INPUT_SPEECH=1', + 'ENABLE_JAVASCRIPT_DEBUGGER=1', + 'ENABLE_JSC_MULTIPLE_THREADS=0', + 'ENABLE_LEVELDB=0', + 'ENABLE_LINK_PREFETCH=1', + 'ENABLE_METER_TAG=1', + 'ENABLE_MEDIA_STATISTICS=1', + 'ENABLE_MEDIA_STREAM=1', + 'ENABLE_NOTIFICATIONS=1', + 'ENABLE_OFFLINE_WEB_APPLICATIONS=1', + 'ENABLE_OPENTYPE_SANITIZER=1', + 'ENABLE_ORIENTATION_EVENTS=0', + 'ENABLE_PROGRESS_TAG=1', + 'ENABLE_REQUEST_ANIMATION_FRAME=1', + 'ENABLE_RUBY=1', + 'ENABLE_SANDBOX=1', + 'ENABLE_SHARED_WORKERS=1', + 'ENABLE_SKIA_GPU=<(use_skia_gpu)', + 'ENABLE_SVG=<(enable_svg)', + 'ENABLE_SVG_ANIMATION=<(enable_svg)', + 'ENABLE_SVG_AS_IMAGE=<(enable_svg)', + 'ENABLE_SVG_FONTS=<(enable_svg)', + 'ENABLE_SVG_FOREIGN_OBJECT=<(enable_svg)', + 'ENABLE_SVG_USE=<(enable_svg)', + 'ENABLE_TOUCH_EVENTS=<(enable_touch_events)', + 'ENABLE_V8_SCRIPT_DEBUG_SERVER=1', + 'ENABLE_VIDEO=1', + 'ENABLE_WEB_SOCKETS=1', + 'ENABLE_WEB_TIMING=1', + 'ENABLE_WEBGL=1', + 'ENABLE_WORKERS=1', + 'ENABLE_XHR_RESPONSE_BLOB=1', + 'ENABLE_XPATH=1', + 'ENABLE_XSLT=1', + 'WTF_USE_BUILTIN_UTF8_CODEC=1', + # WTF_USE_DYNAMIC_ANNOTATIONS=1 may be defined in build/common.gypi + # We can't define it here because it should be present only + # in Debug or release_valgrind_build=1 builds. + 'WTF_USE_WEBP=1', + 'WTF_USE_WEBKIT_IMAGE_DECODERS=1', + ], + # We have to nest variables inside variables so that they can be overridden + # through GYP_DEFINES. + 'variables': { + 'use_accelerated_compositing%': 1, + 'use_threaded_compositing%': 0, + 'enable_svg%': 1, + 'enable_touch_events%': 1, + 'use_skia_gpu%': 0, + }, + 'use_accelerated_compositing%': '<(use_accelerated_compositing)', + 'use_threaded_compositing%': '<(use_threaded_compositing)', + 'enable_svg%': '<(enable_svg)', + 'enable_touch_events%': '<(enable_touch_events)', + 'conditions': [ + ['(OS=="win" or OS=="linux" or OS=="mac") and use_accelerated_compositing==1', { + 'feature_defines': [ + 'WTF_USE_ACCELERATED_COMPOSITING=1', + 'ENABLE_3D_RENDERING=1', + 'ENABLE_ACCELERATED_2D_CANVAS=1', + ], + 'use_accelerated_compositing': 1, + }], + ['use_accelerated_compositing==1 and use_threaded_compositing==1', { + 'feature_defines': [ + 'WTF_USE_THREADED_COMPOSITING=1', + ], + 'use_threaded_compositing': 1, + }], + ['OS=="mac"', { + 'feature_defines': [ + 'ENABLE_WEB_AUDIO=1', + ], + }], + ], + # TODO: If the need arises, create a mechanism that will intelligently + # merge the lists rather than replace one with the other. This may + # require changes in gyp. + }, + +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/grit_action.gypi b/build/grit_action.gypi new file mode 100644 index 0000000..041d704 --- /dev/null +++ b/build/grit_action.gypi @@ -0,0 +1,39 @@ +# Copyright (c) 2011 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. + +# This file is meant to be included into an action to invoke grit in a +# consistent manner. To use this the following variables need to be +# defined: +# grit_grd_file: string: grd file path +# grit_out_dir: string: the output directory path + +# It would be really nice to do this with a rule instead of actions, but it +# would need to determine inputs and outputs via grit_info on a per-file +# basis. GYP rules don’t currently support that. They could be extended to +# do this, but then every generator would need to be updated to handle this. + +{ + 'variables': { + 'grit_info_cmd': ['python', '<(DEPTH)/tools/grit/grit_info.py', + '<@(grit_defines)'], + 'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'], + }, + 'inputs': [ + '<!@(<(grit_info_cmd) --inputs <(grit_grd_file))', + ], + 'outputs': [ + '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))', + ], + 'action': ['<@(grit_cmd)', + '-i', '<(grit_grd_file)', 'build', + '-o', '<(grit_out_dir)', + '<@(grit_defines)' ], + 'message': 'Generating resources from <(grit_grd_file)', +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/grit_target.gypi b/build/grit_target.gypi new file mode 100644 index 0000000..5912d48 --- /dev/null +++ b/build/grit_target.gypi @@ -0,0 +1,39 @@ +# Copyright (c) 2011 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. + +# This file is meant to be included into a target that will have one or more +# uses of grit_action.gypi. To use this the following variables need to be +# defined: +# grit_out_dir: string: the output directory path + +# NOTE: This file is optional, not all targets that use grit include it, some +# do their own custom directives instead. +{ + 'conditions': [ + # If the target is a direct binary, it needs to be able to find the header, + # otherwise it probably a supporting target just for grit so the include + # dir needs to be set on anything that depends on this action. + ['_type=="executable" or _type=="shared_library" or \ + _type=="loadable_module" or _type=="static_library"', { + 'include_dirs': [ + '<(grit_out_dir)', + ], + }, { + 'direct_dependent_settings': { + 'include_dirs': [ + '<(grit_out_dir)', + ], + }, + }], + ['OS=="win"', { + 'dependencies': ['<(DEPTH)/build/win/system.gyp:cygwin'], + }], + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/gyp_chromium b/build/gyp_chromium new file mode 100755 index 0000000..3cddef6 --- /dev/null +++ b/build/gyp_chromium @@ -0,0 +1,167 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 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. + +# This script is wrapper for Chromium that adds some support for how GYP +# is invoked by Chromium beyond what can be done in the gclient hooks. + +import glob +import os +import shlex +import subprocess +import sys + +script_dir = os.path.dirname(__file__) +chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) + +sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) +import gyp + +# On Windows, Psyco shortens warm runs of build/gyp_chromium by about +# 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 +# seconds. Conversely, memory usage of build/gyp_chromium with Psyco +# maxes out at about 158 MB vs. 132 MB without it. +# +# Psyco uses native libraries, so we need to load a different +# installation depending on which OS we are running under. It has not +# been tested whether using Psyco on our Mac and Linux builds is worth +# it (the GYP running time is a lot shorter, so the JIT startup cost +# may not be worth it). +if sys.platform == 'win32': + try: + sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32')) + import psyco + except: + psyco = None +else: + psyco = None + +def apply_gyp_environment(file_path=None): + """ + Reads in a *.gyp_env file and applies the valid keys to os.environ. + """ + if not file_path or not os.path.exists(file_path): + return + file_contents = open(file_path).read() + try: + file_data = eval(file_contents, {'__builtins__': None}, None) + except SyntaxError, e: + e.filename = os.path.abspath(file_path) + raise + supported_vars = ( 'CHROMIUM_GYP_FILE', + 'CHROMIUM_GYP_SYNTAX_CHECK', + 'GYP_DEFINES', + 'GYP_GENERATOR_FLAGS', + 'GYP_GENERATOR_OUTPUT', ) + for var in supported_vars: + val = file_data.get(var) + if val: + if var in os.environ: + print 'INFO: Environment value for "%s" overrides value in %s.' % ( + var, os.path.abspath(file_path) + ) + else: + os.environ[var] = val + +def additional_include_files(args=[]): + """ + Returns a list of additional (.gypi) files to include, without + duplicating ones that are already specified on the command line. + """ + # Determine the include files specified on the command line. + # This doesn't cover all the different option formats you can use, + # but it's mainly intended to avoid duplicating flags on the automatic + # makefile regeneration which only uses this format. + specified_includes = set() + for arg in args: + if arg.startswith('-I') and len(arg) > 2: + specified_includes.add(os.path.realpath(arg[2:])) + + result = [] + def AddInclude(path): + if os.path.realpath(path) not in specified_includes: + result.append(path) + + # Always include common.gypi & features_override.gypi + AddInclude(os.path.join(script_dir, 'common.gypi')) + AddInclude(os.path.join(script_dir, 'features_override.gypi')) + + # Optionally add supplemental .gypi files if present. + supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) + for supplement in supplements: + AddInclude(supplement) + + return result + +if __name__ == '__main__': + args = sys.argv[1:] + + # Use the Psyco JIT if available. + if psyco: + psyco.profile() + print "Enabled Psyco JIT." + + # Fall back on hermetic python if we happen to get run under cygwin. + # TODO(bradnelson): take this out once this issue is fixed: + # http://code.google.com/p/gyp/issues/detail?id=177 + if sys.platform == 'cygwin': + python_dir = os.path.join(chrome_src, 'third_party', 'python_26') + env = os.environ.copy() + env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') + p = subprocess.Popen( + [os.path.join(python_dir, 'python.exe')] + sys.argv, + env=env, shell=False) + p.communicate() + sys.exit(p.returncode) + + if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: + # Update the environment based on chromium.gyp_env + gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') + apply_gyp_environment(gyp_env_path) + + # This could give false positives since it doesn't actually do real option + # parsing. Oh well. + gyp_file_specified = False + for arg in args: + if arg.endswith('.gyp'): + gyp_file_specified = True + break + + # If we didn't get a file, check an env var, and then fall back to + # assuming 'all.gyp' from the same directory as the script. + if not gyp_file_specified: + gyp_file = os.environ.get('CHROMIUM_GYP_FILE') + if gyp_file: + # Note that CHROMIUM_GYP_FILE values can't have backslashes as + # path separators even on Windows due to the use of shlex.split(). + args.extend(shlex.split(gyp_file)) + else: + args.append(os.path.join(script_dir, 'all.gyp')) + + args.extend(['-I' + i for i in additional_include_files(args)]) + + # There shouldn't be a circular dependency relationship between .gyp files, + # but in Chromium's .gyp files, on non-Mac platforms, circular relationships + # currently exist. The check for circular dependencies is currently + # bypassed on other platforms, but is left enabled on the Mac, where a + # violation of the rule causes Xcode to misbehave badly. + # TODO(mark): Find and kill remaining circular dependencies, and remove this + # option. http://crbug.com/35878. + # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the + # list. + if sys.platform not in ('darwin',): + args.append('--no-circular-check') + + # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check + # to enfore syntax checking. + syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') + if syntax_check and int(syntax_check): + args.append('--check') + + print 'Updating projects from gyp files...' + sys.stdout.flush() + + # Off we go... + sys.exit(gyp.main(args)) diff --git a/build/install-build-deps.sh b/build/install-build-deps.sh new file mode 100755 index 0000000..b30e08a --- /dev/null +++ b/build/install-build-deps.sh @@ -0,0 +1,515 @@ +#!/bin/bash -e + +# Copyright (c) 2011 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. + +# Script to install everything needed to build chromium (well, ideally, anyway) +# See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions +# and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit + +usage() { + echo "Usage: $0 [--options]" + echo "Options:" + echo "--[no-]syms: enable or disable installation of debugging symbols" + echo "--[no-]gold: enable or disable installation of gold linker" + echo "--[no-]lib32: enable or disable installation of 32 bit libraries" + echo "Script will prompt interactively if options not given." + exit 1 +} + +while test "$1" != "" +do + case "$1" in + --syms) do_inst_syms=1;; + --no-syms) do_inst_syms=0;; + --gold) do_inst_gold=1;; + --no-gold) do_inst_gold=0;; + --lib32) do_inst_lib32=1;; + --no-lib32) do_inst_lib32=0;; + *) usage;; + esac + shift +done + +install_gold() { + # Gold is optional; it's a faster replacement for ld, + # and makes life on 2GB machines much more pleasant. + + # First make sure root can access this directory, as that's tripped + # up some folks. + if sudo touch xyz.$$ + then + sudo rm xyz.$$ + else + echo root cannot write to the current directory, not installing gold + return + fi + + BINUTILS=binutils-2.21 + BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2 + BINUTILS_SHA1=ef93235588eb443e4c4a77f229a8d131bccaecc6 + + test -f $BINUTILS.tar.bz2 || wget $BINUTILS_URL + if test "`sha1sum $BINUTILS.tar.bz2|cut -d' ' -f1`" != "$BINUTILS_SHA1" + then + echo Bad sha1sum for $BINUTILS.tar.bz2 + exit 1 + fi + + tar -xjvf $BINUTILS.tar.bz2 + cd $BINUTILS + patch -p1 <<EOF +diff -u -r1.103 -r1.103.2.1 +--- src/gold/object.h 2010/09/08 23:54:51 1.103 ++++ src/gold/object.h 2011/02/10 01:15:28 1.103.2.1 +@@ -1,6 +1,6 @@ + // object.h -- support for an object file for linking in gold -*- C++ -*- + +-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ++// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + // Written by Ian Lance Taylor <iant@google.com>. + + // This file is part of gold. +@@ -2165,15 +2165,6 @@ + Output_symtab_xindex*, + Output_symtab_xindex*); + +- // Clear the local symbol information. +- void +- clear_local_symbols() +- { +- this->local_values_.clear(); +- this->local_got_offsets_.clear(); +- this->local_plt_offsets_.clear(); +- } +- + // Record a mapping from discarded section SHNDX to the corresponding + // kept section. + void +diff -u -r1.60 -r1.60.2.1 +--- src/gold/reloc.cc 2010/10/14 22:10:22 1.60 ++++ src/gold/reloc.cc 2011/02/10 01:15:28 1.60.2.1 +@@ -1,6 +1,6 @@ + // reloc.cc -- relocate input files for gold. + +-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ++// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + // Written by Ian Lance Taylor <iant@google.com>. + + // This file is part of gold. +@@ -685,9 +685,6 @@ + // Write out the local symbols. + this->write_local_symbols(of, layout->sympool(), layout->dynpool(), + layout->symtab_xindex(), layout->dynsym_xindex()); +- +- // We should no longer need the local symbol values. +- this->clear_local_symbols(); + } + + // Sort a Read_multiple vector by file offset. +EOF + ./configure --prefix=/usr/local/gold --enable-gold --enable-threads + make maybe-all-binutils maybe-all-gold -j4 + if sudo make maybe-install-binutils maybe-install-gold + then + # Still need to figure out graceful way of pointing gyp to use + # /usr/local/gold/bin/ld without requiring him to set environment + # variables. That will go into bootstrap-linux.sh when it's ready. + echo "Installing gold as /usr/bin/ld." + echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'" + test -f /usr/bin/ld && test ! -f /usr/bin/ld.orig && \ + sudo mv /usr/bin/ld /usr/bin/ld.orig + sudo strip /usr/local/gold/bin/ld + sudo ln -fs /usr/local/gold/bin/ld /usr/bin/ld.gold + sudo ln -fs /usr/bin/ld.gold /usr/bin/ld + else + echo "make install failed, not installing gold" + fi +} + +if ! egrep -q \ + 'Ubuntu (8\.04|8\.10|9\.04|9\.10|10\.04|10\.10|karmic|lucid|maverick)' \ + /etc/issue; then + echo "Only Ubuntu 8.04 (hardy) through 10.10 (maverick) are currently" \ + "supported" >&2 + exit 1 +fi + +if ! uname -m | egrep -q "i686|x86_64"; then + echo "Only x86 architectures are currently supported" >&2 + exit +fi + +if [ "x$(id -u)" != x0 ]; then + echo "Running as non-root user." + echo "You might have to enter your password one or more times for 'sudo'." + echo +fi + +# Packages needed for chromeos only +chromeos_dev_list="libpulse-dev" + +# Packages need for development +dev_list="bison fakeroot flex g++ gperf libapache2-mod-php5 libasound2-dev + libbz2-dev libcairo2-dev libdbus-glib-1-dev libgconf2-dev + libgl1-mesa-dev libglu1-mesa-dev libglib2.0-dev libgnome-keyring-dev + libgtk2.0-dev libjpeg62-dev libnspr4-dev libnss3-dev libpam0g-dev + libsctp-dev libsqlite3-dev libxslt1-dev libxss-dev libxtst-dev + mesa-common-dev msttcorefonts patch perl php5-cgi pkg-config python + python-dev rpm subversion ttf-dejavu-core ttf-kochi-gothic + ttf-kochi-mincho wdiff libcurl4-gnutls-dev + $chromeos_dev_list" + +# Run-time libraries required by chromeos only +chromeos_lib_list="libpulse0 libbz2-1.0 libcurl4-gnutls-dev" + +# Full list of required run-time libraries +lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libdbus-glib-1-2 libexpat1 + libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 libgtk2.0-0 + libnspr4-0d libnss3-1d libpam0g libpango1.0-0 libpcre3 libpixman-1-0 + libpng12-0 libstdc++6 libsqlite3-0 libx11-6 libxau6 libxcb1 + libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 + libxi6 libxinerama1 libxrandr2 libxrender1 libxtst6 zlib1g + $chromeos_lib_list" + +# Debugging symbols for all of the run-time libraries +dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg + libfontconfig1-dbg libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg + libnss3-1d-dbg libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg + libx11-6-dbg libxau6-dbg libxcb1-dbg libxcomposite1-dbg + libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg + libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg + libxrender1-dbg libxtst6-dbg zlib1g-dbg" + +# CUPS package changed its name from hardy to the next version. Include +# proper package here depending on the system. +if egrep -q 'Ubuntu (8\.04|8\.10)' /etc/issue; then + dev_list="${dev_list} libcupsys2-dev" +else + dev_list="${dev_list} libcups2-dev" +fi + +# apache2.2-bin package was introduced in karmic. +if egrep -q 'Ubuntu (8\.04|8\.10|9\.04)' /etc/issue; then + dev_list="${dev_list} apache2" +else + dev_list="${dev_list} apache2.2-bin" +fi + +# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is +# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has +# been provided to yes_no(), the function also accepts RETURN as a user input. +# The parameter specifies the exit code that should be returned in that case. +# The function will echo the user's selection followed by a newline character. +# Users can abort the function by pressing CTRL-C. This will call "exit 1". +yes_no() { + local c + while :; do + c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT + stty -echo iuclc -icanon 2>/dev/null + dd count=1 bs=1 2>/dev/null | od -An -tx1)" + case "$c" in + " 0a") if [ -n "$1" ]; then + [ $1 -eq 0 ] && echo "Y" || echo "N" + return $1 + fi + ;; + " 79") echo "Y" + return 0 + ;; + " 6e") echo "N" + return 1 + ;; + "") echo "Aborted" >&2 + exit 1 + ;; + *) # The user pressed an unrecognized key. As we are not echoing + # any incorrect user input, alert the user by ringing the bell. + (tput bel) 2>/dev/null + ;; + esac + done +} + +if test "$do_inst_syms" = "" +then + echo "This script installs all tools and libraries needed to build Chromium." + echo "" + echo "For most of the libraries, it can also install debugging symbols, which" + echo "will allow you to debug code in the system libraries. Most developers" + echo "won't need these symbols." + echo -n "Do you want me to install them for you (y/N) " + if yes_no 1; then + do_inst_syms=1 + fi +fi +if test "$do_inst_syms" = "1"; then + echo "Installing debugging symbols." +else + echo "Skipping installation of debugging symbols." + dbg_list= +fi + +sudo apt-get update + +# We initially run "apt-get" with the --reinstall option and parse its output. +# This way, we can find all the packages that need to be newly installed +# without accidentally promoting any packages from "auto" to "manual". +# We then re-run "apt-get" with just the list of missing packages. +echo "Finding missing packages..." +packages="${dev_list} ${lib_list} ${dbg_list}" +# Intentially leaving $packages unquoted so it's more readable. +echo "Packages required: " $packages +echo +new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" +if new_list="$(yes n | LANG=C $new_list_cmd)"; then + # We probably never hit this following line. + echo "No missing packages, and the packages are up-to-date." +elif [ $? -eq 1 ]; then + # We expect apt-get to have exit status of 1. + # This indicates that we canceled the install with "yes n|". + new_list=$(echo "$new_list" | + sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') + new_list=$(echo "$new_list" | sed 's/ *$//') + if [ -z "$new_list" ] ; then + echo "No missing packages, and the packages are up-to-date." + else + echo "Installing missing packages: $new_list." + sudo apt-get install ${new_list} + fi + echo +else + # An apt-get exit status of 100 indicates that a real error has occurred. + + # I am intentionally leaving out the '"'s around new_list_cmd, + # as this makes it easier to cut and paste the output + echo "The following command failed: " ${new_list_cmd} + echo + echo "It produces the following output:" + yes n | $new_list_cmd || true + echo + echo "You will have to install the above packages yourself." + echo + exit 100 +fi + +# Some operating systems already ship gold (on recent Debian and +# Ubuntu you can do "apt-get install binutils-gold" to get it), but +# older releases didn't. Additionally, gold 2.20 (included in Ubuntu +# Lucid) makes binaries that just segfault, and 2.20.1 does not support +# --map-whole-files. +# So install from source if we don't have a good version. + +case `ld --version` in +*gold*2.2[1-9].*) ;; +* ) + if test "$do_inst_gold" = "" + then + echo "Gold is a new linker that links Chrome 5x faster than ld." + echo "Don't use it if you need to link other apps (e.g. valgrind, wine)" + echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) " + if yes_no 1; then + do_inst_gold=1 + fi + fi + if test "$do_inst_gold" = "1" + then + # If the system provides a good version of gold, just install it. + if apt-cache show binutils-gold | grep -Eq 'Version: 2.2[1-9].*'; then + echo "Installing binutils-gold. Backing up ld as ld.single." + sudo apt-get install binutils-gold + else + # FIXME: avoid installing as /usr/bin/ld + echo "Building binutils. Backing up ld as ld.orig." + install_gold || exit 99 + fi + else + echo "Not installing gold." + fi +esac + +# Install 32bit backwards compatibility support for 64bit systems +if [ "$(uname -m)" = "x86_64" ]; then + if test "$do_inst_lib32" = "" + then + echo "Installing 32bit libraries not already provided by the system" + echo + echo "This is only needed to build a 32-bit Chrome on your 64-bit system." + echo + echo "While we only need to install a relatively small number of library" + echo "files, we temporarily need to download a lot of large *.deb packages" + echo "that contain these files. We will create new *.deb packages that" + echo "include just the 32bit libraries. These files will then be found on" + echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32," + echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files," + echo "look for packages named *-ia32.deb." + echo "Do you want me to download all packages needed to build new 32bit" + echo -n "package files (Y/n) " + if yes_no 0; then + do_inst_lib32=1 + fi + fi + if test "$do_inst_lib32" != "1" + then + echo "Exiting without installing any 32bit libraries." + exit 0 + fi + + # Standard 32bit compatibility libraries + echo "First, installing the limited existing 32-bit support..." + cmp_list="ia32-libs lib32asound2-dev lib32readline5-dev lib32stdc++6 lib32z1 + lib32z1-dev libc6-dev-i386 libc6-i386 g++-multilib" + sudo apt-get install $cmp_list + + tmp=/tmp/install-32bit.$$ + trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT + mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" + touch "${tmp}/status" + + [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" + cat >>"${tmp}/apt/apt.conf" <<EOF + Apt::Architecture "i386"; + Dir::Cache "${tmp}/cache"; + Dir::Cache::Archives "${tmp}/"; + Dir::State::Lists "${tmp}/apt/lists/"; + Dir::State::status "${tmp}/status"; +EOF + + # Download 32bit packages + echo "Computing list of available 32bit packages..." + sudo apt-get -c="${tmp}/apt/apt.conf" update + + echo "Downloading available 32bit packages..." + sudo apt-get -c="${tmp}/apt/apt.conf" \ + --yes --download-only --force-yes --reinstall install \ + ${lib_list} ${dbg_list} + + # Open packages, remove everything that is not a library, move the + # library to a lib32 directory and package everything as a *.deb file. + echo "Repackaging and installing 32bit packages for use on 64bit systems..." + for i in ${lib_list} ${dbg_list}; do + orig="$(echo "${tmp}/${i}"_*_i386.deb)" + compat="$(echo "${orig}" | + sed -e 's,\(_[^_/]*_\)i386\(.deb\),-ia32\1amd64\2,')" + rm -rf "${tmp}/staging" + msg="$(fakeroot -u sh -exc ' + # Unpack 32bit Debian archive + umask 022 + mkdir -p "'"${tmp}"'/staging/dpkg/DEBIAN" + cd "'"${tmp}"'/staging" + ar x "'${orig}'" + tar zCfx dpkg data.tar.gz + tar zCfx dpkg/DEBIAN control.tar.gz + + # Create a posix extended regular expression fragment that will + # recognize the includes which have changed. Should be rare, + # will almost always be empty. + includes=`sed -n -e "s/^[0-9a-z]* //g" \ + -e "\,usr/include/,p" dpkg/DEBIAN/md5sums | + xargs -n 1 -I FILE /bin/sh -c \ + "cmp -s dpkg/FILE /FILE || echo FILE" | + tr "\n" "|" | + sed -e "s,|$,,"` + + # If empty, set it to not match anything. + test -z "$includes" && includes="^//" + + # Turn the conflicts into an extended RE for removal from the + # Provides line. + conflicts=`sed -n -e "/Conflicts/s/Conflicts: *//;T;s/, */|/g;p" \ + dpkg/DEBIAN/control` + + # Rename package, change architecture, remove conflicts and dependencies + sed -r -i \ + -e "/Package/s/$/-ia32/" \ + -e "/Architecture/s/:.*$/: amd64/" \ + -e "/Depends/s/:.*/: ia32-libs/" \ + -e "/Provides/s/($conflicts)(, *)?//g;T1;s/, *$//;:1" \ + -e "/Recommends/d" \ + -e "/Conflicts/d" \ + dpkg/DEBIAN/control + + # Only keep files that live in "lib" directories or the includes + # that have changed. + sed -r -i \ + -e "/\/lib64\//d" -e "/\/.?bin\//d" \ + -e "\,$includes,s,[ /]include/,&32/,g;s,include/32/,include32/,g" \ + -e "s, lib/, lib32/,g" \ + -e "s,/lib/,/lib32/,g" \ + -e "t;d" \ + -e "\,^/usr/lib32/debug\(.*/lib32\),s,^/usr/lib32/debug,/usr/lib/debug," \ + dpkg/DEBIAN/md5sums + + # Re-run ldconfig after installation/removal + { echo "#!/bin/sh"; echo "[ \"x\$1\" = xconfigure ]&&ldconfig||:"; } \ + >dpkg/DEBIAN/postinst + { echo "#!/bin/sh"; echo "[ \"x\$1\" = xremove ]&&ldconfig||:"; } \ + >dpkg/DEBIAN/postrm + chmod 755 dpkg/DEBIAN/postinst dpkg/DEBIAN/postrm + + # Remove any other control files + find dpkg/DEBIAN -mindepth 1 "(" -name control -o -name md5sums -o \ + -name postinst -o -name postrm ")" -o -print | + xargs -r rm -rf + + # Remove any files/dirs that live outside of "lib" directories, + # or are not in our list of changed includes. + find dpkg -mindepth 1 -regextype posix-extended \ + "(" -name DEBIAN -o -name lib -o -regex "dpkg/($includes)" ")" \ + -prune -o -print | tac | + xargs -r -n 1 sh -c "rm \$0 2>/dev/null || rmdir \$0 2>/dev/null || : " + find dpkg -name lib64 -o -name bin -o -name "?bin" | + tac | xargs -r rm -rf + + # Remove any symbolic links that were broken by the above steps. + find -L dpkg -type l -print | tac | xargs -r rm -rf + + # Rename lib to lib32, but keep debug symbols in /usr/lib/debug/usr/lib32 + # That is where gdb looks for them. + find dpkg -type d -o -path "*/lib/*" -print | + xargs -r -n 1 sh -c " + i=\$(echo \"\${0}\" | + sed -e s,/lib/,/lib32/,g \ + -e s,/usr/lib32/debug\\\\\(.*/lib32\\\\\),/usr/lib/debug\\\\1,); + mkdir -p \"\${i%/*}\"; + mv \"\${0}\" \"\${i}\"" + + # Rename include to include32. + [ -d "dpkg/usr/include" ] && mv "dpkg/usr/include" "dpkg/usr/include32" + + # Prune any empty directories + find dpkg -type d | tac | xargs -r -n 1 rmdir 2>/dev/null || : + + # Create our own Debian package + cd .. + dpkg --build staging/dpkg .' 2>&1)" + compat="$(eval echo $(echo "${compat}" | + sed -e 's,_[^_/]*_amd64.deb,_*_amd64.deb,'))" + [ -r "${compat}" ] || { + echo "${msg}" >&2 + echo "Failed to build new Debian archive!" >&2 + exit 1 + } + + msg="$(sudo dpkg -i "${compat}" 2>&1)" && { + echo "Installed ${compat##*/}" + } || { + # echo "${msg}" >&2 + echo "Skipped ${compat##*/}" + } + done + + # Add symbolic links for developing 32bit code + echo "Adding missing symbolic links, enabling 32bit code development..." + for i in $(find /lib32 /usr/lib32 -maxdepth 1 -name \*.so.\* | + sed -e 's/[.]so[.][0-9].*/.so/' | + sort -u); do + [ "x${i##*/}" = "xld-linux.so" ] && continue + [ -r "$i" ] && continue + j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | + sort -n | tail -n 1)" + [ -r "$i.$j" ] || continue + sudo ln -s "${i##*/}.$j" "$i" + done +fi diff --git a/build/install-chroot.sh b/build/install-chroot.sh new file mode 100755 index 0000000..b80aea0 --- /dev/null +++ b/build/install-chroot.sh @@ -0,0 +1,325 @@ +#!/bin/bash -e + +# Copyright (c) 2010 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. + +# This script installs Debian-derived distributions in a chroot environment. +# It can for example be used to have an accurate 32bit build and test +# environment when otherwise working on a 64bit machine. +# N. B. it is unlikely that this script will ever work on anything other than a +# Debian-derived system. + +usage() { + echo "usage: ${0##*/} [-m mirror] [-g group,...] [-s] [-c]" + echo "-g group,... groups that can use the chroot unauthenticated" + echo " Default: 'admin' and current user's group ('$(id -gn)')" + echo "-m mirror an alternate repository mirror for package downloads" + echo "-s configure default deb-srcs" + echo "-c always copy 64bit helper binaries to 32bit chroot" + echo "-h this help message" +} + +process_opts() { + local OPTNAME OPTIND OPTERR OPTARG + while getopts ":g:m:sch" OPTNAME; do + case "$OPTNAME" in + g) + [ -n "${OPTARG}" ] && + chroot_groups="${chroot_groups}${chroot_groups:+,}${OPTARG}" + ;; + m) + if [ -n "${mirror}" ]; then + echo "You can only specify exactly one mirror location" + usage + exit 1 + fi + mirror="$OPTARG" + ;; + s) + add_srcs="y" + ;; + c) + copy_64="y" + ;; + h) + usage + exit 0 + ;; + \:) + echo "'-$OPTARG' needs an argument." + usage + exit 1 + ;; + *) + echo "invalid command-line option: $OPTARG" + usage + exit 1 + ;; + esac + done + + if [ $# -ge ${OPTIND} ]; then + eval echo "Unexpected command line argument: \${${OPTIND}}" + usage + exit 1 + fi +} + + +# Check that we are running as a regular user +[ "$(id -nu)" = root ] && { + echo "Run this script as a regular user and provide your \"sudo\"" \ + "password if requested" >&2 + exit 1 +} +mkdir -p "$HOME/chroot/" + +process_opts "$@" + +# Error handler +trap 'exit 1' INT TERM QUIT +trap 'sudo apt-get clean; tput bel; echo; echo Failed' EXIT + +# Install any missing applications that this script relies on. If these packages +# are already installed, don't force another "apt-get install". That would +# prevent them from being auto-removed, if they ever become eligible for that. +# And as this script only needs the packages once, there is no good reason to +# introduce a hard dependency on things such as dchroot and debootstrap. +dep= +for i in dchroot debootstrap; do + [ -d /usr/share/doc/"$i" ] || dep="$dep $i" +done +[ -n "$dep" ] && sudo apt-get -y install $dep +sudo apt-get -y install schroot + +# Create directory for chroot +sudo mkdir -p /var/lib/chroot + +# Find chroot environments that can be installed with debootstrap +targets="$(cd /usr/share/debootstrap/scripts + ls | grep '^[a-z]*$')" + +# Ask user to pick one of the available targets +echo "The following targets are available to be installed in a chroot:" +j=1; for i in $targets; do + printf '%4d: %s\n' "$j" "$i" + j=$(($j+1)) +done +while :; do + printf "Which target would you like to install: " + read n + [ "$n" -gt 0 -a "$n" -lt "$j" ] >&/dev/null && break +done +j=1; for i in $targets; do + [ "$j" -eq "$n" ] && { distname="$i"; break; } + j=$(($j+1)) +done + +# On x86-64, ask whether the user wants to install x86-32 or x86-64 +archflag= +arch= +if [ "$(uname -m)" = x86_64 ]; then + while :; do + echo "You are running a 64bit kernel. This allows you to install either a" + printf "32bit or a 64bit chroot environment. %s" \ + "Which one do you want (32, 64) " + read arch + [ "${arch}" == 32 -o "${arch}" == 64 ] && break + done + [ "${arch}" == 32 ] && archflag="--arch i386" || archflag="--arch amd64" + arch="${arch}bit" +fi +target="${distname}${arch}" + +# Don't overwrite an existing installation +[ -d /var/lib/chroot/"${target}" ] && { + echo "This chroot already exists on your machine." >&2 + echo "Delete /var/lib/chroot/${target} if you want to start over." >&2 + exit 1 +} +sudo mkdir -p /var/lib/chroot/"${target}" + +# Offer to include additional standard repositories for Ubuntu-based chroots. +alt_repos= +grep ubuntu.com /usr/share/debootstrap/scripts/"${distname}" >&/dev/null && { + while :; do + echo "Would you like to add ${distname}-updates and ${distname}-security " + echo -n "to the chroot's sources.list (y/n)? " + read alt_repos + case "${alt_repos}" in + y|Y) + alt_repos="y" + break + ;; + n|N) + break + ;; + esac + done +} + +# Remove stale entry from /etc/schroot/schroot.conf. Entries start +# with the target name in square brackets, followed by an arbitrary +# number of lines. The entry stops when either the end of file has +# been reached, or when the beginning of a new target is encountered. +# This means, we cannot easily match for a range of lines in +# "sed". Instead, we actually have to iterate over each line and check +# whether it is the beginning of a new entry. +sudo sed -ni '/^[[]'"${target%bit}"']$/,${:1;n;/^[[]/b2;b1;:2;p;n;b2};p' \ + /etc/schroot/schroot.conf + +# Download base system. This takes some time +if [ -z "${mirror}" ]; then + grep ubuntu.com /usr/share/debootstrap/scripts/"${distname}" >&/dev/null && + mirror="http://archive.ubuntu.com/ubuntu" || + mirror="http://ftp.us.debian.org/debian" +fi + sudo debootstrap ${archflag} "${distname}" /var/lib/chroot/"${target}" \ + "$mirror" + +# Add new entry to /etc/schroot/schroot.conf +grep ubuntu.com /usr/share/debootstrap/scripts/"${distname}" >&/dev/null && + brand="Ubuntu" || brand="Debian" +if [ -z "${chroot_groups}" ]; then + chroot_groups="admin,$(id -gn)" +fi +sudo sh -c 'cat >>/etc/schroot/schroot.conf' <<EOF +[${target%bit}] +description=${brand} ${distname} ${arch} +type=directory +directory=/var/lib/chroot/${target} +priority=3 +users=root +groups=${chroot_groups} +root-groups=${chroot_groups} +personality=linux$([ "${arch}" != 64bit ] && echo 32) +script-config=script-${target} + +EOF + +# Set up a special directory that changes contents depending on the target +# that is executing. +sed '/^FSTAB=/s,/mount-defaults",/mount-'"${target}"'",' \ + /etc/schroot/script-defaults | + sudo sh -c 'cat >/etc/schroot/script-'"${target}" +sudo cp /etc/schroot/mount-defaults /etc/schroot/mount-"${target}" +echo "$HOME/chroot/.${target} $HOME/chroot none rw,bind 0 0" | + sudo sh -c 'cat >>/etc/schroot/mount-'"${target}" +mkdir -p "$HOME/chroot/.${target}" + +# Install a helper script to launch commands in the chroot +sudo sh -c 'cat >/usr/local/bin/'"${target%bit}" <<EOF +#!/bin/bash +if [ \$# -eq 0 ]; then + exec schroot -c ${target%bit} -p +else + p="\$1"; shift + exec schroot -c ${target%bit} -p "\$p" -- "\$@" +fi +exit 1 +EOF +sudo chown root:root /usr/local/bin/"${target%bit}" +sudo chmod 755 /usr/local/bin/"${target%bit}" + +# Add the standard Ubuntu update repositories if requested. +[ "${alt_repos}" = "y" -a \ + -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] && +sudo sed -i '/^deb .* [^ -]\+ main$/p + s/^\(deb .* [^ -]\+\) main/\1-security main/ + p + t1 + d + :1;s/-security main/-updates main/ + t + d' "/var/lib/chroot/${target}/etc/apt/sources.list" + +# Add a few more repositories to the chroot +[ "${add_srcs}" = "y" -a \ + -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] && +sudo sed -i 's/ main$/ main restricted universe multiverse/ + p + t1 + d + :1;s/^deb/deb-src/ + t + d' "/var/lib/chroot/${target}/etc/apt/sources.list" + +# Update packages +sudo schroot -c "${target%bit}" -p -- /bin/sh -c ' + apt-get update; apt-get -y dist-upgrade' || : + +# Install a couple of missing packages +for i in debian-keyring ubuntu-keyring locales sudo; do + [ -d "/var/lib/chroot/${target}/usr/share/doc/$i" ] || + sudo schroot -c "${target%bit}" -p -- apt-get -y install "$i" || : +done + +# Configure locales +sudo schroot -c "${target%bit}" -p -- /bin/sh -c ' + l='"${LANG:-en_US}"'; l="${l%%.*}" + [ -r /etc/locale.gen ] && + sed -i "s/^# \($l\)/\1/" /etc/locale.gen + locale-gen $LANG en_US en_US.UTF-8' || : + +# Configure "sudo" package +sudo schroot -c "${target%bit}" -p -- /bin/sh -c ' + egrep '"'^$(id -nu) '"' /etc/sudoers >/dev/null 2>&1 || + echo '"'$(id -nu) ALL=(ALL) ALL'"' >>/etc/sudoers' + +# Install a few more commonly used packages +sudo schroot -c "${target%bit}" -p -- apt-get -y install \ + autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \ + strace + +# If running a 32bit environment on a 64bit machine, install a few binaries +# as 64bit. This is only done automatically if the chroot distro is the same as +# the host, otherwise there might be incompatibilities in build settings or +# runtime dependencies. The user can force it with the '-c' flag. +host_distro=$(grep DISTRIB_CODENAME /etc/lsb-release 2>/dev/null | \ + cut -d "=" -f 2) +if [ "${copy_64}" = "y" -o \ + "${host_distro}" = "${distname}" -a "${arch}" = 32bit ] && \ + file /bin/bash 2>/dev/null | grep -q x86-64; then + readlinepkg=$(sudo schroot -c "${target%bit}" -p -- sh -c \ + 'apt-cache search "lib64readline.\$" | sort | tail -n 1 | cut -d " " -f 1') + sudo schroot -c "${target%bit}" -p -- apt-get -y install \ + lib64expat1 lib64ncurses5 ${readlinepkg} lib64z1 + dep= + for i in binutils gdb strace; do + [ -d /usr/share/doc/"$i" ] || dep="$dep $i" + done + [ -n "$dep" ] && sudo apt-get -y install $dep + sudo cp /usr/bin/gdb "/var/lib/chroot/${target}/usr/local/bin/" + sudo cp /usr/bin/ld "/var/lib/chroot/${target}/usr/local/bin/" + for i in libbfd libpython; do + lib="$({ ldd /usr/bin/ld; ldd /usr/bin/gdb; } | + grep "$i" | awk '{ print $3 }')" + if [ -n "$lib" -a -r "$lib" ]; then + sudo cp "$lib" "/var/lib/chroot/${target}/usr/lib64/" + fi + done + for lib in libssl libcrypt; do + sudo cp /usr/lib/$lib* "/var/lib/chroot/${target}/usr/lib64/" || : + done +fi + +# Clean up package files +sudo schroot -c "${target%bit}" -p -- apt-get clean +sudo apt-get clean + +# Let the user know what we did +trap '' INT TERM QUIT +trap '' EXIT +cat <<EOF + + +Successfully installed ${distname} ${arch} + +You can run programs inside of the chroot by invoking the "${target%bit}" +command. + +Your home directory is shared between the host and the chroot. But I configured +$HOME/chroot to be private to the chroot environment. You can use it +for files that need to differ between environments. +EOF diff --git a/build/internal/README.chromium b/build/internal/README.chromium new file mode 100644 index 0000000..4624830 --- /dev/null +++ b/build/internal/README.chromium @@ -0,0 +1,24 @@ +Internal property sheets: + essential.vsprops + Contains the common settings used throughout the projects. Is included by either ..\debug.vsprops or ..\release.vsprops, so in general, it is not included directly. + + release_defaults.vsprops + Included by ..\release.vsprops. Its settings are overriden by release_impl$(CHROME_BUILD_TYPE).vsprops. Uses the default VS setting which is "Maximize Speed". Results in relatively fast build with reasonable optimization level but without whole program optimization to reduce build time. + + release_impl.vsprops + Included by ..\release.vsprops by default when CHROME_BUILD_TYPE is undefined. Includes release_defaults.vsprops. + + release_impl_checksenabled.vsprops + Included by ..\release.vsprops when CHROME_BUILD_TYPE=_checksenabled. Matches what release_defaults.vsprops does, but doesn't actually inherit from it as we couldn't quite get that working. The only difference is that _DEBUG is set instead of NDEBUG. Used for keeping debug checks enabled with a build that is fast enough to dogfood with. + + release_impl_official.vsprops + Included by ..\release.vsprops when CHROME_BUILD_TYPE=_official. Includes release_defaults.vsprops. Enables Whole Program Optimizations (WPO), which doubles the build time. Results in much more optimized build. Uses "Full Optimization" and "Flavor small code". + + release_impl_pgo_instrument.vsprops + Included by ..\release.vsprops when CHROME_BUILD_TYPE=_pgo_instrument. Includes release_defaults.vsprops. Enables Profile Guided Optimization (PGO) instrumentation (first pass). Uses "Full Optimization" and "Flavor small code". + + release_impl_pgo_optimize.vsprops + Included by ..\release.vsprops when CHROME_BUILD_TYPE=_pgo_optimize. Includes release_defaults.vsprops. Enables Profile Guided Optimization (PGO) optimization (second pass). Uses "Full Optimization" and "Flavor small code". + + release_impl_purify.vsprops + Included by ..\release.vsprops when CHROME_BUILD_TYPE=_purify. Includes release_defaults.vsprops. Disables optimizations. Used with Purify to test without debug tools and without optimization; i.e. NDEBUG is defined but the compiler doesn't optimize the binary. diff --git a/build/internal/release_defaults.gypi b/build/internal/release_defaults.gypi new file mode 100644 index 0000000..1bf6bbe --- /dev/null +++ b/build/internal/release_defaults.gypi @@ -0,0 +1,15 @@ +{ + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '2', + 'StringPooling': 'true', + 'OmitFramePointers': 'true', + }, + 'VCLinkerTool': { + 'LinkIncremental': '1', + 'OptimizeReferences': '2', + 'EnableCOMDATFolding': '2', + 'OptimizeForWindows98': '1', + }, + }, +} diff --git a/build/internal/release_impl.gypi b/build/internal/release_impl.gypi new file mode 100644 index 0000000..aff06dc --- /dev/null +++ b/build/internal/release_impl.gypi @@ -0,0 +1,3 @@ +{ + 'includes': ['release_defaults.gypi'], +} diff --git a/build/internal/release_impl_official.gypi b/build/internal/release_impl_official.gypi new file mode 100644 index 0000000..18f7928 --- /dev/null +++ b/build/internal/release_impl_official.gypi @@ -0,0 +1,21 @@ +{ + 'includes': ['release_defaults.gypi'], + 'defines': ['OFFICIAL_BUILD'], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '3', + 'InlineFunctionExpansion': '2', + 'EnableIntrinsicFunctions': 'true', + 'FavorSizeOrSpeed': '2', + 'OmitFramePointers': 'true', + 'EnableFiberSafeOptimizations': 'true', + 'WholeProgramOptimization': 'true', + }, + 'VCLibrarianTool': { + 'AdditionalOptions': ['/ltcg', '/expectedoutputsize:120000000'], + }, + 'VCLinkerTool': { + 'LinkTimeCodeGeneration': '1', + }, + }, +} diff --git a/build/linux/chrome_linux.croc b/build/linux/chrome_linux.croc new file mode 100644 index 0000000..f400306 --- /dev/null +++ b/build/linux/chrome_linux.croc @@ -0,0 +1,29 @@ +# -*- python -*- +# Crocodile config file for Chromium linux + +# TODO(jhawkins): We'll need to add a chromeos.croc once we get a coverage bot +# for that platform. + +{ + # List of rules, applied in order + 'rules' : [ + # Specify inclusions before exclusions, since rules are in order. + + # Don't include non-Linux platform dirs + { + 'regexp' : '.*/(chromeos|views)/', + 'include' : 0, + }, + # Don't include chromeos, windows, or mac specific files + { + 'regexp' : '.*(_|/)(chromeos|mac|win|views)(\\.|_)', + 'include' : 0, + }, + + # Groups + { + 'regexp' : '.*_test_linux\\.', + 'group' : 'test', + }, + ], +} diff --git a/build/linux/dump_app_syms b/build/linux/dump_app_syms new file mode 100755 index 0000000..632bcc7 --- /dev/null +++ b/build/linux/dump_app_syms @@ -0,0 +1,36 @@ +#!/bin/sh + +# Copyright (c) 2010 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. +# +# Helper script to run dump_syms on Chrome Linux executables and strip +# them if needed. + +set -e + +usage() { + echo -n "$0 <dump_syms_exe> <strip_binary> " >&2 + echo "<binary_with_symbols> <symbols_output>" >&2 +} + + +if [ $# -ne 4 ]; then + usage + exit 1 +fi + +SCRIPTDIR="$(readlink -f "$(dirname "$0")")" +DUMPSYMS="$1" +STRIP_BINARY="$2" +INFILE="$3" +OUTFILE="$4" + +# Dump the symbols from the given binary. +if [ ! -e "$OUTFILE" -o "$INFILE" -nt "$OUTFILE" ]; then + "$DUMPSYMS" "$INFILE" > "$OUTFILE" +fi + +if [ "$STRIP_BINARY" != "0" ]; then + strip "$INFILE" +fi diff --git a/build/linux/pkg-config-wrapper b/build/linux/pkg-config-wrapper new file mode 100755 index 0000000..4b5455b --- /dev/null +++ b/build/linux/pkg-config-wrapper @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright (c) 2010 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. + +# This program wraps around pkg-config to generate the correct include and +# library paths when cross-compiling using a sysroot. +# The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig +# and usr/share/pkgconfig (relative to the sysroot) and that they output paths +# relative to some parent path of the sysroot. +# This assumption is valid for a range of sysroots, in particular: a +# LSB-compliant root filesystem mounted at the sysroot, and a board build +# directory of a Chromium OS chroot. + +root="$1" +if [ -z "$root" ] +then + echo "usage: $0 /path/to/sysroot [pkg-config-arguments] package" >&2 + exit 1 +fi + +rewrite=`dirname $0`/rewrite_dirs.py +package=${!#} + +shift +config_path=$root/usr/lib/pkgconfig:$root/usr/share/pkgconfig +set -e +# Some sysroots, like the Chromium OS ones, may generate paths that are not +# relative to the sysroot. For example, +# /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths +# relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of +# relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). +# To support this correctly, it's necessary to extract the prefix to strip from +# pkg-config's |prefix| variable. +prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | sed -e 's|/usr$||'` +result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"` +echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix" diff --git a/build/linux/python_arch.sh b/build/linux/python_arch.sh new file mode 100755 index 0000000..01e41d0 --- /dev/null +++ b/build/linux/python_arch.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright (c) 2011 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. + +# This figures out the architecture of the version of Python we are building +# pyautolib against. +# +# python_arch.sh /usr/lib/libpython2.5.so.1.0 +# python_arch.sh /path/to/sysroot/usr/lib/libpython2.4.so.1.0 +# + +python=$(readlink -f "$1") +if [ ! -r "$python" ]; then + echo unknown + exit 0 +fi +file_out=$(file "$python") +if [ $? -ne 0 ]; then + echo unknown + exit 0 +fi + +echo $file_out | grep -qs "ARM" +if [ $? -eq 0 ]; then + echo arm + exit 0 +fi + +echo $file_out | grep -qs "x86-64" +if [ $? -eq 0 ]; then + echo x64 + exit 0 +fi + +echo $file_out | grep -qs "Intel 80386" +if [ $? -eq 0 ]; then + echo ia32 + exit 0 +fi + +exit 1 diff --git a/build/linux/rewrite_dirs.py b/build/linux/rewrite_dirs.py new file mode 100755 index 0000000..9e166d0 --- /dev/null +++ b/build/linux/rewrite_dirs.py @@ -0,0 +1,68 @@ +#!/usr/bin/python +# Copyright (c) 2009 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. + +"""Rewrites paths in -I, -L and other option to be relative to a sysroot.""" + +import sys +import os +import optparse + +REWRITE_PREFIX = ['-I', + '-idirafter', + '-imacros', + '-imultilib', + '-include', + '-iprefix', + '-iquote', + '-isystem', + '-L'] + +def RewritePath(path, opts): + """Rewrites a path by stripping the prefix and prepending the sysroot.""" + sysroot = opts.sysroot + prefix = opts.strip_prefix + if os.path.isabs(path) and not path.startswith(sysroot): + if path.startswith(prefix): + path = path[len(prefix):] + path = path.lstrip('/') + return os.path.join(sysroot, path) + else: + return path + +def RewriteLine(line, opts): + """Rewrites all the paths in recognized options.""" + args = line.split() + count = len(args) + i = 0 + while i < count: + for prefix in REWRITE_PREFIX: + # The option can be either in the form "-I /path/to/dir" or + # "-I/path/to/dir" so handle both. + if args[i] == prefix: + i += 1 + try: + args[i] = RewritePath(args[i], opts) + except IndexError: + sys.stderr.write('Missing argument following %s\n' % prefix) + break + elif args[i].startswith(prefix): + args[i] = prefix + RewritePath(args[i][len(prefix):], opts) + i += 1 + + return ' '.join(args) + +def main(argv): + parser = optparse.OptionParser() + parser.add_option('-s', '--sysroot', default='/', help='sysroot to prepend') + parser.add_option('-p', '--strip-prefix', default='', help='prefix to strip') + opts, args = parser.parse_args(argv[1:]) + + for line in sys.stdin.readlines(): + line = RewriteLine(line.strip(), opts) + print line + return 0 + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/build/linux/system.gyp b/build/linux/system.gyp new file mode 100644 index 0000000..a52083b --- /dev/null +++ b/build/linux/system.gyp @@ -0,0 +1,380 @@ +# Copyright (c) 2009 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. + +{ + 'conditions': [ + ['sysroot!=""', { + 'variables': { + 'pkg-config': './pkg-config-wrapper "<(sysroot)"', + }, + }, { + 'variables': { + 'pkg-config': 'pkg-config' + }, + }], + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'variables': { + # We use our own copy of libssl3, although we still need to link against + # the rest of NSS. + 'use_system_ssl%': 0, + }, + }, { # OS!="linux" + 'variables': { + 'use_system_ssl%': 1, + }, + }], + ], + + + 'targets': [ + { + 'target_name': 'gtk', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other gtk+-2.0 gthread-2.0)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l gtk+-2.0 gthread-2.0)', + ], + }, + }], + [ 'chromeos==1', { + 'link_settings': { + 'libraries': [ '-lXtst' ] + } + }]] + }, + { + 'target_name': 'gtkprint', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags gtk+-unix-print-2.0)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other gtk+-unix-print-2.0)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l gtk+-unix-print-2.0)', + ], + }, + }]] + }, + { + 'target_name': 'nss', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'conditions': [ + ['use_system_ssl==0', { + 'dependencies': [ + '../../net/third_party/nss/ssl.gyp:ssl', + '../../third_party/zlib/zlib.gyp:zlib', + ], + 'direct_dependent_settings': { + 'cflags': [ + # We need for our local copies of the libssl3 headers to come + # first, otherwise the code will build, but will fallback to + # the set of features advertised in the system headers. + # Unfortunately, there's no include path that we can filter + # out of $(pkg-config --cflags nss) and GYP include paths + # come after cflags on the command line. So we have these + # bodges: + '-Inet/third_party/nss/ssl', # for make + '-ISource/WebKit/chromium/net/third_party/nss/ssl', # for make in webkit + '<!@(<(pkg-config) --cflags nss)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other nss)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l nss | sed -e "s/-lssl3//")', + ], + }, + }, { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags nss)', + ], + 'defines': [ + 'USE_SYSTEM_SSL', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other nss)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l nss)', + ], + }, + } + ]] + }], + ], + }, + { + 'target_name': 'freetype2', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags freetype2)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other freetype2)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l freetype2)', + ], + }, + }]] + }, + { + 'target_name': 'fontconfig', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags fontconfig)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other fontconfig)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l fontconfig)', + ], + }, + }]] + }, + { + 'target_name': 'gdk', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags gdk-2.0)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other gdk-2.0)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l gdk-2.0)', + ], + }, + }]] + }, + { + 'target_name': 'gconf', + 'type': 'settings', + 'conditions': [ + ['use_gconf==1 and _toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags gconf-2.0)', + ], + 'defines': [ + 'USE_GCONF', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l gconf-2.0)', + ], + }, + }]] + }, + { + 'target_name': 'x11', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags x11)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other x11)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l x11)', + ], + }, + }], + # When XInput2 is available (i.e. inputproto version is 2.0), the + # pkg-config command will succeed, so the output will be empty. + ['"<!@(<(pkg-config) --atleast-version=2.0 inputproto || echo $?)"==""', { + 'direct_dependent_settings': { + 'defines': [ + 'HAVE_XINPUT2', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other xi)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l xi)', + ], + } + }], + ], + }, + { + 'target_name': 'xext', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags xext)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other xext)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l xext)', + ], + }, + }]] + }, + { + 'target_name': 'selinux', + 'type': 'settings', + 'conditions': [ + ['_toolset=="target"', { + 'link_settings': { + 'libraries': [ + '-lselinux', + ], + }, + }]] + }, + { + 'target_name': 'gnome-keyring', + 'type': 'settings', + 'conditions': [ + ['use_gnome_keyring==1', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags gnome-keyring-1)', + ], + 'defines': [ + 'USE_GNOME_KEYRING', + ], + 'conditions': [ + ['linux_link_gnome_keyring==0', { + 'defines': ['DLOPEN_GNOME_KEYRING'], + }], + ], + }, + 'conditions': [ + ['linux_link_gnome_keyring!=0', { + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other gnome-keyring-1)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l gnome-keyring-1)', + ], + }, + }, { + 'link_settings': { + 'libraries': [ + '-ldl', + ], + }, + }], + ], + }], + ], + }, + { + 'target_name': 'dbus-glib', + 'type': 'settings', + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags dbus-glib-1)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other dbus-glib-1)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l dbus-glib-1)', + ], + }, + }, + { + 'target_name': 'libresolv', + 'type': 'settings', + 'link_settings': { + 'libraries': [ + '-lresolv', + ], + }, + }, + { + 'target_name': 'ibus', + 'type': 'settings', + 'conditions': [ + ['"<!@(<(pkg-config) --atleast-version=1.3.99 ibus-1.0 || echo $?)"==""', { + 'variables': { + 'ibus': 1 + }, + 'direct_dependent_settings': { + 'cflags': [ + '<!@(<(pkg-config) --cflags ibus-1.0)', + ], + }, + 'link_settings': { + 'ldflags': [ + '<!@(<(pkg-config) --libs-only-L --libs-only-other ibus-1.0)', + ], + 'libraries': [ + '<!@(<(pkg-config) --libs-only-l ibus-1.0)', + ], + }, + }], + ], + }, + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/mac/chrome_mac.croc b/build/mac/chrome_mac.croc new file mode 100644 index 0000000..8cde00c --- /dev/null +++ b/build/mac/chrome_mac.croc @@ -0,0 +1,36 @@ +# -*- python -*- +# Crocodile config file for Chromium mac + +{ + # List of rules, applied in order + 'rules' : [ + # Specify inclusions before exclusions, since rules are in order. + + # Don't include chromeos, linux, or windows specific files + { + 'regexp' : '.*(_|/)(chromeos|linux|win|views)(\\.|_)', + 'include' : 0, + }, + # Don't include ChromeOS dirs + { + 'regexp' : '.*/chromeos/', + 'include' : 0, + }, + + # Groups + { + 'regexp' : '.*_test_mac\\.', + 'group' : 'test', + }, + + # Languages + { + 'regexp' : '.*\\.m$', + 'language' : 'ObjC', + }, + { + 'regexp' : '.*\\.mm$', + 'language' : 'ObjC++', + }, + ], +} diff --git a/build/mac/strip_from_xcode b/build/mac/strip_from_xcode new file mode 100755 index 0000000..c26b9fb --- /dev/null +++ b/build/mac/strip_from_xcode @@ -0,0 +1,62 @@ +#!/bin/bash + +# Copyright (c) 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. + +# This is a handy wrapper script that figures out how to call the strip +# utility (strip_save_dsym in this case), if it even needs to be called at all, +# and then does it. This script should be called by a post-link phase in +# targets that might generate Mach-O executables, dynamic libraries, or +# loadable bundles. +# +# An example "Strip If Needed" build phase placed after "Link Binary With +# Libraries" would do: +# exec "${XCODEPROJ_DEPTH}/build/mac/strip_from_xcode" + +if [ "${CONFIGURATION}" != "Release" ] ; then + # Only strip in release mode. + exit 0 +fi + +declare -a FLAGS + +# MACH_O_TYPE is not set for a command-line tool, so check PRODUCT_TYPE too. +# Weird. +if [ "${MACH_O_TYPE}" = "mh_execute" ] || \ + [ "${PRODUCT_TYPE}" = "com.apple.product-type.tool" ] ; then + # Strip everything (no special flags). No-op. + true +elif [ "${MACH_O_TYPE}" = "mh_dylib" ] || \ + [ "${MACH_O_TYPE}" = "mh_bundle" ]; then + # Strip debugging symbols and local symbols + FLAGS[${#FLAGS[@]}]=-S + FLAGS[${#FLAGS[@]}]=-x +elif [ "${MACH_O_TYPE}" = "staticlib" ] ; then + # Don't strip static libraries. + exit 0 +else + # Warn, but don't treat this as an error. + echo $0: warning: unrecognized MACH_O_TYPE ${MACH_O_TYPE} + exit 0 +fi + +if [ -n "${STRIPFLAGS}" ] ; then + # Pick up the standard STRIPFLAGS Xcode setting, used for "Additional Strip + # Flags". + for stripflag in "${STRIPFLAGS}" ; do + FLAGS[${#FLAGS[@]}]="${stripflag}" + done +fi + +if [ -n "${CHROMIUM_STRIP_SAVE_FILE}" ] ; then + # An Xcode project can communicate a file listing symbols to saved in this + # environment variable by setting it as a build setting. This isn't a + # standard Xcode setting. It's used in preference to STRIPFLAGS to + # eliminate quoting ambiguity concerns. + FLAGS[${#FLAGS[@]}]=-s + FLAGS[${#FLAGS[@]}]="${CHROMIUM_STRIP_SAVE_FILE}" +fi + +exec "$(dirname ${0})/strip_save_dsym" "${FLAGS[@]}" \ + "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" diff --git a/build/mac/strip_save_dsym b/build/mac/strip_save_dsym new file mode 100755 index 0000000..d99ee2e --- /dev/null +++ b/build/mac/strip_save_dsym @@ -0,0 +1,343 @@ +#!/usr/bin/python + +# Copyright (c) 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. + +# Usage: strip_save_dsym <whatever-arguments-you-would-pass-to-strip> +# +# strip_save_dsym is a wrapper around the standard strip utility. Given an +# input Mach-O file, strip_save_dsym will save a copy of the file in a "fake" +# .dSYM bundle for debugging, and then call strip to strip the Mach-O file. +# Note that the .dSYM file is a "fake" in that it's not a self-contained +# .dSYM bundle, it just contains a copy of the original (unstripped) Mach-O +# file, and therefore contains references to object files on the filesystem. +# The generated .dSYM bundle is therefore unsuitable for debugging in the +# absence of these .o files. +# +# If a .dSYM already exists and has a newer timestamp than the Mach-O file, +# this utility does nothing. That allows strip_save_dsym to be run on a file +# that has already been stripped without trashing the .dSYM. +# +# Rationale: the "right" way to generate dSYM bundles, dsymutil, is incredibly +# slow. On the other hand, doing a file copy (which is really all that +# dsymutil does) is comparatively fast. Since we usually just want to strip +# a release-mode executable but still be able to debug it, and we don't care +# so much about generating a hermetic dSYM bundle, we'll prefer the file copy. +# If a real dSYM is ever needed, it's still possible to create one by running +# dsymutil and pointing it at the original Mach-O file inside the "fake" +# bundle, provided that the object files are available. + +import errno +import os +import re +import shutil +import subprocess +import sys +import time + +# Returns a list of architectures contained in a Mach-O file. The file can be +# a universal (fat) file, in which case there will be one list element for +# each contained architecture, or it can be a thin single-architecture Mach-O +# file, in which case the list will contain a single element identifying the +# architecture. On error, returns an empty list. Determines the architecture +# list by calling file. +def macho_archs(macho): + macho_types = ["executable", + "dynamically linked shared library", + "bundle"] + macho_types_re = "Mach-O (?:64-bit )?(?:" + "|".join(macho_types) + ")" + + file_cmd = subprocess.Popen(["/usr/bin/file", "-b", "--", macho], + stdout=subprocess.PIPE) + + archs = [] + + type_line = file_cmd.stdout.readline() + type_match = re.match("^%s (.*)$" % macho_types_re, type_line) + if type_match: + archs.append(type_match.group(1)) + return [type_match.group(1)] + else: + type_match = re.match("^Mach-O universal binary with (.*) architectures$", + type_line) + if type_match: + for i in range(0, int(type_match.group(1))): + arch_line = file_cmd.stdout.readline() + arch_match = re.match( + "^.* \(for architecture (.*)\):\t%s .*$" % macho_types_re, + arch_line) + if arch_match: + archs.append(arch_match.group(1)) + + if file_cmd.wait() != 0: + archs = [] + + if len(archs) == 0: + print >> sys.stderr, "No architectures in %s" % macho + + return archs + +# Returns a dictionary mapping architectures contained in the file as returned +# by macho_archs to the LC_UUID load command for that architecture. +# Architectures with no LC_UUID load command are omitted from the dictionary. +# Determines the UUID value by calling otool. +def macho_uuids(macho): + uuids = {} + + archs = macho_archs(macho) + if len(archs) == 0: + return uuids + + for arch in archs: + if arch == "": + continue + + otool_cmd = subprocess.Popen(["/usr/bin/otool", "-arch", arch, "-l", "-", + macho], + stdout=subprocess.PIPE) + # state 0 is when nothing UUID-related has been seen yet. State 1 is + # entered after a load command begins, but it may not be an LC_UUID load + # command. States 2, 3, and 4 are intermediate states while reading an + # LC_UUID command. State 5 is the terminal state for a successful LC_UUID + # read. State 6 is the error state. + state = 0 + uuid = "" + for otool_line in otool_cmd.stdout: + if state == 0: + if re.match("^Load command .*$", otool_line): + state = 1 + elif state == 1: + if re.match("^ cmd LC_UUID$", otool_line): + state = 2 + else: + state = 0 + elif state == 2: + if re.match("^ cmdsize 24$", otool_line): + state = 3 + else: + state = 6 + elif state == 3: + # The UUID display format changed in the version of otool shipping + # with the Xcode 3.2.2 prerelease. The new format is traditional: + # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 + # and with Xcode 3.2.6, then line is indented one more space: + # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 + # The old format, from cctools-750 and older's otool, breaks the UUID + # up into a sequence of bytes: + # uuid 0x4d 0x71 0x35 0xb2 0x9c 0x56 0xc5 0xf5 + # 0x5f 0x49 0xa9 0x94 0x25 0x8e 0x09 0x55 + new_uuid_match = re.match("^ {3,4}uuid (.{8}-.{4}-.{4}-.{4}-.{12})$", + otool_line) + if new_uuid_match: + uuid = new_uuid_match.group(1) + + # Skip state 4, there is no second line to read. + state = 5 + else: + old_uuid_match = re.match("^ uuid 0x(..) 0x(..) 0x(..) 0x(..) " + "0x(..) 0x(..) 0x(..) 0x(..)$", + otool_line) + if old_uuid_match: + state = 4 + uuid = old_uuid_match.group(1) + old_uuid_match.group(2) + \ + old_uuid_match.group(3) + old_uuid_match.group(4) + "-" + \ + old_uuid_match.group(5) + old_uuid_match.group(6) + "-" + \ + old_uuid_match.group(7) + old_uuid_match.group(8) + "-" + else: + state = 6 + elif state == 4: + old_uuid_match = re.match("^ 0x(..) 0x(..) 0x(..) 0x(..) " + "0x(..) 0x(..) 0x(..) 0x(..)$", + otool_line) + if old_uuid_match: + state = 5 + uuid += old_uuid_match.group(1) + old_uuid_match.group(2) + "-" + \ + old_uuid_match.group(3) + old_uuid_match.group(4) + \ + old_uuid_match.group(5) + old_uuid_match.group(6) + \ + old_uuid_match.group(7) + old_uuid_match.group(8) + else: + state = 6 + + if otool_cmd.wait() != 0: + state = 6 + + if state == 5: + uuids[arch] = uuid.upper() + + if len(uuids) == 0: + print >> sys.stderr, "No UUIDs in %s" % macho + + return uuids + +# Given a path to a Mach-O file and possible information from the environment, +# determines the desired path to the .dSYM. +def dsym_path(macho): + # If building a bundle, the .dSYM should be placed next to the bundle. Use + # WRAPPER_NAME to make this determination. If called from xcodebuild, + # WRAPPER_NAME will be set to the name of the bundle. + dsym = "" + if "WRAPPER_NAME" in os.environ: + if "BUILT_PRODUCTS_DIR" in os.environ: + dsym = os.path.join(os.environ["BUILT_PRODUCTS_DIR"], + os.environ["WRAPPER_NAME"]) + else: + dsym = os.environ["WRAPPER_NAME"] + else: + dsym = macho + + dsym += ".dSYM" + + return dsym + +# Creates a fake .dSYM bundle at dsym for macho, a Mach-O image with the +# architectures and UUIDs specified by the uuids map. +def make_fake_dsym(macho, dsym): + uuids = macho_uuids(macho) + if len(uuids) == 0: + return False + + dwarf_dir = os.path.join(dsym, "Contents", "Resources", "DWARF") + dwarf_file = os.path.join(dwarf_dir, os.path.basename(macho)) + try: + os.makedirs(dwarf_dir) + except OSError, (err, error_string): + if err != errno.EEXIST: + raise + shutil.copyfile(macho, dwarf_file) + + # info_template is the same as what dsymutil would have written, with the + # addition of the fake_dsym key. + info_template = \ +'''<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>com.apple.xcode.dsym.%(root_name)s</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>dSYM</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>dSYM_UUID</key> + <dict> +%(uuid_dict)s </dict> + <key>fake_dsym</key> + <true/> + </dict> +</plist> +''' + + root_name = os.path.basename(dsym)[:-5] # whatever.dSYM without .dSYM + uuid_dict = "" + for arch in sorted(uuids): + uuid_dict += "\t\t\t<key>" + arch + "</key>\n"\ + "\t\t\t<string>" + uuids[arch] + "</string>\n" + info_dict = { + "root_name": root_name, + "uuid_dict": uuid_dict, + } + info_contents = info_template % info_dict + info_file = os.path.join(dsym, "Contents", "Info.plist") + info_fd = open(info_file, "w") + info_fd.write(info_contents) + info_fd.close() + + return True + +# For a Mach-O file, determines where the .dSYM bundle should be located. If +# the bundle does not exist or has a modification time older than the Mach-O +# file, calls make_fake_dsym to create a fake .dSYM bundle there, then strips +# the Mach-O file and sets the modification time on the .dSYM bundle and Mach-O +# file to be identical. +def strip_and_make_fake_dsym(macho): + dsym = dsym_path(macho) + macho_stat = os.stat(macho) + dsym_stat = None + try: + dsym_stat = os.stat(dsym) + except OSError, (err, error_string): + if err != errno.ENOENT: + raise + + if dsym_stat is None or dsym_stat.st_mtime < macho_stat.st_mtime: + # Make a .dSYM bundle + if not make_fake_dsym(macho, dsym): + return False + + # Strip the Mach-O file + remove_dsym = True + try: + strip_path = "" + if "SYSTEM_DEVELOPER_BIN_DIR" in os.environ: + strip_path = os.environ["SYSTEM_DEVELOPER_BIN_DIR"] + else: + strip_path = "/usr/bin" + strip_path = os.path.join(strip_path, "strip") + strip_cmdline = [strip_path] + sys.argv[1:] + # Print the strip invocation so that it's obvious something is happening + print " ".join(strip_cmdline) + strip_cmd = subprocess.Popen(strip_cmdline) + if strip_cmd.wait() == 0: + remove_dsym = False + finally: + if remove_dsym: + shutil.rmtree(dsym) + + # Update modification time on the Mach-O file and .dSYM bundle + now = time.time() + os.utime(macho, (now, now)) + os.utime(dsym, (now, now)) + + return True + +def main(argv=None): + if argv is None: + argv = sys.argv + + # This only supports operating on one file at a time. Look at the arguments + # to strip to figure out what the source to be stripped is. Arguments are + # processed in the same way that strip does, although to reduce complexity, + # this doesn't do all of the same checking as strip. For example, strip + # has no -Z switch and would treat -Z on the command line as an error. For + # the purposes this is needed for, that's fine. + macho = None + process_switches = True + ignore_argument = False + for arg in argv[1:]: + if ignore_argument: + ignore_argument = False + continue + if process_switches: + if arg == "-": + process_switches = False + # strip has these switches accept an argument: + if arg in ["-s", "-R", "-d", "-o", "-arch"]: + ignore_argument = True + if arg[0] == "-": + continue + if macho is None: + macho = arg + else: + print >> sys.stderr, "Too many things to strip" + return 1 + + if macho is None: + print >> sys.stderr, "Nothing to strip" + return 1 + + if not strip_and_make_fake_dsym(macho): + return 1 + + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/build/output_dll_copy.rules b/build/output_dll_copy.rules new file mode 100644 index 0000000..c6e9051 --- /dev/null +++ b/build/output_dll_copy.rules @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="Output DLL copy" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="Output DLL copy" + CommandLine="xcopy /R /C /Y $(InputPath) $(OutDir)" + Outputs="$(OutDir)\$(InputFileName)" + FileExtensions="*.dll" + > + <Properties> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> diff --git a/build/release.gypi b/build/release.gypi new file mode 100644 index 0000000..c12526b --- /dev/null +++ b/build/release.gypi @@ -0,0 +1,19 @@ +{ + 'conditions': [ + # Handle build types. + ['buildtype=="Dev"', { + 'includes': ['internal/release_impl.gypi'], + }], + ['buildtype=="Official"', { + 'includes': ['internal/release_impl_official.gypi'], + }], + # TODO(bradnelson): may also need: + # checksenabled + # coverage + # dom_stats + # pgo_instrument + # pgo_optimize + # purify + ], +} + diff --git a/build/sanitize-mac-build-log.sed b/build/sanitize-mac-build-log.sed new file mode 100644 index 0000000..2de72bf --- /dev/null +++ b/build/sanitize-mac-build-log.sed @@ -0,0 +1,32 @@ +#!/bin/echo Use sanitize-mac-build-log.sh or sed -f + +# Copyright (c) 2011 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. + +# Use this sed script to reduce a Mac build log into something readable. + +# Drop uninformative lines. +/^distcc/d +/^Check dependencies/d +/^ setenv /d +/^ cd /d +/^make: Nothing to be done/d +/^$/d + +# Xcode prints a short "compiling foobar.o" line followed by the lengthy +# full command line. These deletions drop the command line. +\|^ /Developer/usr/bin/|d +\|^ /Developer/Library/PrivateFrameworks/DevToolsCore.framework/|d +\|^ /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/|d + +# And, if you've overridden something from your own bin directory, remove those +# full command lines, too. +\|^ /Users/[^/]*/bin/|d + +# There's already a nice note for bindings, don't need the command line. +\|^python scripts/rule_binding.py|d + +# Shorten the "compiling foobar.o" line. +s|^Distributed-CompileC \(.*\) normal i386 c++ com.apple.compilers.gcc.4_2| CC \1| +s|^CompileC \(.*\) normal i386 c++ com.apple.compilers.gcc.4_2| CC \1| diff --git a/build/sanitize-mac-build-log.sh b/build/sanitize-mac-build-log.sh new file mode 100755 index 0000000..dc743fa --- /dev/null +++ b/build/sanitize-mac-build-log.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Copyright (c) 2010 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. +sed -f `dirname "${0}"`/`basename "${0}" sh`sed + diff --git a/build/sanitize-win-build-log.sed b/build/sanitize-win-build-log.sed new file mode 100644 index 0000000..d6d049c --- /dev/null +++ b/build/sanitize-win-build-log.sed @@ -0,0 +1,14 @@ +#!/bin/echo Use sanitize-win-build-log.sh or sed -f + +# Copyright (c) 2010 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. + +# Use this sed script to reduce a Windows build log into something +# machine-parsable. + +# Drop uninformative lines. +/The operation completed successfully./d + +# Drop parallelization indicators on lines. +s/^[0-9]\+>// diff --git a/build/sanitize-win-build-log.sh b/build/sanitize-win-build-log.sh new file mode 100755 index 0000000..dc743fa --- /dev/null +++ b/build/sanitize-win-build-log.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Copyright (c) 2010 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. +sed -f `dirname "${0}"`/`basename "${0}" sh`sed + diff --git a/build/temp_gyp/README.chromium b/build/temp_gyp/README.chromium new file mode 100644 index 0000000..8045d61 --- /dev/null +++ b/build/temp_gyp/README.chromium @@ -0,0 +1,3 @@ +This directory will be removed once the files in it are committed upstream and +Chromium imports an upstream revision with these files. Contact mark for +details. diff --git a/build/temp_gyp/googleurl.gyp b/build/temp_gyp/googleurl.gyp new file mode 100644 index 0000000..8bf7cce --- /dev/null +++ b/build/temp_gyp/googleurl.gyp @@ -0,0 +1,116 @@ +# Copyright (c) 2009 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. + +# TODO(mark): Upstream this file to googleurl. +{ + 'variables': { + 'chromium_code': 1, + }, + 'targets': [ + { + 'target_name': 'googleurl', + 'type': '<(component)', + 'msvs_guid': 'EF5E94AB-B646-4E5B-A058-52EF07B8351C', + 'dependencies': [ + '../../base/base.gyp:base', + '../../third_party/icu/icu.gyp:icudata', + '../../third_party/icu/icu.gyp:icui18n', + '../../third_party/icu/icu.gyp:icuuc', + ], + 'sources': [ + '../../googleurl/src/gurl.cc', + '../../googleurl/src/gurl.h', + '../../googleurl/src/url_canon.h', + '../../googleurl/src/url_canon_etc.cc', + '../../googleurl/src/url_canon_fileurl.cc', + '../../googleurl/src/url_canon_host.cc', + '../../googleurl/src/url_canon_icu.cc', + '../../googleurl/src/url_canon_icu.h', + '../../googleurl/src/url_canon_internal.cc', + '../../googleurl/src/url_canon_internal.h', + '../../googleurl/src/url_canon_internal_file.h', + '../../googleurl/src/url_canon_ip.cc', + '../../googleurl/src/url_canon_ip.h', + '../../googleurl/src/url_canon_mailtourl.cc', + '../../googleurl/src/url_canon_path.cc', + '../../googleurl/src/url_canon_pathurl.cc', + '../../googleurl/src/url_canon_query.cc', + '../../googleurl/src/url_canon_relative.cc', + '../../googleurl/src/url_canon_stdstring.h', + '../../googleurl/src/url_canon_stdurl.cc', + '../../googleurl/src/url_file.h', + '../../googleurl/src/url_parse.cc', + '../../googleurl/src/url_parse.h', + '../../googleurl/src/url_parse_file.cc', + '../../googleurl/src/url_parse_internal.h', + '../../googleurl/src/url_util.cc', + '../../googleurl/src/url_util.h', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../..', + ], + }, + 'conditions': [ + ['OS=="win" and component=="shared_library"', { + 'defines': [ + 'GURL_DLL', + 'GURL_IMPLEMENTATION=1', + ], + 'direct_dependent_settings': { + 'defines': [ + 'GURL_DLL', + ], + }, + }], + ], + }, + { + 'target_name': 'googleurl_unittests', + 'dependencies': [ + 'googleurl', + '../../base/base.gyp:base_i18n', + '../../base/base.gyp:test_support_base', + '../../testing/gtest.gyp:gtest', + '../../third_party/icu/icu.gyp:icuuc', + ], + 'sources': [ + '../../googleurl/src/gurl_unittest.cc', + '../../googleurl/src/url_canon_unittest.cc', + '../../googleurl/src/url_parse_unittest.cc', + '../../googleurl/src/url_test_utils.h', + '../../googleurl/src/url_util_unittest.cc', + # Make sure base and ICU are started up the 'Chromium way' since the + # build is using the Chromium base & ICU. + '../../base/test/run_all_unittests.cc', + ], + 'conditions': [ + ['OS=="linux" or OS=="freebsd"', { + 'conditions': [ + ['linux_use_tcmalloc==1', { + 'dependencies': [ + '../../base/allocator/allocator.gyp:allocator', + ], + }], + ], + }], + # TODO(victorw): The unittest code uses inline functions that access + # global variables, it also uses internal functions that we may not want + # to export, so skip building unittests for windows multi dll build. + # The googleurl functions are tested by the static library build. + ['OS=="win" and component=="shared_library"', { + 'type': 'none', + }, { + 'type': 'executable', + }], + ], + }, + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/temp_gyp/pdfsqueeze.gyp b/build/temp_gyp/pdfsqueeze.gyp new file mode 100644 index 0000000..d7a742c --- /dev/null +++ b/build/temp_gyp/pdfsqueeze.gyp @@ -0,0 +1,46 @@ +# Copyright (c) 2009 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. + +{ + 'targets': [ + { + 'target_name': 'pdfsqueeze', + 'type': 'executable', + 'sources': [ + '../../third_party/pdfsqueeze/pdfsqueeze.m', + ], + 'defines': [ + # Use defines to map the full path names that will be used for + # the vars into the short forms expected by pdfsqueeze.m. + '______third_party_pdfsqueeze_ApplyGenericRGB_qfilter=ApplyGenericRGB_qfilter', + '______third_party_pdfsqueeze_ApplyGenericRGB_qfilter_len=ApplyGenericRGB_qfilter_len', + ], + 'include_dirs': [ + '<(INTERMEDIATE_DIR)', + ], + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', + '$(SDKROOT)/System/Library/Frameworks/Quartz.framework', + ], + 'actions': [ + { + 'action_name': 'Generate inline filter data', + 'inputs': [ + '../../third_party/pdfsqueeze/ApplyGenericRGB.qfilter', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/ApplyGenericRGB.h', + ], + 'action': ['xxd', '-i', '<@(_inputs)', '<@(_outputs)'], + }, + ], + }, + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/util/build_util.gyp b/build/util/build_util.gyp new file mode 100644 index 0000000..a909177 --- /dev/null +++ b/build/util/build_util.gyp @@ -0,0 +1,43 @@ +# Copyright (c) 2009 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. + +{ + 'targets': [ + { + 'target_name': 'lastchange', + 'type': 'none', + 'variables': { + 'lastchange_out_path': '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE', + 'default_lastchange_path': '../LASTCHANGE.in', + }, + 'actions': [ + { + 'action_name': 'lastchange', + 'inputs': [ + # Note: <(default_lastchange_path) is optional, + # so it doesn't show up in inputs. + './lastchange.py', + ], + 'outputs': [ + '<(lastchange_out_path).always', + '<(lastchange_out_path)', + ], + 'action': [ + 'python', '<@(_inputs)', + '-o', '<(lastchange_out_path)', + '-d', '<(default_lastchange_path)', + ], + 'message': 'Extracting last change to <(lastchange_out_path)', + 'process_outputs_as_sources': '1', + }, + ], + }, + ] +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/build/util/lastchange.py b/build/util/lastchange.py new file mode 100755 index 0000000..4d7a1fe --- /dev/null +++ b/build/util/lastchange.py @@ -0,0 +1,286 @@ +#!/usr/bin/env python +# Copyright (c) 2011 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. + +""" +lastchange.py -- Chromium revision fetching utility. +""" + +import re +import optparse +import os +import subprocess +import sys + +class VersionInfo(object): + def __init__(self, url, root, revision): + self.url = url + self.root = root + self.revision = revision + + +def FetchSVNRevision(directory): + """ + Fetch the Subversion branch and revision for a given directory. + + Errors are swallowed. + + Returns: + a VersionInfo object or None on error. + """ + try: + proc = subprocess.Popen(['svn', 'info'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=directory, + shell=(sys.platform=='win32')) + except OSError: + # command is apparently either not installed or not executable. + return None + if not proc: + return None + + attrs = {} + for line in proc.stdout: + line = line.strip() + if not line: + continue + key, val = line.split(': ', 1) + attrs[key] = val + + try: + url = attrs['URL'] + root = attrs['Repository Root'] + revision = attrs['Revision'] + except KeyError: + return None + + return VersionInfo(url, root, revision) + + +def RunGitCommand(directory, command): + """ + Launches git subcommand. + + Errors are swallowed. + + Returns: + process object or None. + """ + command = ['git'] + command + # Force shell usage under cygwin & win32. This is a workaround for + # mysterious loss of cwd while invoking cygwin's git. + # We can't just pass shell=True to Popen, as under win32 this will + # cause CMD to be used, while we explicitly want a cygwin shell. + if sys.platform in ('cygwin', 'win32'): + command = ['sh', '-c', ' '.join(command)] + try: + proc = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=directory) + return proc + except OSError: + return None + + +def FetchGitRevision(directory): + """ + Fetch the Git hash for a given directory. + + Errors are swallowed. + + Returns: + a VersionInfo object or None on error. + """ + proc = RunGitCommand(directory, ['rev-parse', 'HEAD']) + if proc: + output = proc.communicate()[0].strip() + if proc.returncode == 0 and output: + return VersionInfo('git', 'git', output[:7]) + return None + + +def IsGitSVN(directory): + """ + Checks whether git-svn has been set up. + + Errors are swallowed. + + Returns: + whether git-svn has been set up. + """ + # To test whether git-svn has been set up, query the config for any + # svn-related configuration. This command exits with an error code + # if there aren't any matches, so ignore its output. + proc = RunGitCommand(directory, ['config', '--get-regexp', '^svn']) + if proc: + return (proc.wait() == 0) + return False + + +def FetchGitSVNURL(directory): + """ + Fetch URL of SVN repository bound to git. + + Errors are swallowed. + + Returns: + SVN URL. + """ + if IsGitSVN(directory): + proc = RunGitCommand(directory, ['svn', 'info', '--url']) + if proc: + output = proc.communicate()[0].strip() + if proc.returncode == 0: + match = re.search(r'^\w+://.*$', output, re.M) + if match: + return match.group(0) + return '' + + +def FetchGitSVNRoot(directory): + """ + Fetch root of SVN repository bound to git. + + Errors are swallowed. + + Returns: + SVN root repository. + """ + if IsGitSVN(directory): + git_command = ['config', '--get-regexp', '^svn-remote.svn.url$'] + proc = RunGitCommand(directory, git_command) + if proc: + output = proc.communicate()[0].strip() + if proc.returncode == 0: + # Zero return code implies presence of requested configuration variable. + # Its value is second (last) field of output. + match = re.search(r'\S+$', output) + if match: + return match.group(0) + return '' + + +def LookupGitSVNRevision(directory, depth): + """ + Fetch the Git-SVN identifier for the local tree. + Parses first |depth| commit messages. + + Errors are swallowed. + """ + if not IsGitSVN(directory): + return None + git_re = re.compile(r'^\s*git-svn-id:\s+(\S+)@(\d+)') + proc = RunGitCommand(directory, ['log', '-' + str(depth)]) + if proc: + for line in proc.stdout: + match = git_re.match(line) + if match: + id = match.group(2) + if id: + proc.stdout.close() # Cut pipe for fast exit. + return id + return None + + +def IsGitSVNDirty(directory): + """ + Checks whether our git-svn tree contains clean trunk or some branch. + + Errors are swallowed. + """ + # For git branches the last commit message is either + # some local commit or a merge. + return LookupGitSVNRevision(directory, 1) is None + + +def FetchGitSVNRevision(directory): + """ + Fetch the Git-SVN identifier for the local tree. + + Errors are swallowed. + """ + # We assume that at least first 999 commit messages contain svn evidence. + revision = LookupGitSVNRevision(directory, 999) + if not revision: + return None + if IsGitSVNDirty(directory): + revision = revision + '-dirty' + url = FetchGitSVNURL(directory) + root = FetchGitSVNRoot(directory) + return VersionInfo(url, root, revision) + + +def FetchVersionInfo(default_lastchange, directory=None): + """ + Returns the last change (in the form of a branch, revision tuple), + from some appropriate revision control system. + """ + version_info = (FetchSVNRevision(directory) or + FetchGitSVNRevision(directory) or FetchGitRevision(directory)) + if not version_info: + if default_lastchange and os.path.exists(default_lastchange): + revision = open(default_lastchange, 'r').read().strip() + version_info = VersionInfo(None, None, revision) + else: + version_info = VersionInfo('unknown', '', '0') + return version_info + + +def WriteIfChanged(file_name, contents): + """ + Writes the specified contents to the specified file_name + iff the contents are different than the current contents. + """ + try: + old_contents = open(file_name, 'r').read() + except EnvironmentError: + pass + else: + if contents == old_contents: + return + os.unlink(file_name) + open(file_name, 'w').write(contents) + + +def main(argv=None): + if argv is None: + argv = sys.argv + + parser = optparse.OptionParser(usage="lastchange.py [options]") + parser.add_option("-d", "--default-lastchange", metavar="FILE", + help="default last change input FILE") + parser.add_option("-o", "--output", metavar="FILE", + help="write last change to FILE") + parser.add_option("--revision-only", action='store_true', + help="just print the SVN revision number") + opts, args = parser.parse_args(argv[1:]) + + out_file = opts.output + + while len(args) and out_file is None: + if out_file is None: + out_file = args.pop(0) + if args: + sys.stderr.write('Unexpected arguments: %r\n\n' % args) + parser.print_help() + sys.exit(2) + + version_info = FetchVersionInfo(opts.default_lastchange) + + if opts.revision_only: + print version_info.revision + else: + contents = "LASTCHANGE=%s\n" % version_info.revision + if out_file: + WriteIfChanged(out_file, contents) + else: + sys.stdout.write(contents) + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/build/util/support/support.gyp b/build/util/support/support.gyp new file mode 100644 index 0000000..5840f80 --- /dev/null +++ b/build/util/support/support.gyp @@ -0,0 +1,21 @@ +# Copyright (c) 2009 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. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'includes': [ + '../../common.gypi', + ], + 'targets': [ + { + 'target_name': 'support', + 'type': 'none', + }, + # TODO(slightlyoff) + ], +} + +# vim: shiftwidth=2:et:ai:tabstop=2 diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt new file mode 100644 index 0000000..28040e3 --- /dev/null +++ b/build/whitespace_file.txt @@ -0,0 +1,11 @@ +Copyright (c) 2011 The Chromium Authors. All rights reserved. +Use of this useless file is governed by a BSD-style license that can be +found in the LICENSE file. + +This file is used for making non-code changes to trigger buildbot cycles. Make +any modification below this line. +================================================================================ + +i am somewhat YELLY BELLY! + +<<< All your base are belong to us. >>> diff --git a/build/win/chrome_win.croc b/build/win/chrome_win.croc new file mode 100644 index 0000000..e1e3bb7 --- /dev/null +++ b/build/win/chrome_win.croc @@ -0,0 +1,26 @@ +# -*- python -*- +# Crocodile config file for Chromium windows + +{ + # List of rules, applied in order + 'rules' : [ + # Specify inclusions before exclusions, since rules are in order. + + # Don't include chromeos, posix, or linux specific files + { + 'regexp' : '.*(_|/)(chromeos|linux|posix)(\\.|_)', + 'include' : 0, + }, + # Don't include ChromeOS dirs + { + 'regexp' : '.*/chromeos/', + 'include' : 0, + }, + + # Groups + { + 'regexp' : '.*_test_win\\.', + 'group' : 'test', + }, + ], +} diff --git a/build/win/system.gyp b/build/win/system.gyp new file mode 100644 index 0000000..0c06849 --- /dev/null +++ b/build/win/system.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2009 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. + +{ + 'targets': [ + { + 'target_name': 'cygwin', + 'type': 'none', + 'actions': [ + { + 'action_name': 'setup_mount', + 'msvs_cygwin_shell': 0, + 'inputs': [ + '../../third_party/cygwin/setup_mount.bat', + ], + # Visual Studio requires an output file, or else the + # custom build step won't run. + 'outputs': [ + '../../third_party/cygwin/_always_run_setup_mount.marker', + ], + 'action': ['', '<@(_inputs)'], + }, + ], + }, + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: |