mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-28 07:48:14 +08:00
e18f6a6e66
crashpad and mini_chromium both have top-level “build” directories. These would conflict with top-level “BUILD” files in google3 when checked out on a case-sensitive filesystem. Although Crashpad’s “build” directory can be moved easily, mini_chromium’s matches Chromium’s, which is much more difficult to move. “build” is also the best and most obvious name for these directories. To avoid this problem, in the external-dependencies build, crashpad and mini_chromium are placed one level deeper, just as crashpad is in Chromium, and mini_chromium is in the standalone Crashpad build. This allows true pristine unmodified copies to be checked in to google3, without comingling locally-added files such as BUILD with external source. The directory structure adopted for the external-dependencies build is now root/crashpad/crashpad[/README] root/gmock[/include/gmock/gmock.h] root/gtest[/include/gtest/gtest.h] root/gyp[/pylib/gyp] root/mini_chromium/mini_chromium[/build/common.gypi] Change-Id: Idbc8f1b0d87da0cbceab3c15e059e839c1fb6a3f Reviewed-on: https://chromium-review.googlesource.com/323991 Reviewed-by: Robert Sesek <rsesek@chromium.org>
88 lines
3.0 KiB
Python
Executable File
88 lines
3.0 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# Copyright 2014 The Crashpad Authors. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def ChooseDependencyPath(local_path, external_path):
|
|
"""Chooses between a dependency located at local path and an external path.
|
|
|
|
The local path, used in standalone builds, is preferred. If it is not present
|
|
but the external path is, the external path will be used. If neither path is
|
|
present, the local path will be used, so that error messages uniformly refer
|
|
to the local path.
|
|
|
|
Args:
|
|
local_path: The preferred local path to use for a standalone build.
|
|
external_path: The external path to fall back to.
|
|
|
|
Returns:
|
|
A 2-tuple. The first element is 'standalone' or 'external', depending on
|
|
whether local_path or external_path was chosen. The second element is the
|
|
chosen path.
|
|
"""
|
|
if os.path.exists(local_path) or not os.path.exists(external_path):
|
|
return ('standalone', local_path)
|
|
return ('external', external_path)
|
|
|
|
|
|
script_dir = os.path.dirname(__file__)
|
|
crashpad_dir = (os.path.dirname(script_dir) if script_dir not in ('', os.curdir)
|
|
else os.pardir)
|
|
|
|
sys.path.insert(0,
|
|
ChooseDependencyPath(os.path.join(crashpad_dir, 'third_party', 'gyp', 'gyp',
|
|
'pylib'),
|
|
os.path.join(crashpad_dir, os.pardir, os.pardir, 'gyp',
|
|
'pylib'))[1])
|
|
|
|
import gyp
|
|
|
|
|
|
def main(args):
|
|
if 'GYP_GENERATORS' not in os.environ:
|
|
os.environ['GYP_GENERATORS'] = 'ninja'
|
|
|
|
crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir
|
|
|
|
(dependencies, mini_chromium_dir) = (ChooseDependencyPath(
|
|
os.path.join(crashpad_dir, 'third_party', 'mini_chromium',
|
|
'mini_chromium', 'build', 'common.gypi'),
|
|
os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium',
|
|
'mini_chromium', 'build', 'common.gypi')))
|
|
args.extend(['-D', 'crashpad_dependencies=%s' % dependencies])
|
|
args.extend(['--include', mini_chromium_dir])
|
|
args.extend(['--depth', crashpad_dir_or_dot])
|
|
args.append(os.path.join(crashpad_dir, 'crashpad.gyp'))
|
|
|
|
result = gyp.main(args)
|
|
if result != 0:
|
|
return result
|
|
|
|
if sys.platform == 'win32':
|
|
# Also generate the x86 build.
|
|
result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug'])
|
|
if result != 0:
|
|
return result
|
|
result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Release'])
|
|
|
|
return result
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv[1:]))
|