Commit 77ba1546 authored by kjellander@google.com's avatar kjellander@google.com

Make Libyuv work with Chromium Git checkouts

This is very similar to the changes in
https://code.google.com/p/webrtc/source/detail?r=6938

TESTED=gclient sync and runhooks on Mac and Linux + building successfully.
R=fbarchard@chromium.org

Review URL: https://webrtc-codereview.appspot.com/24619004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1089 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent c52d66d7
.gn
build
buildtools
chromium/.gclient_entries
chromium/.last_sync_chromium
chromium/src/
google_apis
links
net
out/
testing
third_party/
tools/android
tools/clang
tools/find_depot_tools.py
tools/gn
tools/gyp
tools/memory
tools/python
tools/valgrind
tools/win
use_relative_paths = True
vars = {
"libyuv_trunk" : "https://libyuv.googlecode.com/svn/trunk",
......@@ -8,208 +6,24 @@ vars = {
"root_dir": "trunk",
"extra_gyp_flag": "-Dextra_gyp_flag=0",
# Use this googlecode_url variable only if there is an internal mirror for it.
# If you do not know, use the full path while defining your new deps entry.
"googlecode_url": "http://%s.googlecode.com/svn",
"chromium_trunk" : "http://src.chromium.org/svn/trunk",
# chrome://version/ for revision of canary Chrome.
# http://chromium-status.appspot.com/lkgr is a last known good revision.
"chromium_revision": "291168",
}
# NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
# https; the latter can cause problems for users behind proxies.
deps = {
"../chromium_deps":
File(Var("chromium_trunk") + "/src/DEPS@" + Var("chromium_revision")),
"../chromium_gn":
File(Var("chromium_trunk") + "/src/.gn@" + Var("chromium_revision")),
"build":
Var("chromium_trunk") + "/src/build@" + Var("chromium_revision"),
"buildtools":
From("chromium_deps", "src/buildtools"),
# Needed by common.gypi.
"google_apis/build":
Var("chromium_trunk") + "/src/google_apis/build@" + Var("chromium_revision"),
"testing":
Var("chromium_trunk") + "/src/testing@" + Var("chromium_revision"),
"testing/gtest":
From("chromium_deps", "src/testing/gtest"),
"tools/clang":
Var("chromium_trunk") + "/src/tools/clang@" + Var("chromium_revision"),
"tools/gn":
Var("chromium_trunk") + "/src/tools/gn@" + Var("chromium_revision"),
"tools/gyp":
From("chromium_deps", "src/tools/gyp"),
"tools/memory":
Var("chromium_trunk") + "/src/tools/memory@" + Var("chromium_revision"),
"tools/python":
Var("chromium_trunk") + "/src/tools/python@" + Var("chromium_revision"),
"tools/valgrind":
Var("chromium_trunk") + "/src/tools/valgrind@" + Var("chromium_revision"),
# Needed by build/common.gypi.
"tools/win/supalink":
Var("chromium_trunk") + "/src/tools/win/supalink@" + Var("chromium_revision"),
"third_party/binutils":
Var("chromium_trunk") + "/src/third_party/binutils@" + Var("chromium_revision"),
"third_party/libc++":
Var("chromium_trunk") + "/src/third_party/libc++@" + Var("chromium_revision"),
"third_party/libc++/trunk":
From("chromium_deps", "src/third_party/libc++/trunk"),
"third_party/libc++abi":
Var("chromium_trunk") + "/src/third_party/libc++abi@" + Var("chromium_revision"),
"third_party/libc++abi/trunk":
From("chromium_deps", "src/third_party/libc++abi/trunk"),
"third_party/libjpeg_turbo":
From("chromium_deps", "src/third_party/libjpeg_turbo"),
# Yasm assember required for libjpeg_turbo
"third_party/yasm":
Var("chromium_trunk") + "/src/third_party/yasm@" + Var("chromium_revision"),
"third_party/yasm/source/patched-yasm":
Var("chromium_trunk") + "/deps/third_party/yasm/patched-yasm@" + Var("chromium_revision"),
}
deps_os = {
"win": {
# Use WebRTC's, stripped down, version of Cygwin (required by GYP).
"third_party/cygwin":
(Var("googlecode_url") % "webrtc") + "/deps/third_party/cygwin@2672",
# Used by libjpeg-turbo.
# TODO(fbarchard): Remove binaries and run yasm from build folder.
"third_party/yasm/binaries":
Var("chromium_trunk") + "/deps/third_party/yasm/binaries@" + Var("chromium_revision"),
"third_party/yasm": None,
"tools/find_depot_tools":
File(Var("chromium_trunk") + "/src/tools/find_depot_tools.py@" + Var("chromium_revision")),
},
"android": {
"third_party/android_tools":
From("chromium_deps", "src/third_party/android_tools"),
"third_party/libjpeg":
Var("chromium_trunk") + "/src/third_party/libjpeg@" + Var("chromium_revision"),
},
"ios": {
# NSS, for SSLClientSocketNSS.
"third_party/nss":
From("chromium_deps", "src/third_party/nss"),
"net/third_party/nss":
Var("chromium_trunk") + "/src/net/third_party/nss@" + Var("chromium_revision"),
# class-dump utility to generate header files for undocumented SDKs.
"testing/iossim/third_party/class-dump":
From("chromium_deps", "src/testing/iossim/third_party/class-dump"),
# Helper for running under the simulator.
"testing/iossim":
Var("chromium_trunk") + "/src/testing/iossim@" + Var("chromium_revision"),
},
# Roll the Chromium Git hash to pick up newer versions of all the
# dependencies and tools linked to in setup_links.py.
"chromium_revision": "6455c698e51af65f57a8fe83547296218a5a7251",
}
hooks = [
{
# Copy .gn from temporary place (../chromium_gn) to root_dir.
"name": "copy .gn",
"pattern": ".",
"action": ["python", Var("root_dir") + "/build/cp.py",
Var("root_dir") + "/../chromium_gn/.gn",
Var("root_dir")],
},
# Pull GN binaries. This needs to be before running GYP below.
{
"name": "gn_win",
"pattern": ".",
"action": [ "download_from_google_storage",
"--no_resume",
"--platform=win32",
"--no_auth",
"--bucket", "chromium-gn",
"-s", Var("root_dir") + "/buildtools/win/gn.exe.sha1",
],
},
{
"name": "gn_mac",
"pattern": ".",
"action": [ "download_from_google_storage",
"--no_resume",
"--platform=darwin",
"--no_auth",
"--bucket", "chromium-gn",
"-s", Var("root_dir") + "/buildtools/mac/gn.sha1",
],
},
{
"name": "gn_linux",
"pattern": ".",
"action": [ "download_from_google_storage",
"--no_resume",
"--platform=linux*",
"--no_auth",
"--bucket", "chromium-gn",
"-s", Var("root_dir") + "/buildtools/linux64/gn.sha1",
],
},
{
"name": "gn_linux32",
"pattern": ".",
"action": [ "download_from_google_storage",
"--no_resume",
"--platform=linux*",
"--no_auth",
"--bucket", "chromium-gn",
"-s", Var("root_dir") + "/buildtools/linux32/gn.sha1",
],
},
{
# Remove GN binaries from tools/gn/bin that aren't used anymore.
# TODO(kjellander) remove after the end of July, 2014.
"name": "remove_old_gn_binaries",
"pattern": ".",
"action": ["python", Var("root_dir") + "/tools/gn/bin/rm_binaries.py"],
},
{
# Pull clang on mac. If nothing changed, or on non-mac platforms, this takes
# zero seconds to run. If something changed, it downloads a prebuilt clang.
"pattern": ".",
"action": ["python", Var("root_dir") + "/tools/clang/scripts/update.py",
"--if-needed"],
},
{
# Update the Windows toolchain if necessary.
"name": "win_toolchain",
# Clone chromium and its deps.
"name": "sync chromium",
"pattern": ".",
"action": ["python", Var("root_dir") + "/download_vs_toolchain.py",
"update"],
"action": ["python", "-u", Var("root_dir") + "/sync_chromium.py",
"--target-revision", Var("chromium_revision")],
},
{
# Pull binutils for gold.
"name": "binutils",
# Create links to shared dependencies in Chromium.
"name": "setup_links",
"pattern": ".",
"action": ["python", Var("root_dir") + "/third_party/binutils/download.py"],
"action": ["python", Var("root_dir") + "/setup_links.py"],
},
{
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
......
# Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import re
import sys
def GetDefaultTryConfigs(bots=None):
"""Returns a list of ('bot', set(['tests']), optionally filtered by [bots].
For WebRTC purposes, we always return an empty list of tests, since we want
to run all tests by default on all our trybots.
"""
return { 'tryserver.libyuv': dict((bot, []) for bot in bots)}
# pylint: disable=W0613
def GetPreferredTryMasters(project, change):
files = change.LocalPaths()
bots = [
'win',
'win_rel',
'win_x64_rel',
'mac',
'mac_rel',
'mac_x64_rel',
'ios',
'ios_rel',
'mac_asan',
'linux',
'linux_rel',
'linux_memcheck',
'linux_tsan2',
'linux_asan',
'android',
'android_rel',
]
if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files):
return {}
return GetDefaultTryConfigs(bots)
solutions = [{
'name': 'src',
'url': 'https://chromium.googlesource.com/chromium/src.git',
'deps_file': '.DEPS.git',
'managed': False,
'custom_deps': {
# Skip syncing some large dependencies Libyuv will never need.
'src/chrome/tools/test/reference_build/chrome_linux': None,
'src/chrome/tools/test/reference_build/chrome_mac': None,
'src/chrome/tools/test/reference_build/chrome_win': None,
'src/native_client': None,
'src/third_party/ffmpeg': None,
'src/third_party/WebKit': None,
'src/v8': None,
},
'safesync_url': ''
}]
cache_dir = None
This .gclient file is used to do download a copy of Chromium.
Libyuv uses the Chromium build toolchain and a number of shared
dependencies by creating symlinks to folders in this checkout,
using the ../setup_links.py script.
......@@ -19,7 +19,6 @@ import sys
checkout_root = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(checkout_root, 'build'))
sys.path.insert(0, os.path.join(checkout_root, 'tools', 'find_depot_tools'))
import gyp_chromium
import gyp_helper
import vs_toolchain
......@@ -27,6 +26,13 @@ import vs_toolchain
sys.path.insert(0, os.path.join(checkout_root, 'tools', 'gyp', 'pylib'))
import gyp
def GetSupplementalFiles():
"""Returns a list of the supplemental files that are included in all GYP
sources."""
# Can't use the one in gyp_chromium since the directory location of the root
# is different.
return glob.glob(os.path.join(checkout_root, '*', 'supplement.gypi'))
if __name__ == '__main__':
args = sys.argv[1:]
......@@ -41,7 +47,10 @@ if __name__ == '__main__':
# If we didn't get a file, assume 'all.gyp' in the root of the checkout.
if not gyp_file_specified:
args.append(os.path.join(checkout_root, 'all.gyp'))
# Because of a bug in gyp, simply adding the abspath to all.gyp doesn't
# work, but chdir'ing and adding the relative path does. Spooky :/
os.chdir(checkout_root)
args.append('all.gyp')
# There shouldn't be a circular dependency relationship between .gyp files,
args.append('--no-circular-check')
......@@ -50,6 +59,8 @@ if __name__ == '__main__':
if not os.environ.get('GYP_GENERATORS'):
os.environ['GYP_GENERATORS'] = 'ninja'
vs2013_runtime_dll_dirs = None
if int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')):
vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
# Enforce gyp syntax checking. This adds about 20% execution time.
......
This diff is collapsed.
#!/usr/bin/env python
# Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import argparse
import os
import subprocess
import sys
# Bump this whenever the algorithm changes and you need bots/devs to re-sync,
# ignoring the .last_sync_chromium file
SCRIPT_VERSION = 1
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def get_target_os_list():
try:
main_gclient = os.path.join(os.path.dirname(ROOT_DIR), '.gclient')
config_dict = {}
with open(main_gclient, 'rb') as deps_content:
exec(deps_content, config_dict)
return ','.join(config_dict.get('target_os', []))
except Exception as e:
print >> sys.stderr, "error while parsing .gclient:", e
def main():
CR_DIR = os.path.join(ROOT_DIR, 'chromium')
p = argparse.ArgumentParser()
p.add_argument('--target-revision', required=True,
help='The target chromium git revision [REQUIRED]')
p.add_argument('--chromium-dir', default=CR_DIR,
help=('The path to the chromium directory to sync '
'(default: %(default)r)'))
opts = p.parse_args()
opts.chromium_dir = os.path.abspath(opts.chromium_dir)
target_os_list = get_target_os_list()
# Do a quick check to see if we were successful last time to make runhooks
# sooper fast.
flag_file = os.path.join(opts.chromium_dir, '.last_sync_chromium')
flag_file_content = '\n'.join([
str(SCRIPT_VERSION),
opts.target_revision,
repr(target_os_list),
])
if os.path.exists(flag_file):
with open(flag_file, 'r') as f:
if f.read() == flag_file_content:
print "Chromium already up to date:", opts.target_revision
return 0
os.unlink(flag_file)
env = os.environ.copy()
env['GYP_CHROMIUM_NO_ACTION'] = '1'
gclient_cmd = 'gclient.bat' if sys.platform.startswith('win') else 'gclient'
args = [
gclient_cmd, 'sync', '--force', '--revision', 'src@'+opts.target_revision
]
if os.environ.get('CHROME_HEADLESS') == '1':
args.append('-vvv')
if sys.platform.startswith('win'):
cache_path = os.path.join(os.path.splitdrive(ROOT_DIR)[0] + os.path.sep,
'b', 'git-cache')
else:
cache_path = '/b/git-cache'
gclientfile = os.path.join(opts.chromium_dir, '.gclient')
with open(gclientfile, 'rb') as spec:
spec = spec.read().splitlines()
spec[-1] = 'cache_dir = %r' % (cache_path,)
with open(gclientfile + '.bot', 'wb') as f:
f.write('\n'.join(spec))
args += [
'--gclientfile', '.gclient.bot',
'--delete_unversioned_trees', '--reset', '--upstream'
]
else:
args.append('--no-history')
if target_os_list:
args += ['--deps=' + target_os_list]
print 'Running "%s" in %s' % (' '.join(args), opts.chromium_dir)
ret = subprocess.call(args, cwd=opts.chromium_dir, env=env)
if ret == 0:
with open(flag_file, 'wb') as f:
f.write(flag_file_content)
return ret
if __name__ == '__main__':
sys.exit(main())
# Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# This is a similar target to the one in Chromium's base.gyp. It's needed to get
# the same sanitizer settings as Chromium uses (i.e. ASan, LSan, TSan...).
{
'targets': [
{
'target_name': 'sanitizer_options',
'type': 'static_library',
'toolsets': ['host', 'target'],
'variables': {
# Every target is going to depend on sanitizer_options, so allow
# this one to depend on itself.
'prune_self_dependency': 1,
# Do not let 'none' targets depend on this one, they don't need to.
'link_dependency': 1,
},
'sources': [
'sanitizer_options/sanitizer_options.cc',
],
'include_dirs': [
'<(DEPTH)',
],
# Some targets may want to opt-out from ASan, TSan and MSan and link
# without the corresponding runtime libraries. We drop the libc++
# dependency and omit the compiler flags to avoid bringing instrumented
# code to those targets.
'conditions': [
['use_custom_libcxx==1', {
'dependencies!': [
'<(DEPTH)/third_party/libc++/libc++.gyp:libcxx_proxy',
],
}],
['tsan==1', {
'sources': [
'tsan_suppressions/tsan_suppressions.cc',
],
}],
],
'cflags!': [
'-fsanitize=address',
'-fsanitize=thread',
'-fsanitize=memory',
'-fsanitize-memory-track-origins',
],
'direct_dependent_settings': {
'ldflags': [
'-Wl,-u_sanitizer_options_link_helper',
],
},
},
], # targets
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment