skia2/gn.py
mtklein c04ff4788c GN
What we've got here is a little GN MVP.  It's lacking any knobs and doesn't yet build anything but libskia, zlib, libpng, and libjpeg-turbo.  I've been hopping back and forth between Linux at work and Mac at home.  These seem to be at least partially working, enough to build and run cmake/example.cpp.

The xcode backend seems to work.  From here, we can start exploring how to handle other backends (cmake,Android make, Google3).  There are a couple things I want to try:
  - add another backend like vs or xcode to GN directly
  - intercept via a custom toolchain
  - reverse from ninja -t commands
That last option seems kind of fun.

This tries to piggyback on Chrome's GN setup as much as possible.  Chrome's got quite a lot figured out, and we're basically required to do this if we want to have a single GN build system shareable by Chrome, our bots, and other clients.

This pulls in some new DEPS:
   - build: Chrome's GN configuration, and much more
   - buildtools: hashes for gn binary, pulled via hooks
   - tools/clang: hashes for Chrome's clang, pulled via hooks into third_party/llvm-build
It additionally symlinks tools/gyp to third_party/externals/gyp.  GN pulls some stuff from tools/gyp on Mac.

Have not yet tried building for Windows, Android, or iOS.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2087593002

Committed: https://skia.googlesource.com/skia/+/1d8de594f126b9a80bd8f8fa2005e90faf3b5b17
Review-Url: https://codereview.chromium.org/2087593002
2016-06-23 10:29:30 -07:00

38 lines
994 B
Python
Executable File

#!/usr/bin/env python
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import subprocess
import sys
def quiet(*cmd):
cmd = ' '.join(cmd).split()
subprocess.check_output(cmd)
def loud(*cmd):
cmd = ' '.join(cmd).split()
ret = subprocess.call(cmd)
if ret != 0:
sys.exit(ret)
def gn_path():
if 'linux' in sys.platform:
return 'buildtools/linux64/gn'
if 'darwin' in sys.platform:
return 'buildtools/mac/gn'
return 'buildtools/win/gn.exe'
# Make sure we've got an up-to-date GN and Clang, and sysroot on Linux.
quiet('download_from_google_storage',
'--no_resume --no_auth --bucket chromium-gn',
'-s ', gn_path() + '.sha1')
quiet('python tools/clang/scripts/update.py --if-needed')
if 'linux' in sys.platform:
quiet('python build/linux/sysroot_scripts/install-sysroot.py --arch=amd64')
# Pass all our arguments over to the real GN binary.
loud(gn_path(), *sys.argv[1:])